Skip to content

Commit

Permalink
Rename binding names to be more accurate
Browse files Browse the repository at this point in the history
  • Loading branch information
newhoggy committed Nov 9, 2023
1 parent 0008725 commit f27b67e
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions cardano-api/internal/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -810,23 +810,17 @@ makeTransactionBodyAutoBalance sbe systemstart history lpp@(LedgerProtocolParame
-- However, since at this point we know how much non-Ada change to give
-- we can use the true values for that.

let outgoingNonAda = mconcat [v | (TxOut _ (TxOutValueShelleyBased _ v) _ _) <- txOuts txbodycontent]
let incomingNonAda = mconcat [v | (TxOut _ (TxOutValueShelleyBased _ v) _ _) <- Map.elems $ unUTxO utxo]
let mintedNonAda = case txMintValue txbodycontent1 of
let outgoing = mconcat [v | (TxOut _ (TxOutValueShelleyBased _ v) _ _) <- txOuts txbodycontent]
let incoming = mconcat [v | (TxOut _ (TxOutValueShelleyBased _ v) _ _) <- Map.elems $ unUTxO utxo]
let minted = case txMintValue txbodycontent1 of
TxMintNone -> mempty
TxMintValue w v _ -> toLedgerValue w v
let nonAdaChange = mconcat
[ incomingNonAda
, mintedNonAda
, negateLedgerValue sbe outgoingNonAda
]

let change = mconcat [incoming, minted, negateLedgerValue sbe outgoing]
let maxLovelace = Lovelace (2^(64 :: Integer)) - 1
let changeWithMaxLovelace = change & A.adaAssetL sbe .~ lovelaceToCoin maxLovelace
let changeTxOut = forShelleyBasedEraInEon sbe
(lovelaceToTxOutValue era maxLovelace)
(\w -> maryEraOnwardsConstraints w
$ TxOutValueShelleyBased sbe (nonAdaChange & A.adaAssetL sbe .~ lovelaceToCoin maxLovelace)
)
(\w -> maryEraOnwardsConstraints w $ TxOutValueShelleyBased sbe changeWithMaxLovelace)

let (dummyCollRet, dummyTotColl) = maybeDummyTotalCollAndCollReturnOutput txbodycontent changeaddr
txbody1 <- first TxBodyError $ -- TODO: impossible to fail now
Expand Down

0 comments on commit f27b67e

Please sign in to comment.