Skip to main content

burn

The burn method is used by token holders to destroy or "burn" a specified amount of their tokens, effectively removing them from circulation. Burning tokens can serve various purposes, including reducing the overall supply or fulfilling specific protocol requirements. The method typically belongs to objects or contracts that incorporate a burning functionality, as seen in ERC20 or ERC721 token standards.

Method Signature

async burn(amount: BigNumberish, signer: WalletSigner): Promise<string>

Parameters

ParameterTypeDescription
amountBigNumberishThe number of tokens the caller wishes to burn. This value is specified in the smallest unit of the token (e.g., Wei for Ether). It can be provided as a number, string, or BigNumber.
signerWalletSignerThe wallet signer instance responsible for signing the burn transaction. Typically generated using methods such as createWalletSigner.

Returns

  • A Promise that resolves to a string, usually the transaction hash, signifying the burn transaction's status on the blockchain.

Usage Example

Assuming you have a token or contract instance that supports a burn method:

const burnAmount = "1000000000000000000"; // This represents 1 token, assuming 18 decimals
const signer = someMethodToCreateSigner("your private key"); // Replace with the appropriate method for signer creation

const transactionHash = await tokenInstance.burn(burnAmount, signer);
console.log(`Burn Transaction Hash: ${transactionHash}`);

Notes

  • The burn method permanently removes tokens from circulation. Ensure you intend to destroy the tokens before invoking this method, as the action is irreversible.

  • The amount designated for burning is provided in the smallest divisible unit of the token. Always ensure the conversions are accurate before initiating a burn.

  • Due to security concerns, always manage your private keys and the signer instance with caution. Refrain from exposing them in client-side or insecure environments.