LockReleaseTokenPool API Reference

LockReleaseTokenPool

The LockReleaseTokenPool contract is used for handling tokens on their native chain using a lock and release mechanism. It allows tokens to be locked in the pool, facilitating their transfer across blockchains, and then released to the recipient on the destination chain. This pool contract also manages liquidity, enabling users and liquidity providers to add and remove liquidity from the pool.

This contract inherits from the TokenPool contract and implements additional functions for liquidity management.

typeAndVersion

string typeAndVersion

constructor

constructor(IERC20 token, address[] allowlist, address rmnProxy, bool acceptLiquidity, address router)

Initializes the pool with a token, allowlist, RMN proxy, and router. The constructor also determines whether the pool can accept liquidity.

Parameters

NameTypeDescription
tokenIERC20The token managed by the pool.
allowlistaddress[]Addresses allowed to interact with the pool.
rmnProxyaddressThe RMN proxy address.
acceptLiquidityboolWhether the pool accepts liquidity.
routeraddressThe router address for cross-chain communication.

lockOrBurn

function lockOrBurn(Pool.LockOrBurnInV1 calldata lockOrBurnIn) external virtual returns (Pool.LockOrBurnOutV1 memory)

Locks the token in the pool for transfer across chains.

Parameters

NameTypeDescription
lockOrBurnInPool.LockOrBurnInV1 calldataEncoded data fields for token transfer.

Return Values

NameTypeDescription
destTokenAddressbytesThe destination token address on the remote chain.
destPoolDatabytesOptional data to be passed to the destination pool.

releaseOrMint

function releaseOrMint(Pool.ReleaseOrMintInV1 calldata releaseOrMintIn) external virtual returns (Pool.ReleaseOrMintOutV1 memory)

Releases tokens from the pool to the recipient.

Parameters

NameTypeDescription
releaseOrMintInPool.ReleaseOrMintInV1 calldataEncoded data fields for releasing tokens to the recipient.

Return Values

NameTypeDescription
destinationAmountuint256The amount of tokens released or minted on the destination chain.

getRebalancer

function getRebalancer() external view returns (address)

Gets the address of the rebalancer.

Return Values

NameTypeDescription
rebalanceraddressThe current rebalancer.

setRebalancer

function setRebalancer(address rebalancer) external

Sets the LiquidityManager address. Only callable by the contract owner.

Parameters

NameTypeDescription
rebalanceraddressThe new LiquidityManager address.

canAcceptLiquidity

function canAcceptLiquidity() external view returns (bool)

Checks if the pool can accept liquidity.

Return Values

NameTypeDescription
[0]booltrue if the pool accepts liquidity, false otherwise.

provideLiquidity

function provideLiquidity(uint256 amount) external

Adds liquidity to the pool.

Parameters

NameTypeDescription
amountuint256Amount of liquidity to be provided.

withdrawLiquidity

function withdrawLiquidity(uint256 amount) external

Removes liquidity from the pool and sends the tokens to the sender.

Parameters

NameTypeDescription
amountuint256Amount of liquidity to be withdrawn.

transferLiquidity

function transferLiquidity(address from, uint256 amount) external

Transfers liquidity from an older version of the pool to this pool.

Parameters

NameTypeDescription
fromaddressThe address of the older pool to transfer liquidity from.
amountuint256The amount of liquidity to transfer.

supportsInterface

function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool)

Checks which interface the contract supports.

Parameters

NameTypeDescription
interfaceIdbytes4The interface identifier.

Return Values

NameTypeDescription
[0]booltrue if the interface is supported.

Get the latest Chainlink content straight to your inbox.