0

I am filtering through transactions like this.

utxos <- Map.filter (isSuitable (cpFund cp)) <$> utxosAt scrAddress

isSuitable :: Integer -> ChainIndexTxOut -> Bool
isSuitable fundRound o = case _ciTxOutDatum o of
  Left _ -> False
  Right (Datum e) -> case PlutusTx.fromBuiltinData e of
    Nothing -> False
    Just d -> startFund d == fundRound 

This worked when my datum was set up like this

data StartDatum = StartDatum
 { startFund :: Integer
 , fundPrize :: Integer
 }deriving (Show)

After i change the datum to like this it does not work anymore

data DatumAction = Start StartDatum | Voting VotingDatum

data VotingDatum = VotingDatum
  { projectPubKey :: PaymentPubKeyHash
  , amount :: Integer
  , fund :: Integer
  , paymentKey :: PaymentPubKeyHash
  }deriving (Show)

data StartDatum = StartDatum
 { startFund :: Integer
 , fundPrize :: Integer
 }deriving (Show)

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.