Callcium
API

Path

Encodes and inspects descriptor paths as big-endian uint16 sequences.

Git Source

Paths represent navigation through ABI-encoded calldata:

  • path[0] is the top-level argument index.
  • path[1..n] are indices into nested composites (tuples, arrays).

Constants

ALL

Universal quantifier for array paths (∀). Rule must pass for every element.

Only valid immediately after an array node. Empty arrays give true (vacuous truth).

Git Source

uint16 internal constant ALL = 0xFFFF;

ANY

Existential quantifier for array paths (∃). Rule must pass for some element.

Only valid immediately after an array node. Empty arrays give false.

Git Source

uint16 internal constant ANY = 0xFFFE;

Functions

encode

Encodes a single-step path.

Git Source

function encode(uint16 p0) internal pure returns (bytes memory out);

Parameters

NameTypeDescription
p0uint16The first path step.

Returns

NameTypeDescription
outbytesThe encoded path bytes.

encode

Encodes a two-step path.

Git Source

function encode(uint16 p0, uint16 p1) internal pure returns (bytes memory out);

Parameters

NameTypeDescription
p0uint16The first path step.
p1uint16The second path step.

Returns

NameTypeDescription
outbytesThe encoded path bytes.

encode

Encodes a three-step path.

Git Source

function encode(uint16 p0, uint16 p1, uint16 p2) internal pure returns (bytes memory out);

Parameters

NameTypeDescription
p0uint16The first path step.
p1uint16The second path step.
p2uint16The third path step.

Returns

NameTypeDescription
outbytesThe encoded path bytes.

encode

Encodes a four-step path.

Git Source

function encode(uint16 p0, uint16 p1, uint16 p2, uint16 p3) internal pure returns (bytes memory out);

Parameters

NameTypeDescription
p0uint16The first path step.
p1uint16The second path step.
p2uint16The third path step.
p3uint16The fourth path step.

Returns

NameTypeDescription
outbytesThe encoded path bytes.

encode

Encodes a path from a uint16 array.

Git Source

function encode(uint16[] memory path) internal pure returns (bytes memory out);

Parameters

NameTypeDescription
pathuint16[]The path indices as an array.

Returns

NameTypeDescription
outbytesThe encoded path bytes.

depth

Returns the depth (number of steps) in a path.

Git Source

function depth(bytes memory self) internal pure returns (uint256);

Parameters

NameTypeDescription
selfbytesThe encoded path bytes.

Returns

NameTypeDescription
<none>uint256The number of steps in the path.

validate

Validates strict be16 payload: non-empty and even length. Returns depth.

Git Source

function validate(bytes memory self) internal pure returns (uint256);

Parameters

NameTypeDescription
selfbytesThe encoded path bytes.

Returns

NameTypeDescription
<none>uint256The number of steps in the path.

atUnchecked

Returns the step at a given step index without bounds checks. Caller must ensure stepIndex < depth.

Git Source

function atUnchecked(bytes memory self, uint256 stepIndex) internal pure returns (uint16);

Parameters

NameTypeDescription
selfbytesThe encoded path bytes.
stepIndexuint256The 0-based step index.

Returns

NameTypeDescription
<none>uint16The uint16 step value at the given index.

Errors

EmptyPath

Thrown when the path is empty.

Git Source

error EmptyPath();

MalformedPath

Thrown when the be16-encoded path has an odd byte length.

Git Source

error MalformedPath();

On this page