BurnMintTokenPool API Reference
BurnMintTokenPoolAbstract
BurnMintTokenPoolAbstract
is an abstract contract that extends the TokenPool
contract. It defines the common logic for burning tokens in the pool. This contract contains validation mechanisms and logic for burning tokens in the context of a cross-chain token transfer. The main goal of this abstract contract is to allow different pools to inherit from it and customize the specific burn logic.
BurnMintTokenPool and BurnFromMintTokenPool
The BurnMintTokenPool
and BurnFromMintTokenPool
contracts are concrete implementations that inherit from BurnMintTokenPoolAbstract
. Both are designed to mint and burn a 3rd-party token, but they differ in how the token burning is implemented:
BurnMintTokenPool
uses theburn(amount)
function for burning tokens.BurnFromMintTokenPool
uses theburnFrom(address, amount)
function, where the contract burns tokens from its own balance.
_burn
function _burn(uint256 amount) internal virtual
Contains the specific burn call for a pool.
Overriding this method allows us to create pools with different burn signatures without duplicating the underlying logic.
lockOrBurn
function lockOrBurn(struct Pool.LockOrBurnInV1 lockOrBurnIn) external virtual returns (struct Pool.LockOrBurnOutV1)
Burn the token in the pool.
The _validateLockOrBurn check is an essential security check.
releaseOrMint
function releaseOrMint(struct Pool.ReleaseOrMintInV1 releaseOrMintIn) external virtual returns (struct Pool.ReleaseOrMintOutV1)
Mint tokens from the pool to the recipient.
The _validateReleaseOrMint check is an essential security check.
BurnMintTokenPool
BurnMintTokenPool
is a concrete implementation that inherits from BurnMintTokenPoolAbstract
. It is designed to mint and burn a 3rd-party token, using the burn(amount)
function for burning tokens. Pool whitelisting mode is set during the contract's deployment and cannot be modified later. The pool either accepts any address as the originalSender
or restricts to a whitelisted set of senders.
This contract variant is particularly suited for use cases where the token’s minter and burner roles need to be adjustable.
typeAndVersion
string typeAndVersion
constructor
constructor(contract IBurnMintERC20 token, address[] allowlist, address rmnProxy, address router) public
_burn
function _burn(uint256 amount) internal virtual
Contains the specific burn call for a pool.