Skip to main content
Version: 1.15.0

Function: assertPoolLiquidity()

assertPoolLiquidity(operation: string, chain: EVMChain, poolAddress: string, type: "BurnMintTokenPool" | "BurnFromMintTokenPool" | "BurnWithFromMintTokenPool" | "BurnToAddressTokenPool" | "BurnMintWithLockReleaseFlagTokenPool" | "LockReleaseTokenPool" | "SiloedLockReleaseTokenPool", amount: bigint): Promise<void>

Defined in: cct/evm/token-pool/contracts.ts:792

Pre-flights a withdrawLiquidity against what the pool can pay out of: its own ERC-20 balance, or on a SiloedLockReleaseTokenPool its unsiloed liquidity (readTokenPoolLiquidity).

Parameters​

ParameterTypeDescription
operationstringOperation name, for the error's operation field.
chainEVMChainChain to read from.
poolAddressstringLockRelease pool being withdrawn from.
type"BurnMintTokenPool" | "BurnFromMintTokenPool" | "BurnWithFromMintTokenPool" | "BurnToAddressTokenPool" | "BurnMintWithLockReleaseFlagTokenPool" | "LockReleaseTokenPool" | "SiloedLockReleaseTokenPool"Pool type, as resolved by resolveTokenPool.
amountbigintWithdrawal amount, in the token's smallest unit.

Returns​

Promise<void>

Remarks​

Weaker than assertLiquidityFunding: a pool's balance moves with every CCIP transfer through it, so this catches "withdraw more than was ever provided" rather than proving the amount will still fit when the tx mines.

Throws​

CCTTxFailedError if the pool's withdrawable liquidity is below amount