Skip to content

Commit

Permalink
Flesh-out adding initial outputs to InitTx
Browse files Browse the repository at this point in the history
We need to get the cardano credentials for all parties from ... where?
  • Loading branch information
abailly-iohk committed Oct 28, 2021
1 parent 7868ae4 commit 08832f2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions hydra-node/src/Hydra/Chain/Direct/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,7 @@ initTx HeadParameters{contestationPeriod, parties} txIn =
TxBody
{ inputs = Set.singleton txIn
, collateral = mempty
, -- TODO(SN): of course this is missing the PT outputs
outputs = StrictSeq.singleton headOut
, outputs = StrictSeq.fromList (headOut : initials)
, txcerts = mempty
, txwdrls = Wdrl mempty
, txfee = Coin 0
Expand Down Expand Up @@ -139,6 +138,19 @@ initTx HeadParameters{contestationPeriod, parties} txIn =
(contestationPeriodFromDiffTime contestationPeriod)
(map (partyFromVerKey . vkey) parties)

initials = map mkInitial parties

mkInitial party = TxOut @Era initialAddress initialValue (SJust $ initialDatumHash party)

initialAddress = scriptAddr $ plutusScript MockInitial.validatorScript

-- TODO: should really be the minted PTs plus some ADA to make the ledger happy
initialValue = headValue

initialDatumHash = hashData @Era . initialDatum

initialDatum _party = error "undefined"

-- | Craft a commit transaction which includes the "committed" utxo as a datum.
-- TODO(SN): Eventually, this might not be necessary as the 'Utxo tx' would need
-- to be inputs of this transaction.
Expand Down

0 comments on commit 08832f2

Please sign in to comment.