Skip to content

Commit c168d0e

Browse files
committed
update ix
1 parent f27b006 commit c168d0e

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

programs/portal/src/instructions/admin.rs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
use 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

47
use 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

644662
pub 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
}

services/cli/utils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { SolanaNtt } from '@wormhole-foundation/sdk-solana-ntt';
33
import { SolanaPlatform, SolanaSendSigner } from '@wormhole-foundation/sdk-solana';
44
import { AccountAddress, sha256, Wormhole } from '@wormhole-foundation/sdk';
55
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
6+
import { getAssociatedTokenAddressSync, TOKEN_2022_PROGRAM_ID } from '@solana/spl-token';
67

78
const PORTAL = new PublicKey('mzp1q2j5Hr1QuLC3KFBCAUz5aUckT6qyuZKZ3WJnMmY');
89

@@ -65,6 +66,21 @@ export function updatePortalMint(owner: PublicKey, config: PublicKey, mMint: Pub
6566
isSigner: false,
6667
isWritable: false,
6768
},
69+
{
70+
pubkey: PublicKey.findProgramAddressSync([Buffer.from('token_authority')], PORTAL)[0],
71+
isSigner: false,
72+
isWritable: false,
73+
},
74+
{
75+
pubkey: getAssociatedTokenAddressSync(
76+
mMint,
77+
PublicKey.findProgramAddressSync([Buffer.from('token_authority')], PORTAL)[0],
78+
true,
79+
TOKEN_2022_PROGRAM_ID,
80+
),
81+
isSigner: false,
82+
isWritable: false,
83+
},
6884
],
6985
data: Buffer.concat([Buffer.from(sha256('global:set_mint').subarray(0, 8))]),
7086
});

0 commit comments

Comments
 (0)