Skip to content

Commit

Permalink
Remove headOutputValue
Browse files Browse the repository at this point in the history
  • Loading branch information
v0d1ch committed Feb 7, 2023
1 parent d8f4fe0 commit 05803bd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
6 changes: 3 additions & 3 deletions hydra-plutus/src/Hydra/Contract/Head.hs
Expand Up @@ -21,7 +21,7 @@ import PlutusTx.Prelude
import Hydra.Contract.Commit (Commit (..))
import qualified Hydra.Contract.Commit as Commit
import Hydra.Contract.HeadState (Input (..), Signature, SnapshotNumber, State (..))
import Hydra.Contract.Util (hasST, headOutputValue, mustNotMintOrBurn, mustPreserveValue)
import Hydra.Contract.Util (hasST, mustNotMintOrBurn, mustPreserveValue)
import Hydra.Data.ContestationPeriod (ContestationPeriod, addContestationPeriod, milliseconds)
import Hydra.Data.Party (Party (vkey))
import Plutus.Extras (ValidatorType, scriptValidatorHash, wrapValidator)
Expand Down Expand Up @@ -280,7 +280,7 @@ checkClose ctx parties initialUtxoHash sig cperiod headPolicyId =
&& mustNotChangeParameters
&& mustPreserveValue outValue headOutValue
where
headOutValue = headOutputValue $ txInfoOutputs txInfo
headOutValue = txOutValue . head $ txInfoOutputs txInfo
hasBoundedValidity =
traceIfFalse "hasBoundedValidity check failed" $
tMax - tMin <= cp
Expand Down Expand Up @@ -377,7 +377,7 @@ checkContest ctx contestationDeadline parties closedSnapshotNumber sig contester
&& mustNotChangeParameters
&& mustPreserveValue outValue headOutValue
where
headOutValue = headOutputValue $ txInfoOutputs txInfo
headOutValue = txOutValue . head $ txInfoOutputs txInfo
outValue =
maybe mempty (txOutValue . txInInfoResolved) $ findOwnInput ctx

Expand Down
6 changes: 0 additions & 6 deletions hydra-plutus/src/Hydra/Contract/Util.hs
Expand Up @@ -8,7 +8,6 @@ import Plutus.V2.Ledger.Api (
CurrencySymbol,
TokenName (..),
TxInfo (TxInfo, txInfoMint),
TxOut (txOutValue),
Value (getValue),
)
import qualified PlutusTx.AssocMap as Map
Expand Down Expand Up @@ -53,8 +52,3 @@ mustPreserveValue outValue headOutValue =
traceIfFalse "head value is not preserved" $
outValue == headOutValue
{-# INLINEABLE mustPreserveValue #-}

headOutputValue :: [TxOut] -> Value
headOutputValue (headOutput : _outputs) = txOutValue headOutput
headOutputValue _ = traceError "does not have at least head output"
{-# INLINEABLE headOutputValue #-}

0 comments on commit 05803bd

Please sign in to comment.