From 3bf06d5ca3adcbd49562f4b45a6ac6d8890e5218 Mon Sep 17 00:00:00 2001 From: Olga Kunyavskaya Date: Thu, 26 Dec 2024 16:28:53 +0200 Subject: [PATCH] Fix: don't burn the fee on ft_on_transfer (#168) * burn only transfered amount * mint tokens on cliam fee --- near/omni-bridge/src/lib.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/near/omni-bridge/src/lib.rs b/near/omni-bridge/src/lib.rs index 32db39b3..f2d6ec39 100644 --- a/near/omni-bridge/src/lib.rs +++ b/near/omni-bridge/src/lib.rs @@ -590,12 +590,20 @@ impl Contract { ); if fee > 0 { - PromiseOrValue::Promise( - ext_token::ext(token) - .with_static_gas(FT_TRANSFER_GAS) - .with_attached_deposit(ONE_YOCTO) - .ft_transfer(fin_transfer.fee_recipient, U128(fee), None), - ) + if self.deployed_tokens.contains(&token) { + PromiseOrValue::Promise(ext_token::ext(token).with_static_gas(MINT_TOKEN_GAS).mint( + fin_transfer.fee_recipient, + U128(fee), + None, + )) + } else { + PromiseOrValue::Promise( + ext_token::ext(token) + .with_static_gas(FT_TRANSFER_GAS) + .with_attached_deposit(ONE_YOCTO) + .ft_transfer(fin_transfer.fee_recipient, U128(fee), None), + ) + } } else { PromiseOrValue::Value(()) }