@@ -26,7 +26,7 @@ import Plutarch.Extra.Interval (pcontains)
2626import Plutarch.List (pmap )
2727import Plutarch.Monadic qualified as P
2828import Plutarch.Num (PNum (pnegate , (#+) ))
29- import Plutarch.Prelude (ClosedTerm , PAsData , PBuiltinList , PByteString , PData , PEq ((#==) ), PInteger , PListLike (pcons , phead , pnil ), PMaybe (PJust ), PPair (PPair ), PPartialOrd ((#<) , (#<=) ), Term , pcon , pconsBS , pconstant , pdata , pfield , pfoldl , pfromData , phoistAcyclic , plam , plet , pletFields , ptrace , ptraceError , (#) , (#$) , type (:--> ))
29+ import Plutarch.Prelude (ClosedTerm , PAsData , PBuiltinList , PByteString , PData , PEq ((#==) ), PInteger , PListLike (pcons , phead , pnil ), PMaybe (PJust ), PPair (PPair ), PPartialOrd ((#<) , (#<=) ), Term , pcon , pconsBS , pconstant , pfield , pfoldl , pfromData , phoistAcyclic , plam , plet , pletFields , ptrace , ptraceError , (#) , (#$) , type (:--> ))
3030import PlutusTx.Prelude (Group (inv ))
3131import Prelude (Monoid (mempty ), Semigroup ((<>) ), ($) , (.) )
3232
@@ -651,13 +651,18 @@ exampleConsumer = phoistAcyclic $
651651 _ <- plet $ pif ((pfstBuiltin # real'') #== 3 ) (popaque punit) (ptraceError " Expected a Plutus Constr 3 [123123, -3]" )
652652 _ <- plet $ pif (real''' #== pconstant [123123 , - 3 ]) (popaque punit) (ptraceError " Expected a Plutus Constr 3 [123123, -3]" )
653653
654- -- Take the "big_real" field in the Fact Statement and assert that it is 123 .123
654+ -- Take the "big_real" field in the Fact Statement and assert that it is 12300000000000000000000000 .123
655655 PJust big_real' <- pmatch $ plookup # pconstant " big_real" # factStatement
656656 big_real'' :: Term s (PBuiltinPair PInteger (PBuiltinList PData )) <- plet $ pasConstr # big_real'
657657 big_real''' :: Term s (PBuiltinList PInteger ) <- plet $ pmap # plam (pfromData . ptryFromData) # (psndBuiltin # big_real'')
658658 _ <- plet $ pif ((pfstBuiltin # big_real'') #== 3 ) (popaque punit) (ptraceError " Expected a Plutus Constr 3 [12300000000000000000000000123, -3]" )
659659 _ <- plet $ pif (big_real''' #== pconstant [12300000000000000000000000123 , - 3 ]) (popaque punit) (ptraceError " Expected a Plutus Constr 3 [12300000000000000000000000123, -3]" )
660660
661- ptrace " exampleConsumer: Must have a Fact Statement reference input from a trusted COOP Oracle" $ popaque punit
661+ -- Take the "string" field in the Fact Statement and assert that it is "Hello World"
662+ PJust string' <- pmatch $ plookup # pconstant " string" # factStatement
663+ string'' :: Term s PByteString <- plet $ pfromData $ ptryFromData string'
664+ _ <- plet $ pif (string'' #== pconstant " Hello World" ) (popaque punit) (ptraceError " Expected a Plutus Bytestring \" Hello World\" " )
665+
666+ ptrace " exampleConsumer: Everything worked!" $ popaque punit
662667 )
663668 (ptraceError " exampleConsumer: Must have a Fact Statement reference input from a trusted COOP Oracle" )
0 commit comments