Skip to content

Commit d0a75f9

Browse files
committed
add inbox mint check
1 parent 06204a7 commit d0a75f9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

programs/portal/src/instructions/release_inbound_extension.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use earn::state::GLOBAL_SEED;
44
use ext_swap::accounts::SwapGlobal;
55
use ext_swap::program::ExtSwap;
66

7+
use crate::error::NTTError;
78
use crate::instructions::{ext_swap, release_inbound_mint_common};
89
use crate::instructions::{ReleaseInboundArgs, ReleaseInboundMint};
910
use crate::ReleaseInboundMintBumps;
@@ -113,6 +114,22 @@ pub fn release_inbound_mint_extension<'info>(
113114

114115
ctx.accounts.common.recipient.reload()?;
115116

117+
// Ensure target extensions is correct
118+
// (only validate if we know the extension exists)
119+
let target_mint = &ctx.accounts.common.inbox_item.destination_mint;
120+
if ctx
121+
.accounts
122+
.swap_global
123+
.whitelisted_extensions
124+
.iter()
125+
.find(|ext| ext.mint.eq(target_mint))
126+
.is_some()
127+
{
128+
if !ctx.accounts.ext_mint.key().eq(target_mint) {
129+
return err!(NTTError::InvalidMint);
130+
}
131+
}
132+
116133
let wrap_amount = ctx
117134
.accounts
118135
.common

0 commit comments

Comments
 (0)