cooked-validators
Safe HaskellSafe-Inferred
LanguageHaskell2010

Cooked.MockChain.Balancing

Description

This module handles auto-balancing of transaction skeleton. This includes computation of fees and collaterals because their computation cannot be separated from the balancing.

Synopsis

Documentation

type Body = TxBody ConwayEra Source #

A transaction body

data ExtendedTxSkel Source #

A TxSkel with extra pieces of information produced during balancing

Constructors

ExtendedTxSkel 

Fields

balanceTxSkel :: Members '[MockChainRead, MockChainLog, Error MockChainError, Error ToCardanoError, Fail] effs => TxSkel -> Sem effs ExtendedTxSkel Source #

This is the main entry point of our balancing mechanism. This function takes a skeleton and returns a (possibly) balanced skeleton alongside the associated fee, collateral inputs and return collateral user, which might be empty when no script is involved in the transaction. The options from the skeleton control whether it should be balanced, and how to compute its associated elements.

getMinAndMaxFee :: Members '[MockChainRead] effs => Integer -> Sem effs (Fee, Fee) Source #

This computes the minimum and maximum possible fee a transaction can cost based on the current protocol parameters and its number of scripts. In the Dijsktra era, this will be modified with new protocol parameters. See https://github.com/IntersectMBO/cardano-ledger/blob/master/docs/adr/2024-08-14_009-refscripts-fee-change.md for more information

estimateTxSkelFee :: Members '[MockChainRead, Error MockChainError, Error ToCardanoError, Fail] effs => TxSkel -> Fee -> Maybe Collaterals -> Sem effs (Fee, Body) Source #

Estimates the required fee for a given skeleton with a given initial fee and collaterals