Skip to main content

ERC20

An ERC20 token contract keeps track of fungible tokens.

Name Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var name = await erc20.Name();

Symbol Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var symbol = await erc20.Symbol();

Decimals Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var decimals = await erc20.Decimals();

TotalSupply Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var totalSupply = await erc20.TotalSupply();

BalanceOf Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var balanceOf = await erc20.BalanceOf(accountAddress);

Transfer Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var receipt = await erc20.Transfer(senderAddress, recipientAddress, amount);

Allowance Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var allowance = await erc20.Allowance(ownerAddress, spenderAddress);

Approve Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var receipt = await erc20.Approve(spenderAddress, amount);

TransferFrom Method:

ERC20 erc20 = new ERC20(web3, contractAddress);
var receipt = await erc20.TransferFrom(senderAddress, recipientAddress, amount);