-
Notifications
You must be signed in to change notification settings - Fork 40
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
added documentation and used transfer_checked instead #254
base: develop
Are you sure you want to change the base?
Conversation
// Validate token accounts and decimals | ||
require_eq!( | ||
accs.user_underlying_token_account.mint, | ||
accs.vault_underlying_token_mint.key(), | ||
VaultError::UnderlyingTokenMintMismatch | ||
); | ||
require_eq!( | ||
accs.vault_underlying_token_account.mint, | ||
accs.vault_underlying_token_mint.key(), | ||
VaultError::UnderlyingTokenMintMismatch | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are already checked in InteractWithVault
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are already checked in
InteractWithVault
Yes I performed those validations before leveraging the usefulness of TransferChecked and it seems kind of redundant. But even with that, TransferChecked remains a good option.
CpiContext::new_with_signer( | ||
accs.token_program.to_account_info(), | ||
Transfer { | ||
TransferChecked { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the point of TransferChecked
if we already know that the mints are the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I replied to it above. But if you're already sure about the mint and decimals, then you can use Transfer.
Thanks for taking a look and submitting this. Two things:
|
Yes
I will make sure future PRs are made per thing. |
Add Documentation and Implement transfer_checked
Changes
Implemented
transfer_checked
for improved token transfer safetytransfer
withtransfer_checked
in token operationsEnhanced documentation across multiple components:
Security Considerations
transfer_checked
provides additional runtime safety by verifying: