-
Notifications
You must be signed in to change notification settings - Fork 123
Claimable Tokens Program: Add SetAuthority and Close instructions #12841
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
base: main
Are you sure you want to change the base?
Conversation
…oken program directly
|
| .map_err(|_| ClaimableProgramError::InvalidSignatureData)?; | ||
|
|
||
| // Verify the blockhash is recent to prevent replay attacks | ||
| let recent_blockhashes = RecentBlockhashes::from_account_info(&recent_blockhashes_account_info) |
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.
Remove this - deprecated
Adds the
SetAuthorityandCloseinstructions to the claimable tokens program.SetAuthorityis a proxy tospl_token's ownset_authority. It allows the claimable tokens account to be reassigned elsewhere by setting the owner. Also allows changing the closing authority to help safeguard rent (provided the owner hasn't changed).Note that instead of keeping a
nonceaccount to prevent replays of these instructions, I'm using the recent blockhashes. For a bit, the instruction will be replayable. It's probably overkill actually in retrospect as setting an authority means that unsetting it now needs a signature from the existing authority.Closeis a proxy tospl_token's ownclose_account. It allows the rent to be reclaimed to a hardcoded address if the closeAuthority is not set and the owner is still the program PDA authority.Risks:
Tested using the CLI on a local solana-test-validator: