| Safe Haskell | Safe-Inferred |
|---|---|
| Language | GHC2021 |
Hydra.Tx.Fanout
Contents
Synopsis
- fanoutTx :: ScriptRegistry -> UTxO -> Maybe UTxO -> Maybe UTxO -> (TxIn, TxOut CtxUTxO) -> SlotNo -> PlutusScript -> Either Text Tx
- partialFanoutTx :: ScriptRegistry -> UTxO -> (TxIn, TxOut CtxUTxO) -> SlotNo -> FanoutProgressDatum -> HydraAccumulator -> Tx
- finalPartialFanoutTx :: ScriptRegistry -> UTxO -> HydraAccumulator -> (TxIn, TxOut CtxUTxO) -> SlotNo -> PlutusScript -> Either Text Tx
- data FanoutObservation = FanoutObservation {
- headId :: HeadId
- fanoutUTxO :: UTxO
- observeFanoutTx :: UTxO -> Tx -> Maybe FanoutObservation
- data PartialFanoutObservation = PartialFanoutObservation {
- headId :: HeadId
- distributedOutputs :: UTxO
- observePartialFanoutTx :: UTxO -> Tx -> Maybe PartialFanoutObservation
- observeFinalPartialFanoutTx :: UTxO -> Tx -> Maybe FanoutObservation
Creation
Arguments
| :: ScriptRegistry | Published Hydra scripts to reference. |
| -> UTxO | Snapshotted UTxO to fanout on layer 1 |
| -> Maybe UTxO | Snapshotted commit UTxO to fanout on layer 1 |
| -> Maybe UTxO | Snapshotted decommit UTxO to fanout on layer 1 |
| -> (TxIn, TxOut CtxUTxO) | Everything needed to spend the Head state-machine output. |
| -> SlotNo | Contestation deadline as SlotNo, used to set lower tx validity bound. |
| -> PlutusScript | Minting Policy script, made from initial seed |
| -> Either Text Tx |
Create the fanout transaction, which distributes the closed state accordingly. The head validator allows fanout only > deadline, so we need to set the lower bound to be deadline + 1 slot.
Arguments
| :: ScriptRegistry | Published Hydra scripts to reference. |
| -> UTxO | Subset of UTxOs to distribute in this partial fanout |
| -> (TxIn, TxOut CtxUTxO) | Head state-machine output to spend |
| -> SlotNo | Contestation deadline as SlotNo, used to set lower tx validity bound. |
| -> FanoutProgressDatum | FanoutProgressDatum from the current head output (the caller converts ClosedDatum if needed) |
| -> HydraAccumulator | Remaining accumulator after removing the distributed subset |
| -> Tx |
Create a partial fanout transaction that distributes a subset of UTxOs
and produces a FanoutProgress head output with an updated accumulator.
Handles both Closed → FanoutProgress (first step) and FanoutProgress →
FanoutProgress (subsequent steps).
The continuing head output is the first output, followed by the distributed UTxOs. No tokens are burned (that happens on the final full fanout).
Arguments
| :: ScriptRegistry | Published Hydra scripts to reference. |
| -> UTxO | All remaining UTxOs to distribute in this final fanout |
| -> HydraAccumulator | Accumulator the head output's datum commits to, i.e. exactly the UTxOs
distributed here. The membership proof is against this, so the caller
passing the accumulator it already verified against the datum is what
makes the on-chain identity |
| -> (TxIn, TxOut CtxUTxO) | Head state-machine output to spend |
| -> SlotNo | Contestation deadline as SlotNo, used to set lower tx validity bound. |
| -> PlutusScript | Minting Policy script, made from initial seed |
| -> Either Text Tx |
Create the final partial fanout transaction that distributes all remaining UTxOs and burns all head tokens. Transitions FanoutProgress → Final.
Observation
data FanoutObservation Source #
Constructors
| FanoutObservation | |
Fields
| |
Instances
Arguments
| :: UTxO | A UTxO set to lookup tx inputs |
| -> Tx | |
| -> Maybe FanoutObservation |
Identify a fanout tx by lookup up the input spending the Head output and decoding its redeemer.
data PartialFanoutObservation Source #
Constructors
| PartialFanoutObservation | |
Fields
| |
Instances
observePartialFanoutTx Source #
Arguments
| :: UTxO | A UTxO set to lookup tx inputs |
| -> Tx | |
| -> Maybe PartialFanoutObservation |
Identify a partial fanout tx by looking up the input spending the Head output and decoding its redeemer as PartialFanout.
observeFinalPartialFanoutTx Source #
Arguments
| :: UTxO | A UTxO set to lookup tx inputs |
| -> Tx | |
| -> Maybe FanoutObservation |
Identify a final partial fanout tx by looking up the input spending the Head output and decoding its redeemer as FinalPartialFanout. Returns a FanoutObservation since this is the finalizing step.