Skip to content

Commit

Permalink
Apply code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
klntsky committed Dec 9, 2023
1 parent 1d42199 commit 3149cb8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/balancing.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ CTL allows tweaking the default balancer behavior by letting the user impose con

- Using arbitrary address as user's own (for transaction balancing): `mustUseUtxosAtAddresses` / `mustUseUtxosAtAddress`
- Providing additional UTxOs to use: `mustUseAdditionalUtxos`
- Bypassing wallet's collateral selection and select collateral UTxOs from a given set: `mustUseCollateralUtxos`
- Bypassing wallet's collateral selection and selecting collateral UTxOs from a given set: `mustUseCollateralUtxos`
- Overriding change address: `mustSendChangeToAddress`
- Preventing certain UTxOs from being spent: `mustNotSpendUtxosWithOutRefs` / `mustNotSpendUtxoWithOutRef`
- Distributing token outputs equally between change UTxOs: `mustGenChangeOutsWithMaxTokenQuantity`
Expand Down
2 changes: 1 addition & 1 deletion examples/BalanceTxConstraints.purs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ contract (ContractParams p) = do
\{ input, output } -> Tuple input output

nonSpendableOref <-
liftedM "Failed to get utxos at Bob's address"
liftedM "Failed to get utxos at Alice's address"
(Set.findMin <<< Map.keys <$> utxosAt aliceAddress)

mp /\ cs <- Helpers.mkCurrencySymbol alwaysMintsPolicy
Expand Down
3 changes: 1 addition & 2 deletions src/Internal/BalanceTx/BalanceTx.purs
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,7 @@ setTransactionCollateral changeAddr transaction = do
mbCollateralUtxos <- asksConstraints _collateralUtxos
-- We must filter out UTxOs that are set as non-spendable in the balancer
-- constraints
let
isSpendable = not <<< flip Set.member nonSpendableSet
let isSpendable = not <<< flip Set.member nonSpendableSet
collateral <- case mbCollateralUtxos of
-- if no collateral utxos are specified, use the wallet, but filter
-- the unspendable ones
Expand Down
2 changes: 1 addition & 1 deletion src/Internal/BalanceTx/Constraints.purs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ mustUseAdditionalUtxos :: UtxoMap -> BalanceTxConstraintsBuilder
mustUseAdditionalUtxos = wrap <<< set _additionalUtxos

-- | Tells the balancer to select from the provided UTxO set when choosing
-- | collateral UTxOs. Disables wallet's collateral selection.
-- | collateral UTxOs, instead of UTxOs provided by the browser wallet.
mustUseCollateralUtxos :: UtxoMap -> BalanceTxConstraintsBuilder
mustUseCollateralUtxos = wrap <<< set _collateralUtxos <<< Just

Expand Down

0 comments on commit 3149cb8

Please sign in to comment.