β OpenZeppelin ERC20
Intro
A standard interface for tokens.
Abstract
The following standard allows for the implementation of a standard API for tokens within smart contracts. This standard provides basic functionality to transfer tokens, as well as allow tokens to be approved so they can be spent by another on-chain third party.
Motivation
A standard interface allows any tokens on Ethereum to be re-used by other applications: from wallets to decentralized exchanges.
OpenZeppelin Implementation
Important functions:
transfer()approve()transferFrom()
transfer
_beforeTokenTransfer() and _afterTokenTransfer()are called hooks. They are empty functions waiting to be implemented.
This is the basic transfer that transfers token from A to B. Nothing to comment here.
approve
approve() is used before transferFrom() to give allowance to some other account.
transferFrom
type(uint256).max is unlimited allowance. The transfer part is the same with transfer().
Last updated
Was this helpful?

