-
Notifications
You must be signed in to change notification settings - Fork 0
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
Redefine certificate_vault
as account owning all certificate ATAs
#21
Conversation
e1e290a
to
dcb0906
Compare
@@ -115,9 +116,12 @@ pub struct StoreCertificates<'info> { | |||
pub output_yield_token_account: Account<'info, TokenAccount>, | |||
#[account( | |||
mut, | |||
constraint = certificate_vault.key() == state.certificate_vault @ ErrorCode::IncorrectHoldAccount, | |||
associated_token::mint = output_yield_token_account.mint, | |||
associated_token::authority = state.certificate_vault, |
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 tried to write it with init_if_needed
like this:
#[account(
init_if_needed,
payer = payer,
associated_token::mint = output_yield_token_account.mint,
associated_token::authority = state.certificate_vault,
)]
// the account where we store all the certificates
pub certificate_vault_ata: Account<'info, TokenAccount>,
But got an error of the mint constraint has to be an account field for token initializations (not a public key)
. Do you know how we can convert the mint address into a mint account? Or is it ok to keep the implementation as it is now and create the certificate_vault_ata
on the client side?
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 think what the error is saying is that you need to pass in the mint as an account to the instruction too. So the input accounts should be:
- payer (signer of the tx, mutable)
- state
- retirement cert mint
- output yield account (the owner of the source token account) <- This should not be mutable btw
- output yield token account (the source token account - its mint must = the retirement cert mint)
- certificate vault ATA (init_if_needed, authority = state.certificate_vault, mint = retirement cert mint)
- the programs.
6a8b57f
to
82983a1
Compare
c80880d
to
d3d8ec6
Compare
…ion_seed` as seed
d3d8ec6
to
3e3483d
Compare
No description provided.