-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into anchor-bankrun
- Loading branch information
Showing
23 changed files
with
2,303 additions
and
1,774 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,6 @@ pub use make_offer::*; | |
|
||
pub mod take_offer; | ||
pub use take_offer::*; | ||
|
||
pub mod shared; | ||
pub use shared::*; |
25 changes: 25 additions & 0 deletions
25
tokens/escrow/anchor/programs/escrow/src/instructions/shared.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use anchor_lang::prelude::*; | ||
|
||
use anchor_spl::token_interface::{ | ||
transfer_checked, Mint, TokenAccount, TokenInterface, TransferChecked, | ||
}; | ||
|
||
pub fn transfer_tokens<'info>( | ||
from: &InterfaceAccount<'info, TokenAccount>, | ||
to: &InterfaceAccount<'info, TokenAccount>, | ||
amount: &u64, | ||
mint: &InterfaceAccount<'info, Mint>, | ||
authority: &Signer<'info>, | ||
token_program: &Interface<'info, TokenInterface>, | ||
) -> Result<()> { | ||
let transfer_accounts = TransferChecked { | ||
from: from.to_account_info(), | ||
mint: mint.to_account_info(), | ||
to: to.to_account_info(), | ||
authority: authority.to_account_info(), | ||
}; | ||
|
||
let cpi_context = CpiContext::new(token_program.to_account_info(), transfer_accounts); | ||
|
||
transfer_checked(cpi_context, *amount, mint.decimals) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
tokens/token-2022/transfer-hook/account-data-as-seed/anchor/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
.anchor | ||
.DS_Store | ||
target | ||
**/*.rs.bk | ||
node_modules | ||
test-ledger | ||
.yarn |
8 changes: 8 additions & 0 deletions
8
tokens/token-2022/transfer-hook/account-data-as-seed/anchor/.prettierignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
.anchor | ||
.DS_Store | ||
target | ||
node_modules | ||
dist | ||
build | ||
test-ledger |
10 changes: 10 additions & 0 deletions
10
tokens/token-2022/transfer-hook/account-data-as-seed/anchor/.prettierrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": false, | ||
"printWidth": 80, | ||
"trailingComma": "all", | ||
"arrowParens": "avoid", | ||
"endOfLine": "auto", | ||
"proseWrap": "always" | ||
} |
Oops, something went wrong.