singular_state/state

The registry state output of the new Singular line.

Responsibility

Defines the root-only state datum, decides whether an output is the state of the registry created from a given seed, and compares the whole mint of a policy with the mint a rule expects.

Dependencies

singular_state/preimage for the state token name; the Aiken standard library.

Assumptions

The state policy is the hash of the state script, which is also the credential of the state address.

Invariants

An output is a state only when it sits at the state script, holds the one state token named from the supplied seed at quantity one and nothing else but ADA, and carries a root datum.

Types

The datum of a state output: the root of the registry’s trie.

Constructors

  • StateDatum { root: ByteArray }

Functions

recognize_state(
  state_policy: PolicyId,
  seed: OutputReference,
  output: Output,
) -> Bool

Whether output is the state of the registry created by spending seed under state_policy.

Its value holds one non-ADA entry, which is the state token: under the state policy, named from seed, at quantity one.

policy_delta(
  mint: Value,
  policy: PolicyId,
  expected: Pairs<AssetName, Int>,
) -> Bool

Whether the whole mint of policy in mint is exactly expected.

state_root(datum: Datum) -> Option<ByteArray>

The root a state output’s datum carries, when it carries one.

Search Document