Apply governor mutation based on existing datum
This commit is contained in:
parent
9e18c294f8
commit
ad80e9f685
3 changed files with 71 additions and 21 deletions
|
|
@ -86,10 +86,10 @@ effectRef =
|
|||
1
|
||||
|
||||
-- | The input effect datum in 'mkEffectTransaction'.
|
||||
mkEffectDatum :: GovernorDatum -> MutateGovernorDatum
|
||||
mkEffectDatum newGovDatum =
|
||||
mkEffectDatum :: GovernorDatum -> GovernorDatum -> MutateGovernorDatum
|
||||
mkEffectDatum oldGovDatum newGovDatum =
|
||||
MutateGovernorDatum
|
||||
{ governorRef = govRef
|
||||
{ oldDatum = oldGovDatum
|
||||
, newDatum = newGovDatum
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ mkEffectTxInfo newGovDatum =
|
|||
|
||||
-- The effect should update 'nextProposalId'
|
||||
effectInputDatum' :: MutateGovernorDatum
|
||||
effectInputDatum' = mkEffectDatum newGovDatum
|
||||
effectInputDatum' = mkEffectDatum governorInputDatum' newGovDatum
|
||||
effectInputDatum :: Datum
|
||||
effectInputDatum = Datum $ toBuiltinData effectInputDatum'
|
||||
effectInput :: TxOut
|
||||
|
|
|
|||
|
|
@ -47,7 +47,16 @@ specs =
|
|||
, effectSucceedsWith
|
||||
"effect validator should pass"
|
||||
effectValidator
|
||||
(mkEffectDatum validNewGovernorDatum)
|
||||
( mkEffectDatum
|
||||
( GovernorDatum
|
||||
def
|
||||
(ProposalId 0)
|
||||
def
|
||||
def
|
||||
3
|
||||
)
|
||||
validNewGovernorDatum
|
||||
)
|
||||
(ScriptContext (mkEffectTxInfo validNewGovernorDatum) (Spending effectRef))
|
||||
]
|
||||
, group
|
||||
|
|
@ -70,7 +79,16 @@ specs =
|
|||
, effectFailsWith
|
||||
"effect validator should fail"
|
||||
effectValidator
|
||||
(mkEffectDatum validNewGovernorDatum)
|
||||
( mkEffectDatum
|
||||
( GovernorDatum
|
||||
def
|
||||
(ProposalId 0)
|
||||
def
|
||||
def
|
||||
3
|
||||
)
|
||||
validNewGovernorDatum
|
||||
)
|
||||
(ScriptContext (mkEffectTxInfo invalidNewGovernorDatum) (Spending effectRef))
|
||||
]
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue