registry/modify

The Modify decision: whether a fold of the registry’s state is valid, and if not, the one reason why (#157 leaf-codec-and-operations–request-covers-tip, #253).

Responsibility

validFold checks, in this order: the continuation output (continuation-address, state-token, state-drain) and the preserved pins (pins-altered); then runs the fold over the transaction’s inputs (registry/fold) and judges its result (empty-fold, surplus-actions, root, the mint delta); then discharges the collected duties (registry/discharge) and settles the lovelace they owe (registry/settlement). The first failing check is the answer.

Dependencies

Imports registry/fold, registry/discharge, registry/settlement, registry/refusal, lib (exact quantity, the mint refusal) and types. Imported by state, whose spend handler and modifyRefusal identify the state input and call it. Nothing below imports it.

Assumptions

Invariants

Functions

validFold(
  pins: State,
  input: Input,
  policyId: PolicyId,
  tokenId: TokenId,
  tx: Transaction,
  actions: List<RequestAction>,
) -> Option<String>

Why the cage refuses this fold of the state input carrying pins, or None when it is valid: the continuation, the pins, the fold, the mint delta, the duties and the payees, checked in that order, first failure answering.

Search Document