Skip to main content

IERC20Partial

Git Source

Author: Axicon Labs Limited

Does not include return values as certain tokens such as USDT fail to implement them.

Since the return value is not expected, this interface works with both compliant and non-compliant tokens.

Clients are recommended to consume and handle the return of negative success values.

However, we cannot productively handle a failed approval and such a situation would surely cause a revert later in execution.

In addition, no notable instances exist of tokens that both i) contain a failure case for approve and ii) return false instead of reverting.

Functions

balanceOf

Returns the amount of tokens owned by account.

This function is unchanged from the EIP.

function balanceOf(address account) external view returns (uint256);

Parameters

NameTypeDescription
accountaddressThe address to query the balance of

Returns

NameTypeDescription
<none>uint256The amount of tokens owned by account

approve

Sets amount as the allowance of spender over the caller's tokens.

While this function is specified to return a boolean value in the EIP, this interface does not expect one.

function approve(address spender, uint256 amount) external;

Parameters

NameTypeDescription
spenderaddressThe address which will spend the funds
amountuint256The amount of tokens allowed to be spent

transfer

Transfers tokens from the caller to another user.

function transfer(address to, uint256 amount) external;

Parameters

NameTypeDescription
toaddressThe user to transfer tokens to
amountuint256The amount of tokens to transfer

totalSupply

Returns the amount of tokens in existence.

function totalSupply() external view returns (uint256);