Skip to main content

ERC20Burnable

Constructor

new ERC20Burnable(config: IContractConfig);
ParamTypeDescription
configIContractConfig


Properties




Properties

address

Returns

Type: Address



Methods

burn(args)

Destroys a value amount of tokens from the caller's balance.

Parameters

NameTypeDescription
argsIERC20BurnableBurnParamsThe parameters to be passed into burn function of the ERC20 contract.

Examples

const balance = await erc20.balanceOf(myAddress); // return 200000n

const tx = await erc20.burn({
// value is in lower units. (see ERC20.decimals)
value: erc20.toLowerUnits(10)
}).execute();

// wait for 3 confirmations
await tx.waitForReceipt(3);

// check balance again
const newBalance = await erc20.balanceOf(myAddress); // return 100000n

Returns a ContractOperation instance.

Type: ContractOperation

burnFrom(args)

Destroys a value amount of tokens from account, deducting from the caller's allowance.

info

The caller must have allowance for accounts's tokens of at least value.

Parameters

NameTypeDescription
argsIERC20BurnableBurnFromParamsThe parameters to be passed into burnFrom function of the ERC20 contract.

Examples

const balance = await erc20.balanceOf(accountAddress); // return 200000n

// value is in lower units. (see ERC20.decimals)
const tx = await erc20.burnFrom({
account: accountAddress,
value: erc20.toLowerUnits(10)
}).execute(); // burn 10 tokens

// wait for 3 confirmations
await tx.waitForReceipt(3);

// check balance again
const newBalance = await erc20.balanceOf(accountAddress); // return 100000n

Returns a ContractOperation instance.

Type: ContractOperation