BEP-20 Compatibility
Last updated
Last updated
The BEP20 specification defines a list of API functions (and relevant events) that each token contract is expected to implement (and emit). The failure to meet these requirements means the token contract cannot be considered to be BEP20-compliant. In this section, we examine the list of API functions defined by the BEP20 specification and validate whether there exists any inconsistency or incompatibility in the implementation of the inherent business logic of the audited contract(s)
Expected Functionality
Description according to the BEP20 Standard
Compatible
name
is declared as a public view function ✓
Returns the name of the token.
✓
symbol
Is declared as a public view function
Returns the symbol of the token.
✓
decimals
declared as a public view function
Returns the number of decimals used to get its user representation
✓
totalSupply
Is declared as a public view function
Returns the number of tokens in existence.
✓
balanceOf
Is declared as a public view function
Returns the number of tokens owned by account
.
✓
allowance
allowance() Is declared as a public view function
Returns the remaining number of tokens that spender
will be allowed to spend on behalf of owner
through transferFrom
.
✓
transfer
transfer() is declared as a public function
Moves amount
tokens from the caller’s account to recipient
.
Returns a boolean value indicating whether the operation succeeded.
Emits a Transfer
event.
✓
transferFrom
Is declared as a public function ✓
Returns a boolean value that accurately reflects the token transfer status ✓
Reverts if the spender does not have enough token allowances to spend ✓
Updates the spender’s token allowances when tokens are transferred successfully ✓
Reverts if the from address does not have enough tokens to spend
Allows zero amount transfers ✓
Emits Transfer() event when tokens are transferred successfully (include 0 amount transfers) ✓
Reverts while transferring from zero address ✓
Reverts while transferring to zero address ✓
Moves amount
tokens from sender
to recipient
using the allowance mechanism. amount
is then deducted from the caller’s allowance.
Returns a boolean value indicating whether the operation succeeded.
Emits a Transfer
event.
✓
approve
Is declared as a public function ✓
Returns a boolean value that accurately reflects the token approval status ✓
Emits Approval() event when tokens are approved successfully ✓
Reverts while approving to zero address ✓
Sets amount
as the allowance of spender
over the caller’s tokens.
Returns a boolean value indicating whether the operation succeeded.
✓
Transfer Event
Is emitted when tokens are transferred, including zero value transfers
Is emitted with the from address set to address(0) when new tokens are generated ✓
Emitted when value
tokens are moved from one account (from
) to another (to
).
Note that value
may be zero
✓
Approval Event
Is emitted on any successful call to approve ✓
Emitted when the allowance of a spender
for an owner
is set by a call to approve
. value
is the new allowance.
✓