6

Does anyone know the difference between safeTransfer and transfer in ERC20?

People said that safeTransfer returns boolean, which is much safer than "transfer"?

I do not understand it well, When you use either the safeTransfer or transfer function to send tokens more than the tokens you have, the both function returns an error.

I feel like they seem same,

Would you please help me?

if possible, please give me a example code?

2 Answers 2

7

From OpenZepplain's forum.

SafeERC20 is not an ERC20 extension that you use to make your token safe (OpenZeppelin’s ERC20 is already safe). It’s a helper to make safe the interaction with someone else’s ERC20 token, in your contracts.

You can read the full post here.

3

There is no safeTransfer in ERC20. If you're talking about ERC721 then safeTransfer calls a function on the receiver that makes sure they're aware of the ERC721 standard and will know what to do with the token while transfer doesnt.

1
  • 1
    Sorry, I did not explain it well, I meant the function safeTransfer in the SafeERC20 Library
    – DHC
    Jan 25, 2022 at 15:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.