registry/discharge
Discharging each collected duty against the transaction (#157 token-destinations-and-refunds, #177).
Responsibility
Once the fold has walked every request, dutiesFault checks each
collected Duty in order against the transaction’s outputs and inputs:
a delivered active token sits in the output its request named with its
deposit, and a retirement consumes its one active witness. Lovelace
owed to payees is settled by registry/settlement after duties hold.
Dependencies
Imports registry/duty (the duties), registry/refusal (deposit-returned), types and
lib. Imported by registry/modify, and by the Aiken suite for the
token-missing reason.
Assumptions
- The fold has already refused anything its trie walk, admission or mint check refuses; duties are discharged only for a fold that reached here.
cageAddressis the address of the state input being spent.
Invariants
- Duties are checked in list order and the first failing duty’s reason is the answer, so exactly one reason is reported.
- A delivered token’s carrier is the only output holding that asset, holds
exactly the merged count, matches the named destination and holds at
least the summed deposit; otherwise
destinationordeposit-returned. - Retirement requires exactly one input carrying exactly one active
witness (
token-missing). ReturnDepositis settled byregistry/settlement.