Type Alias: RateLimitConfig
RateLimitConfig = {
capacity:bigint;enabled:true;rate:bigint; } | {capacity?:bigint;enabled:false;rate?:bigint; }
Defined in: cct/evm/token-pool/rate-limit.ts:34
Configuration for one direction of a token pool rate limiter, as CCT callers write it.
Union Members
Type Literal
{ capacity: bigint; enabled: true; rate: bigint; }
capacity
capacity:
bigint
Maximum token amount in the bucket (uint128). Must be at least rate on v1.6.1/v2.0.0
pools, and strictly greater than rate on v1.5.0/v1.5.1/v1.6.0 — see
RateLimitConfig.rate.
enabled
enabled:
true
Whether this directional rate limit is enforced.
rate
rate:
bigint
Token amount restored to the bucket per second (uint128).
The bound the contracts enforce is version-dependent, so this is checked against the resolved pool version rather than one global rule:
- v1.6.1 / v2.0.0 —
rate <= capacity.rate === capacityandrate === 0nare both legal (RateLimiter._validateTokenBucketConfigonly revertsInvalidRateLimitRatewhenrate > capacity). - v1.5.0 / v1.5.1 / v1.6.0 — stricter:
0n < rate < capacity. Those versions revert whenrate >= capacity || rate == 0, so a config that is fine on a newer pool is rejected here.
Type Literal
{ capacity?: bigint; enabled: false; rate?: bigint; }
capacity?
optionalcapacity?:bigint
Must be zero when provided; defaults to zero.
enabled
enabled:
false
Whether this directional rate limit is enforced.
rate?
optionalrate?:bigint
Must be zero when provided; defaults to zero.
Remarks
Field-for-field identical to the Solana RateLimitConfig in
cct/solana/token-pool/operations/set-chain-rate-limit.ts, so cross-family callers write one
shape; only the bound differs (EVM uint128 here, Solana u64 there).
The discriminant is spelled enabled, not the ABI's isEnabled: matching the Solana op's
public field name matters more than matching the ABI, because callers write cross-family code
against the SDK. Ops map enabled → isEnabled when building the on-chain
RateLimiter.Config tuple.
Distinct from the read-side RateLimiterState in chain.ts, which additionally carries
the live tokens bucket balance — that is what a pool reports, this is what a caller sets.
For a token with 6 decimals, pass 1_000_000n to represent one token.