cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.Skeleton.Datum

Synopsis

Documentation

data TxSkelOutDatum where Source #

On transaction outputs, we have the options to use

  1. no datum
  2. only a datum hash
  3. a "normal" datum
  4. an inline datum

These four options are also what the type TxSkelOutDatum records. The following table explains their differences.

datum stored in in the simulated chain state datum resolved on the txInfoDataOutputDatum constructor seen by the validator
TxSkelOutNoDatumnonoNoOutputDatum
TxSkelOutDatumHashyesnoOutputDatumHash
TxSkelOutDatumyesyesOutputDatumHash
TxSkelOutInlineDatumyesnoOutputDatum

That is:

  • Whenever there is a datum, we'll store it in the state of our simulated chain. This will make it possible to retrieve it later, using functions such as datumFromHash.
  • Both of the TxSkelOutDatumHash and TxSkelOutDatum constructors will create an output that scripts see on the txInfo as having a datum hash. The difference is whether that hash will be resolvable using validator functions like findDatum.

Constructors

TxSkelOutNoDatum :: TxSkelOutDatum

use no datum

TxSkelOutDatumHash :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

only include the hash on the transaction

TxSkelOutDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

use a OutputDatumHash on the transaction output, but generate the transaction in such a way that the complete datum is included in the txInfoData seen by validators

TxSkelOutInlineDatum :: TxSkelOutDatumConstrs a => a -> TxSkelOutDatum

use an inline datum