hydra-plutus-0.20.0: Hydra Plutus Contracts
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Contract.Util

Contents

Synopsis

Documentation

hydraHeadV1 :: BuiltinByteString Source #

hasST :: CurrencySymbol -> Value -> Bool Source #

Checks that the output contains the state token (ST) with the head CurrencySymbol and TokenName of hydraHeadV1

mustBurnAllHeadTokens :: Value -> CurrencySymbol -> [Party] -> Bool Source #

Checks all tokens related to some specific CurrencySymbol.

This checks both PTs and ST are burnt.

(===) :: Value -> Value -> Bool infix 4 Source #

Checks for exact equality between two serialized values. Equality on value is very memory intensive as it's defined on associative lists and AssocMap equality is implemented. Instead we can be more strict and require EXACTLY the same value and compare using the serialised bytes.

hashPreSerializedCommits :: [Commit] -> BuiltinByteString Source #

Hash a potentially unordered list of commits by sorting them, concatenating their preSerializedOutput bytes and creating a SHA2_256 digest over that.

NOTE: See note from hashTxOuts.

hashTxOuts :: [TxOut] -> BuiltinByteString Source #

Hash a pre-ordered list of transaction outputs by serializing each individual TxOut, concatenating all bytes together and creating a SHA2_256 digest over that.

NOTE: In general, from asserting that `hash(x || y) = hash (x' || y')` it is not safe to conclude that `(x,y) = (x', y')` as the same hash could be obtained by moving one or more bytes from the end of x to the beginning of y, but in the context of Hydra validators it seems impossible to exploit this property without breaking other logic or verification (eg. producing a valid and meaningful TxOut).

compareRef :: TxOutRef -> TxOutRef -> Ordering Source #

Errors

data UtilError Source #

Instances

Instances details
Show UtilError Source # 
Instance details

Defined in Hydra.Contract.Util

ToErrorCode UtilError Source # 
Instance details

Defined in Hydra.Contract.Util

scriptOutputsAt :: ScriptHash -> TxInfo -> [(OutputDatum, Value)] Source #

Get the list of TxOut outputs of the pending transaction at a given script address.