Skip to main content
Version: 1.15.0

Function: assertLockboxLiquidity()

assertLockboxLiquidity(operation: string, erc20: TypedContract<readonly [{ inputs: readonly [{ internalType: "string"; name: "name"; type: "string"; }, { internalType: "string"; name: "symbol"; type: "string"; }, { internalType: "uint8"; name: "decimals_"; type: "uint8"; }, { internalType: "uint256"; name: "maxSupply_"; type: "uint256"; }, { internalType: "uint256"; name: "preMint"; type: "uint256"; }, { internalType: "address"; name: "newOwner"; type: "address"; }]; stateMutability: "nonpayable"; type: "constructor"; }, { inputs: readonly []; name: "acceptOwnership"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "owner"; type: "address"; }, { internalType: "address"; name: "spender"; type: "address"; }]; name: "allowance"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "approve"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }]; name: "balanceOf"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "burn"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "burn"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "burnFrom"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly []; name: "decimals"; outputs: readonly [{ internalType: "uint8"; name: ""; type: "uint8"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "subtractedValue"; type: "uint256"; }]; name: "decreaseAllowance"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "subtractedValue"; type: "uint256"; }]; name: "decreaseApproval"; outputs: readonly [{ internalType: "bool"; name: "success"; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly []; name: "getBurners"; outputs: readonly [{ internalType: "address[]"; name: ""; type: "address[]"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "getCCIPAdmin"; outputs: readonly [{ internalType: "address"; name: ""; type: "address"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "getMinters"; outputs: readonly [{ internalType: "address[]"; name: ""; type: "address[]"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burner"; type: "address"; }]; name: "grantBurnRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burnAndMinter"; type: "address"; }]; name: "grantMintAndBurnRoles"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "minter"; type: "address"; }]; name: "grantMintRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "addedValue"; type: "uint256"; }]; name: "increaseAllowance"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "addedValue"; type: "uint256"; }]; name: "increaseApproval"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burner"; type: "address"; }]; name: "isBurner"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "minter"; type: "address"; }]; name: "isMinter"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "maxSupply"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "mint"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly []; name: "name"; outputs: readonly [{ internalType: "string"; name: ""; type: "string"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "owner"; outputs: readonly [{ internalType: "address"; name: ""; type: "address"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burner"; type: "address"; }]; name: "revokeBurnRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "minter"; type: "address"; }]; name: "revokeMintRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "newAdmin"; type: "address"; }]; name: "setCCIPAdmin"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "bytes4"; name: "interfaceId"; type: "bytes4"; }]; name: "supportsInterface"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "pure"; type: "function"; }, { inputs: readonly []; name: "symbol"; outputs: readonly [{ internalType: "string"; name: ""; type: "string"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "totalSupply"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "to"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "transfer"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "from"; type: "address"; }, { internalType: "address"; name: "to"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "transferFrom"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "to"; type: "address"; }]; name: "transferOwnership"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "owner"; type: "address"; }, { indexed: true; internalType: "address"; name: "spender"; type: "address"; }, { indexed: false; internalType: "uint256"; name: "value"; type: "uint256"; }]; name: "Approval"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "burner"; type: "address"; }]; name: "BurnAccessGranted"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "burner"; type: "address"; }]; name: "BurnAccessRevoked"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "previousAdmin"; type: "address"; }, { indexed: true; internalType: "address"; name: "newAdmin"; type: "address"; }]; name: "CCIPAdminTransferred"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "minter"; type: "address"; }]; name: "MintAccessGranted"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "minter"; type: "address"; }]; name: "MintAccessRevoked"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "from"; type: "address"; }, { indexed: true; internalType: "address"; name: "to"; type: "address"; }]; name: "OwnershipTransferRequested"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "from"; type: "address"; }, { indexed: true; internalType: "address"; name: "to"; type: "address"; }]; name: "OwnershipTransferred"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "from"; type: "address"; }, { indexed: true; internalType: "address"; name: "to"; type: "address"; }, { indexed: false; internalType: "uint256"; name: "value"; type: "uint256"; }]; name: "Transfer"; type: "event"; }, { inputs: readonly []; name: "CannotTransferToSelf"; type: "error"; }, { inputs: readonly [{ internalType: "uint256"; name: "supplyAfterMint"; type: "uint256"; }]; name: "MaxSupplyExceeded"; type: "error"; }, { inputs: readonly []; name: "MustBeProposedOwner"; type: "error"; }, { inputs: readonly []; name: "OnlyCallableByOwner"; type: "error"; }, { inputs: readonly []; name: "OwnerCannotBeZero"; type: "error"; }, { inputs: readonly [{ internalType: "address"; name: "sender"; type: "address"; }]; name: "SenderNotBurner"; type: "error"; }, { inputs: readonly [{ internalType: "address"; name: "sender"; type: "address"; }]; name: "SenderNotMinter"; type: "error"; }]>, lockbox: string, token: string, amount: bigint): Promise<void>

Defined in: cct/evm/lockbox/contracts.ts:271

Pre-flights a withdrawal against the lockbox's own balance of the escrowed token, which is what it pays out of.

Parameters​

ParameterTypeDescription
operationstringOperation name, for the error's operation field.
erc20TypedContract<readonly [{ inputs: readonly [{ internalType: "string"; name: "name"; type: "string"; }, { internalType: "string"; name: "symbol"; type: "string"; }, { internalType: "uint8"; name: "decimals_"; type: "uint8"; }, { internalType: "uint256"; name: "maxSupply_"; type: "uint256"; }, { internalType: "uint256"; name: "preMint"; type: "uint256"; }, { internalType: "address"; name: "newOwner"; type: "address"; }]; stateMutability: "nonpayable"; type: "constructor"; }, { inputs: readonly []; name: "acceptOwnership"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "owner"; type: "address"; }, { internalType: "address"; name: "spender"; type: "address"; }]; name: "allowance"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "approve"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }]; name: "balanceOf"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "burn"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "burn"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "burnFrom"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly []; name: "decimals"; outputs: readonly [{ internalType: "uint8"; name: ""; type: "uint8"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "subtractedValue"; type: "uint256"; }]; name: "decreaseAllowance"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "subtractedValue"; type: "uint256"; }]; name: "decreaseApproval"; outputs: readonly [{ internalType: "bool"; name: "success"; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly []; name: "getBurners"; outputs: readonly [{ internalType: "address[]"; name: ""; type: "address[]"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "getCCIPAdmin"; outputs: readonly [{ internalType: "address"; name: ""; type: "address"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "getMinters"; outputs: readonly [{ internalType: "address[]"; name: ""; type: "address[]"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burner"; type: "address"; }]; name: "grantBurnRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burnAndMinter"; type: "address"; }]; name: "grantMintAndBurnRoles"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "minter"; type: "address"; }]; name: "grantMintRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "addedValue"; type: "uint256"; }]; name: "increaseAllowance"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "spender"; type: "address"; }, { internalType: "uint256"; name: "addedValue"; type: "uint256"; }]; name: "increaseApproval"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burner"; type: "address"; }]; name: "isBurner"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "minter"; type: "address"; }]; name: "isMinter"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "maxSupply"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "account"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "mint"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly []; name: "name"; outputs: readonly [{ internalType: "string"; name: ""; type: "string"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "owner"; outputs: readonly [{ internalType: "address"; name: ""; type: "address"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "burner"; type: "address"; }]; name: "revokeBurnRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "minter"; type: "address"; }]; name: "revokeMintRole"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "newAdmin"; type: "address"; }]; name: "setCCIPAdmin"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "bytes4"; name: "interfaceId"; type: "bytes4"; }]; name: "supportsInterface"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "pure"; type: "function"; }, { inputs: readonly []; name: "symbol"; outputs: readonly [{ internalType: "string"; name: ""; type: "string"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly []; name: "totalSupply"; outputs: readonly [{ internalType: "uint256"; name: ""; type: "uint256"; }]; stateMutability: "view"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "to"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "transfer"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "from"; type: "address"; }, { internalType: "address"; name: "to"; type: "address"; }, { internalType: "uint256"; name: "amount"; type: "uint256"; }]; name: "transferFrom"; outputs: readonly [{ internalType: "bool"; name: ""; type: "bool"; }]; stateMutability: "nonpayable"; type: "function"; }, { inputs: readonly [{ internalType: "address"; name: "to"; type: "address"; }]; name: "transferOwnership"; outputs: readonly []; stateMutability: "nonpayable"; type: "function"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "owner"; type: "address"; }, { indexed: true; internalType: "address"; name: "spender"; type: "address"; }, { indexed: false; internalType: "uint256"; name: "value"; type: "uint256"; }]; name: "Approval"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "burner"; type: "address"; }]; name: "BurnAccessGranted"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "burner"; type: "address"; }]; name: "BurnAccessRevoked"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "previousAdmin"; type: "address"; }, { indexed: true; internalType: "address"; name: "newAdmin"; type: "address"; }]; name: "CCIPAdminTransferred"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "minter"; type: "address"; }]; name: "MintAccessGranted"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: false; internalType: "address"; name: "minter"; type: "address"; }]; name: "MintAccessRevoked"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "from"; type: "address"; }, { indexed: true; internalType: "address"; name: "to"; type: "address"; }]; name: "OwnershipTransferRequested"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "from"; type: "address"; }, { indexed: true; internalType: "address"; name: "to"; type: "address"; }]; name: "OwnershipTransferred"; type: "event"; }, { anonymous: false; inputs: readonly [{ indexed: true; internalType: "address"; name: "from"; type: "address"; }, { indexed: true; internalType: "address"; name: "to"; type: "address"; }, { indexed: false; internalType: "uint256"; name: "value"; type: "uint256"; }]; name: "Transfer"; type: "event"; }, { inputs: readonly []; name: "CannotTransferToSelf"; type: "error"; }, { inputs: readonly [{ internalType: "uint256"; name: "supplyAfterMint"; type: "uint256"; }]; name: "MaxSupplyExceeded"; type: "error"; }, { inputs: readonly []; name: "MustBeProposedOwner"; type: "error"; }, { inputs: readonly []; name: "OnlyCallableByOwner"; type: "error"; }, { inputs: readonly []; name: "OwnerCannotBeZero"; type: "error"; }, { inputs: readonly [{ internalType: "address"; name: "sender"; type: "address"; }]; name: "SenderNotBurner"; type: "error"; }, { inputs: readonly [{ internalType: "address"; name: "sender"; type: "address"; }]; name: "SenderNotMinter"; type: "error"; }]>Handle to the escrowed token, from assertLockboxToken.
lockboxstringLockbox being withdrawn from.
tokenstringThe escrowed token, for the error message.
amountbigintWithdrawal amount, in the token's smallest unit.

Returns​

Promise<void>

Remarks​

Weaker than assertLockboxFunding, exactly as assertPoolLiquidity is: the balance moves with every CCIP transfer through the pool, so this catches "withdraw more than was ever deposited" rather than proving the amount will still fit when the tx mines.

Throws​

CCTTxFailedError if the lockbox holds less than amount