CCIP v1.6.2 LockReleaseTokenPool Contract API Reference
LockReleaseTokenPool
A specialized token pool for managing native tokens through a lock and release mechanism, with support for liquidity management.
Inherits:
Events
LiquidityTransferred
event LiquidityTransferred(address indexed from, uint256 amount);
Parameters
| Name | Type | Indexed | Description | 
|---|---|---|---|
| from | address | Yes | The source pool address | 
| amount | uint256 | No | The amount of liquidity transferred | 
RebalancerSet
event RebalancerSet(address oldRebalancer, address newRebalancer);
Parameters
| Name | Type | Indexed | Description | 
|---|---|---|---|
| oldRebalancer | address | No | The address of the previous rebalancer | 
| newRebalancer | address | No | The address of the new rebalancer | 
Errors
InsufficientLiquidity
error InsufficientLiquidity();
LiquidityNotAccepted
error LiquidityNotAccepted();
State Variables
i_acceptLiquidity
bool internal immutable i_acceptLiquidity;
s_rebalancer
address internal s_rebalancer;
typeAndVersion
string public constant override typeAndVersion = "LockReleaseTokenPool 1.6.1";
Functions
canAcceptLiquidity
Determines whether the pool can accept external liquidity.
function canAcceptLiquidity() external view returns (bool);
Returns
| Type | Description | 
|---|---|
| bool | True if the pool accepts external liquidity | 
constructor
constructor(
  IERC20 token,
  uint8 localTokenDecimals,
  address[] memory allowlist,
  address rmnProxy,
  bool acceptLiquidity,
  address router
) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router);
Parameters
| Name | Type | Description | 
|---|---|---|
| token | IERC20 | The token contract to manage | 
| localTokenDecimals | uint8 | The decimal precision for the local token | 
| allowlist | address[] | Initial list of authorized addresses | 
| rmnProxy | address | Address of the RMN proxy contract | 
| acceptLiquidity | bool | Whether the pool accepts external liquidity | 
| router | address | Address of the router contract | 
getRebalancer
Returns the current rebalancer address.
function getRebalancer() external view returns (address);
Returns
| Type | Description | 
|---|---|
| address | The current liquidity manager address | 
provideLiquidity
Adds external liquidity to the pool.
function provideLiquidity(uint256 amount) external;
Parameters
| Name | Type | Description | 
|---|---|---|
| amount | uint256 | The amount of liquidity to provide | 
_releaseOrMint
Internal function that implements the token release logic for a LockReleaseTokenPool.
function _releaseOrMint(address receiver, uint256 amount) internal virtual override;
Parameters
| Name | Type | Description | 
|---|---|---|
| receiver | address | The address to receive the tokens | 
| amount | uint256 | The number of tokens to release | 
setRebalancer
Updates the rebalancer address.
function setRebalancer(address rebalancer) external onlyOwner;
Parameters
| Name | Type | Description | 
|---|---|---|
| rebalancer | address | The new rebalancer address to set | 
transferLiquidity
Transfers liquidity from an older pool version.
function transferLiquidity(address from, uint256 amount) external onlyOwner;
Parameters
| Name | Type | Description | 
|---|---|---|
| from | address | The address of the source pool | 
| amount | uint256 | The amount of liquidity to transfer | 
withdrawLiquidity
Removes liquidity from the pool.
function withdrawLiquidity(uint256 amount) external;
Parameters
| Name | Type | Description | 
|---|---|---|
| amount | uint256 | The amount of liquidity to withdraw |