Pool Library API Reference
The Pool library provides various token pool functions to construct return data for cross-chain operations in Chainlink's CCIP.
import { Pool } from "@chainlink/contracts-ccip/src/v0.8/ccip/libraries/Pool.sol";
Types and Constants
CCIP_POOL_V1
The tag used to signal support for the Pool v1 standard.
bytes4 CCIP_POOL_V1
CCIP_POOL_V1_RET_BYTES
The number of bytes in the return data for a pool v1 releaseOrMint call.
uint16 CCIP_POOL_V1_RET_BYTES
CCIP_LOCK_OR_BURN_V1_RET_BYTES
The default maximum number of bytes in the return data for a pool v1 lockOrBurn call.
uint32 CCIP_LOCK_OR_BURN_V1_RET_BYTES
Structs
LockOrBurnInV1
This struct is used when locking or burning tokens for cross-chain operations.
struct LockOrBurnInV1 {
bytes receiver;
uint64 remoteChainSelector;
address originalSender;
uint256 amount;
address localToken;
}
| Name | Type | Description |
|---|---|---|
| receiver | bytes | The recipient of the tokens on the destination chain, ABI encoded. |
| remoteChainSelector | uint64 | The chain ID of the destination chain. |
| originalSender | address | The original sender of the transaction on the source chain. |
| amount | uint256 | The amount of tokens to lock or burn, denominated in the source token's decimals. |
| localToken | address | The address of the token on this chain to lock or burn. |
LockOrBurnOutV1
This struct represents the output data from a lockOrBurn call.
struct LockOrBurnOutV1 {
bytes destTokenAddress;
bytes destPoolData;
}
| Name | Type | Description |
|---|---|---|
| destTokenAddress | bytes | The address of the destination token, ABI encoded. This value is untrusted as any pool owner can modify it. |
| destPoolData | bytes | Optional pool data to be transferred to the destination chain, capped by default at CCIP_LOCK_OR_BURN_V1_RET_BYTES. |
ReleaseOrMintInV1
This struct is used to release or mint tokens on the destination chain.
struct ReleaseOrMintInV1 {
bytes originalSender;
uint64 remoteChainSelector;
address receiver;
uint256 amount;
address localToken;
bytes sourcePoolAddress;
bytes sourcePoolData;
bytes offchainTokenData;
}
| Name | Type | Description |
|---|---|---|
| originalSender | bytes | The original sender of the transaction on the source chain. |
| remoteChainSelector | uint64 | The chain ID of the source chain. |
| receiver | address | The recipient of the tokens on the destination chain. |
| amount | uint256 | The amount of tokens to release or mint, denominated in the source token's decimals. |
| localToken | address | The address of the token on this chain to release or mint. |
| sourcePoolAddress | bytes | The address of the source pool, ABI encoded. This value must be verified before processing funds. |
| sourcePoolData | bytes | Data received from the source pool to process the release or mint. |
| offchainTokenData | bytes | Untrusted offchain data to process the release or mint. |
ReleaseOrMintOutV1
This struct represents the output data from a releaseOrMint call.
struct ReleaseOrMintOutV1 {
uint256 destinationAmount;
}
| Name | Type | Description |
|---|---|---|
| destinationAmount | uint256 | The number of tokens released or minted on the destination chain, denominated in the local token's decimals. Expected to match the input amount. |