Search code examples
nearprotocol

Smart contract panicked: Sender and receiver should be different


I'm having a stake_token function and it transfer token from signer address to current contract address using ft_transfer_call Here is the code and the error

In cmd, I have a script call stake_token function. The signer is tungleanh.testnet and receiver is current account id which is the 77037 account. Why does it return Sender and receiver should be different error?


Solution

  • On line 92, the contract attempts to transfer FT tokens to env::current_account_id(). This evaluates to the contract name, so that dev account ending in 77037. You are calling that account function that thus attempts to send funds to itself.