API Version: v1.6.1

CCIP v1.6.1 LockReleaseTokenPool Contract API Reference

LockReleaseTokenPool

A specialized token pool for managing native tokens through a lock and release mechanism, with support for liquidity management.

Git Source

Inherits:

Events

LiquidityTransferred

event LiquidityTransferred(address indexed from, uint256 amount);

Parameters

NameTypeIndexedDescription
fromaddressYesThe source pool address
amountuint256NoThe amount of liquidity transferred

LiquidityAdded

event LiquidityAdded(address indexed provider, uint256 indexed amount);

Parameters

NameTypeIndexedDescription
provideraddressYesThe address providing the liquidity
amountuint256YesThe amount of liquidity added to pool

LiquidityRemoved

event LiquidityRemoved(address indexed provider, uint256 indexed amount);

Parameters

NameTypeIndexedDescription
provideraddressYesThe address withdrawing the liquidity
amountuint256YesThe amount of liquidity removed from pool

RebalancerSet

event RebalancerSet(address oldRebalancer, address newRebalancer);

Parameters

NameTypeIndexedDescription
oldRebalanceraddressNoThe address of the previous rebalancer
newRebalanceraddressNoThe address of the new rebalancer

Errors

InsufficientLiquidity

error InsufficientLiquidity();

State Variables

s_rebalancer

address internal s_rebalancer;

typeAndVersion

string public constant override typeAndVersion = "LockReleaseTokenPool 1.6.1";

Functions

constructor

constructor(
  IERC20 token,
  uint8 localTokenDecimals,
  address[] memory allowlist,
  address rmnProxy,
  address router
) TokenPool(token, localTokenDecimals, allowlist, rmnProxy, router);

Parameters

NameTypeDescription
tokenIERC20The token contract to manage
localTokenDecimalsuint8The decimal precision for the local token
allowlistaddress[]Initial list of authorized addresses
rmnProxyaddressAddress of the RMN proxy contract
routeraddressAddress of the router contract

getRebalancer

Returns the current rebalancer address.

function getRebalancer() external view returns (address);

Returns

TypeDescription
addressThe current liquidity manager address

provideLiquidity

Adds external liquidity to the pool.

function provideLiquidity(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256The 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

NameTypeDescription
receiveraddressThe address to receive the tokens
amountuint256The number of tokens to release

setRebalancer

Updates the rebalancer address.

function setRebalancer(address rebalancer) external onlyOwner;

Parameters

NameTypeDescription
rebalanceraddressThe new rebalancer address to set

transferLiquidity

Transfers liquidity from an older pool version.

function transferLiquidity(address from, uint256 amount) external onlyOwner;

Parameters

NameTypeDescription
fromaddressThe address of the source pool
amountuint256The amount of liquidity to transfer

withdrawLiquidity

Removes liquidity from the pool.

function withdrawLiquidity(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256The amount of liquidity to withdraw

Get the latest Chainlink content straight to your inbox.