Types

Use logical types for EVM values and for the clients, programs, reads, and observations passed between workflow steps.

Type basics

Start with exact values

Cast literals to an EVM type before calculating with them. These casts run locally and do not need an RPC transport.

SELECT
  '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'::ADDRESS AS wallet,
  '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'::BYTES32 AS topic0,
  '1000000000000000000'::UINT256 AS one_token_raw;

Browse by type family

Type family

EVM bytes and addresses

5

Fixed-width and variable-length byte types for addresses, calldata, selectors, hashes, topics, and EVM words.

Type family

Unsigned EVM integers

28

Unsigned integers for balances, token amounts, gas, and ABI values.

Type family

Signed EVM integers

28

Signed integers for deltas, oracle answers, and ABI values that may be negative.

Type family

Chain metadata

6

Types for block numbers, transaction and log indexes, gas, wei, and EVM versions.

Type family

Workflow values

9

Types passed between workflow steps, including transports, clients, programs, assumptions, reads, and observations.

Type family

Other logical types

1

Public logical types outside the families above.

Rules for exact values

Preserve exact EVM values

Pass exact amounts as strings

Pass decimal strings to parsers and casts when an amount must remain exact to the wei.

Keep raw integers until display

Compare, aggregate, and score raw integer values. Format them only for display.

Distinguish BYTES from BYTES32

Use BYTES for variable-length calldata or bytecode and BYTES32 for topics, hashes, slots, and salts.

Indexed addresses occupy ABI words

An ADDRESS is 20 bytes. An indexed address occupies a 32-byte ABI topic.