cardano-ledger-shelley-ma-0.1.0.0: Shelley ledger with multiasset and time lock support.
Safe Haskell None
Language Haskell2010

Cardano.Ledger.ShelleyMA.Rules.Utxo

Synopsis

Documentation

data UtxoPredicateFailure era Source #

Instances

Instances details
( Eq ( TxOut era), Eq ( Value era), Eq ( UTxOState era), Eq ( PredicateFailure ( EraRule "PPUP" era))) => Eq ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

( Show ( TxOut era), Show ( Value era), Show ( UTxOState era), Show ( PredicateFailure ( EraRule "PPUP" era))) => Show ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

Generic ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

( Typeable era, Crypto ( Crypto era), ToCBOR ( Value era), ToCBOR ( TxOut era), ToCBOR ( UTxOState era), ToCBOR ( PredicateFailure ( EraRule "PPUP" era))) => ToCBOR ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

( TransValue FromCBOR era, TransUTxO FromCBOR era, DecodeNonNegative ( Value era), Show ( Value era), FromCBOR ( PredicateFailure ( EraRule "PPUP" era))) => FromCBOR ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

( NoThunks ( TxOut era), NoThunks ( Value era), NoThunks ( UTxOState era), NoThunks ( PredicateFailure ( EraRule "PPUP" era))) => NoThunks ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

Inject ( UtxoPredicateFailure era) ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

Inject ( UtxoPredicateFailure era) ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

InjectMaybe ( UtxoPredicateFailure era) ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type Rep ( UtxoPredicateFailure era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type Rep ( UtxoPredicateFailure era) = D1 (' MetaData "UtxoPredicateFailure" "Cardano.Ledger.ShelleyMA.Rules.Utxo" "cardano-ledger-shelley-ma-0.1.0.0-IyXhkyY7R1xGIgXdNlolP6" ' False ) ((( C1 (' MetaCons "BadInputsUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Set ( TxIn ( Crypto era))))) :+: ( C1 (' MetaCons "OutsideValidityIntervalUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ValidityInterval ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 SlotNo )) :+: C1 (' MetaCons "MaxTxSizeUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Integer ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Integer )))) :+: ( C1 (' MetaCons "InputSetEmptyUTxO" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: ( C1 (' MetaCons "FeeTooSmallUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Coin )) :+: C1 (' MetaCons "ValueNotConservedUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Value era)) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Value era)))))) :+: (( C1 (' MetaCons "WrongNetwork" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Network ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Set ( Addr ( Crypto era))))) :+: ( C1 (' MetaCons "WrongNetworkWithdrawal" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Network ) :*: S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Set ( RewardAcnt ( Crypto era))))) :+: C1 (' MetaCons "OutputTooSmallUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [ TxOut era])))) :+: (( C1 (' MetaCons "UpdateFailure" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( PredicateFailure ( EraRule "PPUP" era)))) :+: C1 (' MetaCons "OutputBootAddrAttrsTooBig" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [ TxOut era]))) :+: ( C1 (' MetaCons "TriesToForgeADA" ' PrefixI ' False ) ( U1 :: Type -> Type ) :+: C1 (' MetaCons "OutputTooBigUTxO" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 [ TxOut era]))))))

newtype UtxoEvent era Source #

Constructors

UpdateEvent ( Event ( EraRule "PPUP" era))

consumed :: forall era. ( Era era, HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "mint" ( TxBody era) ( Value era), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "_keyDeposit" ( PParams era) Coin ) => PParams era -> UTxO era -> TxBody era -> Value era Source #

Calculate the value consumed by the transation.

This differs from the corresponding Shelley function Shelley.consumed since it also considers the "mint" field which creates or destroys non-Ada tokens.

Note that this is slightly confusing, since it also covers non-Ada assets _created_ by the transaction, depending on the sign of the quantities in the mint field.

utxoTransition :: forall era. ( UsesTxBody era, UsesValue era, STS ( UTXO era), Tx era ~ Tx era, Embed ( EraRule "PPUP" era) ( UTXO era), Environment ( EraRule "PPUP" era) ~ PPUPEnv era, State ( EraRule "PPUP" era) ~ PPUPState era, Signal ( EraRule "PPUP" era) ~ Maybe ( Update era), HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "mint" ( TxBody era) ( Value era), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "vldt" ( TxBody era) ValidityInterval , HasField "update" ( TxBody era) ( StrictMaybe ( Update era)), HasField "_minfeeA" ( PParams era) Natural , HasField "_minfeeB" ( PParams era) Natural , HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "_minUTxOValue" ( PParams era) Coin , HasField "_maxTxSize" ( PParams era) Natural ) => TransitionRule ( UTXO era) Source #

The UTxO transition rule for the Shelley-MA (Mary and Allegra) eras.

validateOutsideValidityIntervalUTxO :: HasField "vldt" ( TxBody era) ValidityInterval => SlotNo -> TxBody era -> Test ( UtxoPredicateFailure era) Source #

Ensure the transaction is within the validity window.

ininterval slot (txvld tx)

validateTriesToForgeADA :: ( Val ( Value era), HasField "mint" ( TxBody era) ( Value era)) => TxBody era -> Test ( UtxoPredicateFailure era) Source #

Check that the mint field does not try to mint ADA. This is equivalent to the check:

adaPolicy ∉ supp mint tx

validateOutputTooBigUTxO :: ( HasField "value" ( TxOut era) ( Value era), ToCBOR ( Value era)) => UTxO era -> Test ( UtxoPredicateFailure era) Source #

Ensure that there are no TxOut s that have Value of size larger than MaxValSize

∀ txout ∈ txouts txb, serSize (getValue txout) ≤ MaxValSize

validateOutputTooSmallUTxO :: ( HasField "_minUTxOValue" ( PParams era) Coin , HasField "value" ( TxOut era) ( Value era), Val ( Value era)) => PParams era -> UTxO era -> Test ( UtxoPredicateFailure era) Source #

Ensure that there are no TxOut s that have value less than the scaled minUTxOValue

∀ txout ∈ txouts txb, getValue txout ≥ inject (scaledMinDeposit v (minUTxOValue pp))

validateValueNotConservedUTxO :: ( Era era, HasField "_keyDeposit" ( PParams era) Coin , HasField "_poolDeposit" ( PParams era) Coin , HasField "certs" ( TxBody era) ( StrictSeq ( DCert ( Crypto era))), HasField "inputs" ( TxBody era) ( Set ( TxIn ( Crypto era))), HasField "wdrls" ( TxBody era) ( Wdrl ( Crypto era)), HasField "mint" ( TxBody era) ( Value era)) => PParams era -> UTxO era -> Map ( KeyHash ' StakePool ( Crypto era)) a -> TxBody era -> Test ( UtxoPredicateFailure era) Source #

Ensure that value consumed and produced matches up exactly. Note that this is different from Shelley, since implementation of consumed has changed.

consumed pp utxo txb = produced pp poolParams txb

data UTXO era Source #

Instances

Instances details
( Era era, UsesAuxiliary era, UsesScript era, UsesTxOut era, UsesValue era, UsesPParams era, TransValue ToCBOR era, PParams era ~ PParams era, TxBody era ~ TxBody era, TxOut era ~ TxOut era, Tx era ~ Tx era, Embed ( EraRule "PPUP" era) ( UTXO era), Environment ( EraRule "PPUP" era) ~ PPUPEnv era, State ( EraRule "PPUP" era) ~ PPUPState era, Signal ( EraRule "PPUP" era) ~ Maybe ( Update era)) => STS ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

( Era era, STS ( PPUP era), PredicateFailure ( EraRule "PPUP" era) ~ PpupPredicateFailure era, Event ( EraRule "PPUP" era) ~ Event ( PPUP era)) => Embed ( PPUP era) ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

( Era era, STS ( UTXO era), PredicateFailure ( EraRule "UTXO" era) ~ UtxoPredicateFailure era, Event ( EraRule "UTXO" era) ~ Event ( UTXO era)) => Embed ( UTXO era) ( UTXOW era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxow

type State ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type State ( UTXO era) = UTxOState era
type Event ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type Event ( UTXO era) = UtxoEvent era
type PredicateFailure ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type BaseM ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type Environment ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type Signal ( UTXO era) Source #
Instance details

Defined in Cardano.Ledger.ShelleyMA.Rules.Utxo

type Signal ( UTXO era) = Tx era