Skip to main content
Version: 1.15.0

Function: assertLiquidityFunding()

assertLiquidityFunding(operation: string, chain: EVMChain, poolAddress: string, account: string, amount: bigint): Promise<void>

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

Pre-flights a provideLiquidity deposit against the rebalancer's ERC-20 position: it must hold amount of the pool's token and have approved the pool to pull it, since the pool deposits with safeTransferFrom.

Parameters​

ParameterTypeDescription
operationstringOperation name, for the error's operation field.
chainEVMChainChain to read from.
poolAddressstringLockRelease pool being deposited into.
accountstringThe depositing rebalancer.
amountbigintDeposit amount, in the token's smallest unit.

Returns​

Promise<void>

Remarks​

Cross-family parity with Solana, whose provideLiquidity likewise refuses to build without the SPL delegation (validateDelegation) and the balance behind it. Without this the only signal is an ERC20InsufficientAllowance revert at wallet-confirmation time, naming neither the token to approve nor the pool to approve it to. The error names approveToken, which grants exactly this allowance.

Throws​

CCTTxFailedError if account holds less than amount, or has approved the pool for less than amount