Skip to content

Commit

Permalink
feat: added Enum, Bounded instance of coin selection strategy typ…
Browse files Browse the repository at this point in the history
…e to better enumerate through it

Related to #294
  • Loading branch information
sourabhxyz committed Apr 27, 2024
1 parent 3105957 commit 767b8c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/GeniusYield/Transaction/CoinSelection.hs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ data GYCoinSelectionStrategy
= GYLargestFirstMultiAsset
| GYRandomImproveMultiAsset
| GYLegacy
deriving stock (Eq, Show)
deriving stock (Eq, Show, Enum, Bounded)

{- | Select additional inputs from the set of own utxos given, such that when combined with given existing inputs,
they cover for all the given outputs, as well as extraLovelace.
Expand Down
2 changes: 1 addition & 1 deletion tests-privnet/GeniusYield/Test/Privnet/Stake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ withdrawRewardsSteps strat user@User{..} rewards info ctx = do
tests :: IO Setup -> TestTree
tests setup = testGroup "stake"
[ testCaseSteps "exercising stake credential registration, delegation, rewards claiming & de-registration" $ \info -> withSetup setup info $ \ctx -> do
for_ [GYRandomImproveMultiAsset, GYLegacy] $ \strat -> do
for_ [minBound .. maxBound] $ \strat -> do
newUser <- registerStakeCredentialSteps strat info ctx
sps <- ctx & ctxGetParams & gyGetStakePools'
info $ "Total stake pools: " <> show sps <> "\n"
Expand Down
2 changes: 1 addition & 1 deletion tests/GeniusYield/Test/Stake.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ stakeTests config =
-- Check if the withdrawal amount is positive.
stakeAddrInfo <- gyGetStakeAddressInfo stakeAddr
assertBool "No positive rewards available for withdrawal" $ gyStakeAddressInfoAvailableRewards stakeAddrInfo > 0
for_ [GYRandomImproveMultiAsset, GYLegacy] $ \strat ->
for_ [minBound .. maxBound] $ \strat ->
testWithdrawalWithStrategy strat stakeAddrInfo addr stakeAddr config provider
]

Expand Down

0 comments on commit 767b8c8

Please sign in to comment.