| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Cooked.MockChain.AutoFilling
Description
This module exposes functions to automatically fill parts of a
TxSkel based on the current state of the blockchain.
Synopsis
- autoFillWithdrawalAmounts :: MonadBlockChainWithoutValidation m => TxSkel -> m TxSkel
- autoFillConstitution :: MonadBlockChainWithoutValidation m => TxSkel -> m TxSkel
- updateRedeemedScript :: MonadBlockChain m => [TxOutRef] -> User IsScript Redemption -> m (User IsScript Redemption)
- autoFillReferenceScripts :: forall m. MonadBlockChain m => TxSkel -> m TxSkel
- getTxSkelOutMinAda :: MonadBlockChainBalancing m => TxSkelOut -> m Integer
- toTxSkelOutWithMinAda :: MonadBlockChainBalancing m => TxSkelOut -> m TxSkelOut
- autoFillMinAda :: MonadBlockChainBalancing m => TxSkel -> m TxSkel
Auto filling withdrawal amounts
autoFillWithdrawalAmounts :: MonadBlockChainWithoutValidation m => TxSkel -> m TxSkel Source #
Goes through all the withdrawals of the input skeleton and attempts to fill out the withdrawn amount based on the associated user rewards. Does not tamper with an existing specified amount in such withdrawals. Logs an event when an amount has been successfully auto-filled.
Auto filling constitution script
autoFillConstitution :: MonadBlockChainWithoutValidation m => TxSkel -> m TxSkel Source #
Goes through all the proposals of the input skeleton and attempts to fill out the constitution scripts with the current one. Does not tamper with an existing specified script in such withdrawals. Logs an event when the constitution script has been successfully auto-filled.
Auto filling reference scripts
updateRedeemedScript :: MonadBlockChain m => [TxOutRef] -> User IsScript Redemption -> m (User IsScript Redemption) Source #
Attempts to find in the index a utxo containing a reference script with the given script hash, and attaches it to a redeemer when it does not yet have a reference input and when it is allowed, in which case an event is logged.
autoFillReferenceScripts :: forall m. MonadBlockChain m => TxSkel -> m TxSkel Source #
Goes through the various parts of the skeleton where a redeemer can appear, and attempts to attach a reference input to each of them, whenever it is allowed and one has not already been set. Logs an event whenever such an addition occurs.
Auto filling min ada amounts
getTxSkelOutMinAda :: MonadBlockChainBalancing m => TxSkelOut -> m Integer Source #
Compute the required minimal ADA for a given output
toTxSkelOutWithMinAda :: MonadBlockChainBalancing m => TxSkelOut -> m TxSkelOut Source #
This transforms an output into another output which contains the minimal required ada. If the previous quantity of ADA was sufficient, it remains unchanged. This can require a few iterations to converge, as the added ADA will increase the size of the UTXO which in turn might need more ADA.
autoFillMinAda :: MonadBlockChainBalancing m => TxSkel -> m TxSkel Source #
This goes through all the TxSkelOuts of the given skeleton and updates
their ada value when requested by the user and required by the protocol
parameters. Logs an event whenever such a change occurs.