-
Notifications
You must be signed in to change notification settings - Fork 68
fix(svm): M-01 Deposit Tokens Transferred from Depositor Token Account Instead of Signer #958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
md0x
merged 33 commits into
master
from
pablo/acx-4021-m-01-deposit-tokens-transferred-from-depositor-token-account
Apr 23, 2025
Merged
Changes from 11 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
0e9be37
fix(svm): M-01 Deposit Tokens Transfers
md0x a776129
feat: use unchecked account
md0x 473abaf
feat: remove system acc
md0x 46e561e
fix: deposit tests
md0x 44aaac3
fix: fill tests
md0x 7aa3d8a
refactor: rename and comments
md0x 6d86ec4
fix: across plus
md0x 6ff9e4b
Merge branch 'master' into pablo/acx-4021-m-01-deposit-tokens-transfe…
md0x b6eab4b
refactor: rename and organize function
md0x b45f24d
feat: update deposit delegate seed
md0x 101c4b6
feat: use relay_hash from function arguments
md0x 26f59ca
fix: heap memory error
md0x 71cf1ba
fix
md0x 3ef6c95
refactor: cleanup
md0x a324daf
fix: deposit checks
md0x 6671830
fix: fill tests
md0x 81b6cf5
fix: fill relay delagate
md0x 6e01b20
fix: fill
md0x 6a63040
refactor: simplify
md0x ef08497
refactor: cleanup
md0x 6bad227
refactor: clean fill test
md0x 659254f
test: update fill tests
md0x 9f43af0
refactor: comments
md0x 8431833
fix: scripts
md0x b6b8b9e
refactor: make seed structs private
md0x 5d34e89
feat: add missing params to deposit hashes
md0x 23cafcc
refactor: simplify
md0x 5c0f8be
refactor: delegate utils
md0x be4401e
refactor: anchor serialize
md0x 4150839
refactor: reuse helper deriveSeedHash
md0x 28bf1e1
fix: move paused fills check in handler
Reinis-FRP e475b31
feat: improvements
md0x 9acb2ff
fix: remove program_id from transfer_from params
Reinis-FRP File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,29 +1,25 @@ | ||
use anchor_lang::prelude::*; | ||
use anchor_spl::token_interface::{transfer_checked, Mint, TokenAccount, TokenInterface, TransferChecked}; | ||
|
||
use crate::State; | ||
|
||
pub fn transfer_from<'info>( | ||
from: &InterfaceAccount<'info, TokenAccount>, | ||
to: &InterfaceAccount<'info, TokenAccount>, | ||
amount: u64, | ||
state: &Account<'info, State>, | ||
state_bump: u8, | ||
delegate: &UncheckedAccount<'info>, | ||
mint: &InterfaceAccount<'info, Mint>, | ||
token_program: &Interface<'info, TokenInterface>, | ||
signer_seeds: &[&[u8]], | ||
) -> Result<()> { | ||
let transfer_accounts = TransferChecked { | ||
from: from.to_account_info(), | ||
mint: mint.to_account_info(), | ||
to: to.to_account_info(), | ||
authority: state.to_account_info(), | ||
authority: delegate.to_account_info(), | ||
}; | ||
|
||
let state_seed_bytes = state.seed.to_le_bytes(); | ||
let seeds = &[b"state", state_seed_bytes.as_ref(), &[state_bump]]; | ||
let signer_seeds = &[&seeds[..]]; | ||
|
||
let cpi_context = CpiContext::new_with_signer(token_program.to_account_info(), transfer_accounts, signer_seeds); | ||
let signer_seeds_slice = &[signer_seeds]; | ||
let cpi_context = | ||
CpiContext::new_with_signer(token_program.to_account_info(), transfer_accounts, signer_seeds_slice); | ||
|
||
transfer_checked(cpi_context, amount, mint.decimals) | ||
} |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.