@@ -66,6 +66,7 @@ import qualified Data.ByteString.Lazy.Char8 as LBS
66
66
67
67
import qualified Data.ByteString.Short as SBS
68
68
69
+ import Cardano.Ledger.Conway.Governance
69
70
import Cardano.Ledger.Conway.Scripts (ConwayPlutusPurpose (.. ))
70
71
import qualified Cardano.Ledger.TxIn as Ledger
71
72
import qualified Data.Map.Strict as Map
@@ -250,8 +251,8 @@ resolveRedeemers ioExtraPlutus mprices tx toCert =
250
251
Just (Right (ConwaySpending txIn)) -> handleTxInPtr rdmrIx (Alonzo. unAsItem txIn) rdmrMps
251
252
Just (Right (ConwayRewarding rwdAcnt)) -> handleRewardPtr rdmrIx (Alonzo. unAsItem rwdAcnt) rdmrMps
252
253
Just (Right (ConwayCertifying dcert)) -> handleCertPtr rdmrIx (toCert $ Alonzo. unAsItem dcert) rdmrMps
253
- Just (Right (ConwayVoting _ )) -> (rdmrMps, Nothing )
254
- Just (Right (ConwayProposing _ )) -> (rdmrMps, Nothing )
254
+ Just (Right (ConwayVoting voter )) -> (rdmrMps, Right <$> getConwayVotingScriptHash ( Alonzo. unAsItem voter) )
255
+ Just (Right (ConwayProposing proposal )) -> (rdmrMps, Right <$> getConwayProposalScriptHash ( Alonzo. unAsItem proposal) )
255
256
Nothing -> (rdmrMps, Nothing )
256
257
257
258
(tag, idx) = getPurpose ptr
@@ -384,15 +385,20 @@ scriptHashCert cert = case cert of
384
385
Left scert -> scriptHashCertShelley scert
385
386
Right ccert -> scriptHashCertConway ccert
386
387
387
- -- TODO: Conway
388
388
scriptHashCertConway :: ConwayCert -> Maybe ByteString
389
- scriptHashCertConway _cert = Nothing
389
+ scriptHashCertConway cert = unScriptHash <$> getScriptWitnessTxCert cert
390
390
391
391
scriptHashCertShelley :: ShelleyCert -> Maybe ByteString
392
- scriptHashCertShelley cert =
393
- case cert of
394
- Shelley. ShelleyTxCertDelegCert (Shelley. ShelleyUnRegCert cred) ->
395
- getCredentialScriptHash cred
396
- Shelley. ShelleyTxCertDelegCert (Shelley. ShelleyDelegCert cred _) ->
397
- getCredentialScriptHash cred
398
- _ -> Nothing
392
+ scriptHashCertShelley cert = unScriptHash <$> getScriptWitnessTxCert cert
393
+
394
+ getConwayVotingScriptHash :: Voter StandardCrypto -> Maybe ByteString
395
+ getConwayVotingScriptHash = \ case
396
+ CommitteeVoter cred -> getCredentialScriptHash cred
397
+ DRepVoter cred -> getCredentialScriptHash cred
398
+ StakePoolVoter _ -> Nothing
399
+
400
+ getConwayProposalScriptHash :: EraCrypto era ~ StandardCrypto => ProposalProcedure era -> Maybe ByteString
401
+ getConwayProposalScriptHash pp = case pProcGovAction pp of
402
+ ParameterChange _ _ p -> unScriptHash <$> strictMaybeToMaybe p
403
+ TreasuryWithdrawals _ p -> unScriptHash <$> strictMaybeToMaybe p
404
+ _ -> Nothing
0 commit comments