Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions near/omni-bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ pub enum Role {
MetadataManager,
UnrestrictedRelayer,
TokenControllerUpdater,
NativeFeeRestricted,
}

#[ext_contract(ext_token)]
Expand Down Expand Up @@ -470,6 +471,13 @@ impl Contract {
amount: U128,
init_transfer_msg: InitTransferMsg,
) -> U128 {
// Avoid extra storage read by verifying native fee before checking the role
if init_transfer_msg.native_token_fee.0 > 0
&& self.acl_has_role(Role::NativeFeeRestricted.into(), storage_payer.clone())
{
env::panic_str("ERR_ACCOUNT_RESTRICTED_FROM_USING_NATIVE_FEE");
}

require!(
init_transfer_msg.recipient.get_chain() != ChainKind::Near,
"ERR_INVALID_RECIPIENT_CHAIN"
Expand Down
1 change: 1 addition & 0 deletions near/omni-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ mod fast_transfer;
mod fin_transfer;
mod helpers;
mod init_transfer;
mod native_fee_role;
mod omni_token;
Loading
Loading