Skip to content

Commit

Permalink
fix: fix contract ft-receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksuss committed Feb 23, 2024
1 parent 9060d64 commit b41ed09
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions etc/tests/ft-receiver/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
use near_contract_standards::fungible_token::receiver::FungibleTokenReceiver;
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::json_types::{U128, ValidAccountId};
use near_sdk::{near_bindgen, log, PromiseOrValue};
use near_sdk::borsh::{BorshDeserialize, BorshSerialize};
use near_sdk::json_types::U128;
use near_sdk::{log, near_bindgen, AccountId, PromiseOrValue};

/// Will happily take and NEP-141
#[near_bindgen]
#[derive(BorshDeserialize, BorshSerialize, Default)]
#[borsh(crate = "near_sdk::borsh")]
struct DummyFungibleTokenReceiver;

#[near_bindgen]
impl FungibleTokenReceiver for DummyFungibleTokenReceiver {
fn ft_on_transfer(
&mut self,
sender_id: ValidAccountId,
sender_id: AccountId,
amount: U128,
msg: String,
) -> PromiseOrValue<U128> {
log!("in {} tokens from @{} ft_on_transfer, msg = {}", amount.0, sender_id.as_ref(), msg);
log!(
"in {} tokens from @{} ft_on_transfer, msg = {}",
amount.0,
sender_id,
msg
);
PromiseOrValue::Value(U128::from(0))
}
}

0 comments on commit b41ed09

Please sign in to comment.