Skip to content

Commit

Permalink
Inline ErrBalanceTxInsufficientCollateralError.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Feb 8, 2024
1 parent 3f564d3 commit 2a80fc2
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 66 deletions.
27 changes: 7 additions & 20 deletions lib/balance-tx/lib/internal/Internal/Cardano/Write/Tx/Balance.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ module Internal.Cardano.Write.Tx.Balance
-- * Balancing transactions
balanceTransaction
, ErrBalanceTx (..)
, ErrBalanceTxInsufficientCollateralError (..)
, ErrBalanceTxInternalError (..)
, ErrBalanceTxOutputError (..)
, ErrBalanceTxOutputErrorInfo (..)
Expand Down Expand Up @@ -320,23 +319,6 @@ import qualified Data.Map.Strict.Extra as Map
import qualified Data.Sequence.Strict as StrictSeq
import qualified Data.Set as Set

-- | Indicates a failure to select a sufficient amount of collateral.
--
data ErrBalanceTxInsufficientCollateralError era =
ErrBalanceTxInsufficientCollateralError
{ largestCombinationAvailable :: UTxO era
-- ^ The largest available combination of pure ada UTxOs.
, minimumCollateralAmount :: Coin
-- ^ The minimum quantity of ada necessary for collateral.
}
deriving Generic

deriving instance IsRecentEra era =>
Eq (ErrBalanceTxInsufficientCollateralError era)

deriving instance IsRecentEra era =>
Show (ErrBalanceTxInsufficientCollateralError era)

-- | Indicates that there was not enough ada available to create change outputs.
--
-- When creating a change output, ada is required in order to pay for:
Expand Down Expand Up @@ -393,7 +375,13 @@ data ErrBalanceTx era
| ErrBalanceTxExistingTotalCollateral
| ErrBalanceTxExistingReturnCollateral
| ErrBalanceTxInsufficientCollateral
(ErrBalanceTxInsufficientCollateralError era)
{ largestCombinationAvailable :: UTxO era
-- ^ The largest available combination of pure ada UTxOs.
, minimumCollateralAmount :: Coin
-- ^ The minimum quantity of ada necessary for collateral.
}
-- ^ Indicates a failure to select a sufficient amount of collateral.
--
| ErrBalanceTxConflictingNetworks
| ErrBalanceTxAssignRedeemers ErrAssignRedeemers
| ErrBalanceTxInternalError (ErrBalanceTxInternalError era)
Expand Down Expand Up @@ -1540,7 +1528,6 @@ coinSelectionErrorToBalanceTxError = \case
, minimumSelectionAmount
} ->
ErrBalanceTxInsufficientCollateral
ErrBalanceTxInsufficientCollateralError
{ largestCombinationAvailable
= largestCombinationAvailable
& fmap W.TokenBundle.fromCoin
Expand Down
2 changes: 0 additions & 2 deletions lib/balance-tx/lib/main/Cardano/Write/Tx.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module Cardano.Write.Tx
balanceTransaction
, ErrAssignRedeemers (..)
, ErrBalanceTx (..)
, ErrBalanceTxInsufficientCollateralError (..)
, ErrBalanceTxInternalError (..)
, ErrBalanceTxOutputError (..)
, ErrBalanceTxOutputErrorInfo (..)
Expand All @@ -27,7 +26,6 @@ import Internal.Cardano.Write.Tx
import Internal.Cardano.Write.Tx.Balance
( ErrAssignRedeemers (..)
, ErrBalanceTx (..)
, ErrBalanceTxInsufficientCollateralError (..)
, ErrBalanceTxInternalError (..)
, ErrBalanceTxOutputError (..)
, ErrBalanceTxOutputErrorInfo (..)
Expand Down
Loading

0 comments on commit 2a80fc2

Please sign in to comment.