Skip to main content
Version: 1.15.0

Type Alias: ApproveTokenParams

ApproveTokenParams = { amount: bigint; sender?: string; spender: string; tokenAddress: string; }

Defined in: cct/evm/token/operations/approve-token.ts:25

Parameters for ApproveToken.

Properties​

amount​

amount: bigint

Defined in: cct/evm/token/operations/approve-token.ts:42

Allowance in the token's smallest unit. Replaces the current allowance rather than adding to it, and 0n is allowed and revokes it.

Remarks​

An allowance is consumed as it is spent, so a deposit of exactly amount leaves nothing for the next one. Approving the amount you intend to deposit each time is the tighter choice; approving 2n ** 256n - 1n once is the convenient one.


sender?​

optional sender?: string

Defined in: cct/evm/token/operations/approve-token.ts:48

The account whose tokens are being approved. Sets tx.from for offline / multisig signing. Optional for ApproveToken.generate; ApproveToken.execute defaults it to the signing wallet, since that is the account the allowance actually comes from.


spender​

spender: string

Defined in: cct/evm/token/operations/approve-token.ts:34

Address allowed to spend. For a liquidity deposit this is the token pool.

Remarks​

Must be non-zero — OpenZeppelin's ERC-20 reverts ERC20InvalidSpender on a zero spender, so unlike a role-clearing address this one can never be meaningful.


tokenAddress​

tokenAddress: string

Defined in: cct/evm/token/operations/approve-token.ts:28

ERC-20 token to approve on — any ERC-20, not only a CCT-deployed one. Must be non-zero: it is the tx to, and a call to 0x0 hits no code, so it would mine as a successful no-op.