11use anchor_lang:: prelude:: * ;
2- use anchor_spl:: { token_2022:: spl_token_2022:: instruction:: AuthorityType , token_interface} ;
2+ use anchor_spl:: {
3+ token_2022:: { spl_token_2022:: instruction:: AuthorityType , Token2022 } ,
4+ token_interface,
5+ } ;
36
47use crate :: {
58 config:: Config ,
@@ -9,6 +12,7 @@ use crate::{
912 pending_token_authority:: PendingTokenAuthority ,
1013 queue:: { inbox:: InboxRateLimit , outbox:: OutboxRateLimit , rate_limit:: RateLimitState } ,
1114 registered_transceiver:: RegisteredTransceiver ,
15+ TOKEN_AUTHORITY_SEED ,
1216} ;
1317
1418// * Transfer ownership
@@ -639,9 +643,24 @@ pub struct SetMint<'info> {
639643 pub config : Account < ' info , Config > ,
640644
641645 pub mint : InterfaceAccount < ' info , token_interface:: Mint > ,
646+
647+ /// CHECK: This account is validated by its seeds
648+ #[ account(
649+ seeds = [ TOKEN_AUTHORITY_SEED ] ,
650+ bump,
651+ ) ]
652+ pub token_authority : UncheckedAccount < ' info > ,
653+
654+ #[ account(
655+ associated_token:: mint = mint,
656+ associated_token:: authority = token_authority,
657+ associated_token:: token_program = Token2022 :: id( ) ,
658+ ) ]
659+ pub custody : InterfaceAccount < ' info , token_interface:: TokenAccount > ,
642660}
643661
644662pub fn set_mint ( ctx : Context < SetMint > ) -> Result < ( ) > {
645663 ctx. accounts . config . mint = ctx. accounts . mint . key ( ) ;
664+ ctx. accounts . config . custody = ctx. accounts . custody . key ( ) ;
646665 Ok ( ( ) )
647666}
0 commit comments