Skip to content

Commit

Permalink
Fix: don't burn the fee on ft_on_transfer (#168)
Browse files Browse the repository at this point in the history
* burn only transfered amount

* mint tokens on cliam fee
  • Loading branch information
olga24912 authored Dec 26, 2024
1 parent 3d16aed commit 3bf06d5
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions near/omni-bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}
Expand Down

0 comments on commit 3bf06d5

Please sign in to comment.