Pre-release — The API surface may change. Unaudited.
Callcium LogoCallcium

Path

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

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)

State Variables

ALL_OR_EMPTY

Universal quantifier for array paths (∀). Rule must pass for ALL elements.

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

uint16 internal constant ALL_OR_EMPTY = 0xFFFF

ALL

Universal quantifier for array paths (∀). Rule must pass for ALL elements and the array MUST NOT be empty.

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

uint16 internal constant ALL = 0xFFFE

ANY

Existential quantifier for array paths (∃). Rule must pass for AT LEAST ONE element.

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

uint16 internal constant ANY = 0xFFFD

Functions

encode

Encodes a single-step path.

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.

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.

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.

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.

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.

decode

Decodes a be16-encoded path into a uint16 array.

function decode(bytes memory self) internal pure returns (uint16[] memory out);

Parameters

NameTypeDescription
selfbytesThe encoded path bytes.

Returns

NameTypeDescription
outuint16[]The decoded path steps.

depth

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

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.

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.

at

Returns the step at a given step index in the path.

function at(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.

atUnchecked

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

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.

error EmptyPath();

IndexOutOfBounds

Thrown when accessing a step position beyond the path depth.

error IndexOutOfBounds(uint256 stepIndex, uint256 depth);

Parameters

NameTypeDescription
stepIndexuint256The 0-based step index.
depthuint256The path depth.

MalformedPath

Thrown when the be16-encoded path is malformed (empty or odd length).

error MalformedPath();

On this page