Function: assertLockbox()
assertLockbox(
operation:string,chain:EVMChain,lockbox:string):Promise<void>
Defined in: cct/evm/lockbox/contracts.ts:81
Asserts lockbox is a deployed, supported ERC20LockBox by reading its typeAndVersion.
Parameters
| Parameter | Type | Description |
|---|---|---|
operation | string | Operation name, for the error's operation field. |
chain | EVMChain | Chain to read from. |
lockbox | string | The caller-supplied lockbox address, already validated as non-zero. |
Returns
Promise<void>
Remarks
Every lockbox op is a call to a caller-supplied address, and the EVM answers a call to
an address with no code by succeeding and doing nothing. Without this read a lockbox typo, an
EOA, or a pool address mines as a "successful" authorization, and the SDK hands back a tx hash
for an update that never happened. One eth_call turns all three into a typed error before any
calldata is built, let alone signed.
Throws
CCTParamsInvalidError if the typeAndVersion read fails, i.e. there is no
contract at lockbox, or it does not answer the call
Throws
CCTContractTypeInvalidError if the contract is not an ERC20LockBox
Throws
CCTContractVersionUnsupportedError if it reports an unsupported version
Throws
CCIPTypeVersionInvalidError if the contract answers with a string that is not a
type version pair at all, as chain.typeAndVersion raises it