3
3
module Spec.HydraAuctionOnchain.QuickCheck.Gen
4
4
( KeyPair (.. )
5
5
, genKeyPair
6
+ , genScriptAddress
6
7
, genTxInfoTemplate
7
8
, genValidAuctionTerms
8
9
, genValidBidState
@@ -19,10 +20,13 @@ import Plutarch.Test.QuickCheck.Instances ()
19
20
import PlutusLedgerApi.V1.Interval qualified as Interval (always )
20
21
import PlutusLedgerApi.V1.Value qualified as Value (singleton )
21
22
import PlutusLedgerApi.V2
22
- ( BuiltinByteString
23
+ ( Address (Address )
24
+ , BuiltinByteString
25
+ , Credential (ScriptCredential )
23
26
, CurrencySymbol
24
27
, POSIXTime (POSIXTime )
25
28
, PubKeyHash
29
+ , ScriptHash
26
30
, TxId
27
31
, TxInfo (.. )
28
32
, adaSymbol
@@ -64,6 +68,9 @@ genKeyPair =
64
68
genIntegerGreaterThan :: Integer -> Gen Integer
65
69
genIntegerGreaterThan a = arbitrary @ (Positive Integer ) <&> \ (Positive b) -> a + b
66
70
71
+ genScriptAddress :: Gen Address
72
+ genScriptAddress = flip Address Nothing . ScriptCredential <$> arbitrary @ ScriptHash
73
+
67
74
genTxInfoTemplate :: Gen TxInfo
68
75
genTxInfoTemplate = do
69
76
txInfoFeeAda <- arbitrary @ Integer
@@ -149,7 +156,7 @@ genValidAuctionTerms :: PublicKey -> Gen AuctionTerms
149
156
genValidAuctionTerms vkey = do
150
157
GenNonAdaValue @ Positive at'AuctionLot <- arbitrary
151
158
let (at'SellerVk, at'SellerPkh) = hashVerificationKey vkey
152
- at'Delegates <- vector @ PubKeyHash =<< chooseInt (0 , 10 )
159
+ at'Delegates <- vector @ PubKeyHash =<< chooseInt (1 , 10 )
153
160
154
161
let chooseInterval = POSIXTime <$> chooseInteger (1 , 604_800_000 ) -- up to 1 week in msec
155
162
(biddingPeriod, purchasePeriod, penaltyPeriod) <-
0 commit comments