@@ -22,30 +22,36 @@ open import Ledger.Dijkstra.Specification.Certs govStructure
2222
2323``` agda
2424data ScriptPurpose : Type where
25- Cert : DCert → ScriptPurpose
26- Rwrd : RewardAddress → ScriptPurpose
27- Mint : ScriptHash → ScriptPurpose
28- Spend : TxIn → ScriptPurpose
29- Vote : GovVoter → ScriptPurpose
30- Propose : GovProposal → ScriptPurpose
31- Guard : (TxId × ScriptHash) → ScriptPurpose
25+ Cert : DCert → ScriptPurpose
26+ Rwrd : RewardAddress → ScriptPurpose
27+ Mint : ScriptHash → ScriptPurpose
28+ Spend : TxIn → ScriptPurpose
29+ Vote : GovVoter → ScriptPurpose
30+ Propose : GovProposal → ScriptPurpose
31+ Guard : Credential → ScriptPurpose
3232```
3333
34+ Note that ` Guard c ` always indexes into * the current ` tx ` 's* ` txGuards ` :
35+
36+ + if ` tx : TopLevelTx ` , it indexes into the top-level guard set's list-view;
37+ + if ` tx : SubLevelTx ` , it indexes into the subTx's guard set's list-view.
38+
3439<!--
3540```agda
3641private variable
3742 ℓ : TxLevel
3843
3944rdptr : (Tx ℓ) → ScriptPurpose → Maybe (RedeemerPtr ℓ)
4045rdptr tx = λ where
41- (Cert h) → map (Cert ,_) $ indexOfDCert h txCerts
42- (Rwrd h) → map (Reward ,_) $ indexOfRewardAddress h txWithdrawals
43- (Mint h) → map (Mint ,_) $ indexOfPolicyId h (policies mint)
44- (Spend h) → map (Spend ,_) $ indexOfTxIn h txIns
45- (Vote h) → map (Vote ,_) $ indexOfVote h (map GovVote.voter txGovVotes)
46- (Propose h) → map (Propose ,_) $ indexOfProposal h txGovProposals
47- (Guard h) → map (Guard ,_) $ indexOfGuard h (getTxScripts tx)
48- where open TxBody (TxBodyOf tx)
46+ (Cert h) → map (Cert ,_) $ indexOfDCert h txCerts
47+ (Rwrd h) → map (Reward ,_) $ indexOfRewardAddress h txWithdrawals
48+ (Mint h) → map (Mint ,_) $ indexOfPolicyId h (policies mint)
49+ (Spend h) → map (Spend ,_) $ indexOfTxIn h txIns
50+ (Vote h) → map (Vote ,_) $ indexOfVote h (map GovVote.voter txGovVotes)
51+ (Propose h) → map (Propose ,_) $ indexOfProposal h txGovProposals
52+ (Guard c) → map (Guard ,_) $ indexOfGuard c (setToList txGuards)
53+ where open TxBody (TxBodyOf tx)
54+
4955-- getSubTxScripts : TopLevelTx → ℙ (TxId × ScriptHash)
5056
5157indexedRdmrs : (Tx ℓ) → ScriptPurpose → Maybe (Redeemer × ExUnits)
0 commit comments