Skip to main content
Version: 1.16.1

Type Alias: TokenBucket

TokenBucket = { capacity: bigint; isEnabled: boolean; lastUpdated: number; rate: bigint; tokens: bigint; }

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

One direction of a lane's RateLimiter.TokenBucket, raw, as the pool's current-state getters return it: a disabled limiter keeps its fields rather than collapsing to null.

Remarks​

The getters return _currentTokenBucketState(bucket), a view that refills the stored bucket to the block read before returning it, so tokens and lastUpdated describe that block, not what is in storage.

Properties​

capacity​

capacity: bigint

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

Maximum tokens the bucket holds (uint128).


isEnabled​

isEnabled: boolean

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

Whether the limiter is enforced on this direction.


lastUpdated​

lastUpdated: number

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

Unix timestamp in seconds (uint32). The getter stamps it with the read block's block.timestamp, so it is not when the bucket was last consumed or configured.


rate​

rate: bigint

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

Tokens restored to the bucket per second (uint128).


tokens​

tokens: bigint

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

Tokens available at the block read (uint128): the value the contract returns, already refilled on-chain at rate up to capacity, not a stored balance.