LockReleaseTokenPool API Reference
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.
string typeAndVersion
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.
Name | Type | Description |
---|
token | IERC20 | The token managed by the pool. |
allowlist | address[] | Addresses allowed to interact with the pool. |
rmnProxy | address | The RMN proxy address. |
acceptLiquidity | bool | Whether the pool accepts liquidity. |
router | address | The router address for cross-chain communication. |
function lockOrBurn(Pool.LockOrBurnInV1 calldata lockOrBurnIn) external virtual returns (Pool.LockOrBurnOutV1 memory)
Locks the token in the pool for transfer across chains.
Name | Type | Description |
---|
lockOrBurnIn | Pool.LockOrBurnInV1 calldata | Encoded data fields for token transfer. |
Name | Type | Description |
---|
destTokenAddress | bytes | The destination token address on the remote chain. |
destPoolData | bytes | Optional data to be passed to the destination pool. |
function releaseOrMint(Pool.ReleaseOrMintInV1 calldata releaseOrMintIn) external virtual returns (Pool.ReleaseOrMintOutV1 memory)
Releases tokens from the pool to the recipient.
Name | Type | Description |
---|
releaseOrMintIn | Pool.ReleaseOrMintInV1 calldata | Encoded data fields for releasing tokens to the recipient. |
Name | Type | Description |
---|
destinationAmount | uint256 | The amount of tokens released or minted on the destination chain. |
function getRebalancer() external view returns (address)
Gets the address of the rebalancer.
Name | Type | Description |
---|
rebalancer | address | The current rebalancer. |
function setRebalancer(address rebalancer) external
Sets the LiquidityManager address. Only callable by the contract owner.
Name | Type | Description |
---|
rebalancer | address | The new LiquidityManager address. |
function canAcceptLiquidity() external view returns (bool)
Checks if the pool can accept liquidity.
Name | Type | Description |
---|
[0] | bool | true if the pool accepts liquidity, false otherwise. |
function provideLiquidity(uint256 amount) external
Adds liquidity to the pool.
Name | Type | Description |
---|
amount | uint256 | Amount of liquidity to be provided. |
function withdrawLiquidity(uint256 amount) external
Removes liquidity from the pool and sends the tokens to the sender.
Name | Type | Description |
---|
amount | uint256 | Amount of liquidity to be withdrawn. |
function transferLiquidity(address from, uint256 amount) external
Transfers liquidity from an older version of the pool to this pool.
Name | Type | Description |
---|
from | address | The address of the older pool to transfer liquidity from. |
amount | uint256 | The amount of liquidity to transfer. |
function supportsInterface(bytes4 interfaceId) public pure virtual returns (bool)
Checks which interface the contract supports.
Name | Type | Description |
---|
interfaceId | bytes4 | The interface identifier. |
Name | Type | Description |
---|
[0] | bool | true if the interface is supported. |