Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NEP-141 implementation

While trying to implement NEP-141 fungible token, I am using trait

impl FungibleTokenCore for FungibleToken {

fn ft_transfer(&mut self, receiver_id: ValidAccountId, amount: U128, memo: Option<String>) {
        assert_one_yocto();
        let sender_id = env::predecessor_account_id();
        let amount: Balance = amount.into();
        self.internal_transfer(&sender_id, receiver_id.as_ref(), amount, memo);
    }

}

But the problem is the function ft_transfer is inaccessible from the contract. It gives error: "Contract method is not found".

export TOKEN=dev-1618119753426-1904392
near call $TOKEN ft_transfer '{"receiver_id":"avrit.testnet", "amount": 10, "memo":""}' --accountId=amiyatulu.testnet
like image 952
Amiya Behera Avatar asked Oct 31 '25 05:10

Amiya Behera


2 Answers

Your method must be public. See the near-sdk-rs docs README for a few examples.

https://github.com/near/near-sdk-rs

like image 183
amgando Avatar answered Nov 02 '25 04:11

amgando


You probably need a pub before that fn. See Best Practices.

Also see FT example. You can use the near-contract-standards library to simplify your efforts.

like image 43
chadoh Avatar answered Nov 02 '25 05:11

chadoh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!