ContractERC20 class

Dart Class for ERC20 Contract, 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

Constructors

ContractERC20(String address, dynamic providerOrSigner)
Instantiate ERC20 Contract using default abi.

Properties

contract Contract
Ethers Contract object.
getter/setter pair
decimals FutureOr<int>
Returns the number of decimals used to get its user representation.
no setter
hashCode int
The hash code for this object.
no setterinherited
isReadOnly bool
True if Signer is attached to contract.
no setter
name FutureOr<String>
Returns the name of the token. If token doesn't have name, return empty string.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
symbol FutureOr<String>
Returns the symbol of the token, usually a shorter version of the name.
no setter
totalSupply FutureOr<BigInt>
Returns the amount of tokens in existence.
no setter

Methods

allowance(String owner, String spender) Future<BigInt>
Returns the remaining number of tokens that spender will be allowed to spend on behalf of owner through transferFrom.
approvalLogs([List? args, dynamic startBlock, dynamic endBlock]) Future<List<Log>>
Log of Approval events.
approve(String spender, BigInt amount) Future<TransactionResponse>
Sets amount as the allowance of spender over the caller's tokens.
balanceOf(String address) Future<BigInt>
Returns the amount of tokens owned by address
connect(dynamic providerOrSigner) → void
Connect current contract with providerOrSigner
multicallAllowance(List<String> owners, List<String> spenders) Future<List<BigInt>>
Multicall of allowance, may not be in the same block.
multicallBalanceOf(List<String> addresses) Future<List<BigInt>>
Multicall of balanceOf, may not be in the same block.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onApproval(void callback(String owner, String spender, BigInt value, dynamic data)) → void
Emitted when the allowance of a spender for an owner is set by a call to approve.
onTransfer(void callback(String from, String to, BigInt amount, dynamic data)) → void
Emitted when amount tokens are moved from one account (from) to another (to).
toString() String
A string representation of this object.
inherited
transfer(String recipient, BigInt amount) Future<TransactionResponse>
Transfer token from msg.sender to recipient in amount. Emits Transfer events when called.
transferFrom(String sender, String recipient, BigInt amount) Future<TransactionResponse>
Transfer token from sender to recipient in amount. Emits Transfer events when called.
transferLogs([List? args, dynamic startBlock, dynamic endBlock]) Future<List<Log>>
Log of Transfer events.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

abi → const List<String>
Minimal abi interface of ERC20