use new utils to construct record
This commit is contained in:
parent
8ef9506cd6
commit
b44a007e72
1 changed files with 26 additions and 22 deletions
|
|
@ -56,6 +56,7 @@ import Agora.Proposal.Scripts (
|
||||||
proposalPolicy,
|
proposalPolicy,
|
||||||
proposalValidator,
|
proposalValidator,
|
||||||
)
|
)
|
||||||
|
import Agora.Record
|
||||||
import Agora.SafeMoney (GTTag)
|
import Agora.SafeMoney (GTTag)
|
||||||
import Agora.Stake (
|
import Agora.Stake (
|
||||||
PProposalLock (..),
|
PProposalLock (..),
|
||||||
|
|
@ -312,11 +313,11 @@ governorValidator gov =
|
||||||
PCreateProposal _ -> P.do
|
PCreateProposal _ -> P.do
|
||||||
let expectedNextProposalId = pgetNextProposalId # oldParams.nextProposalId
|
let expectedNextProposalId = pgetNextProposalId # oldParams.nextProposalId
|
||||||
expectedNewDatum =
|
expectedNewDatum =
|
||||||
pcon $
|
mkRecordConstr
|
||||||
PGovernorDatum $
|
PGovernorDatum
|
||||||
pdcons @"proposalThresholds" # oldParams.proposalThresholds
|
( #proposalThresholds .= oldParams.proposalThresholds
|
||||||
#$ pdcons @"nextProposalId" # pdata expectedNextProposalId # pdnil
|
.& #nextProposalId .= pdata expectedNextProposalId
|
||||||
|
)
|
||||||
passert "Unexpected governor state datum" $
|
passert "Unexpected governor state datum" $
|
||||||
newDatumData #== pforgetData (pdata expectedNewDatum)
|
newDatumData #== pforgetData (pdata expectedNewDatum)
|
||||||
|
|
||||||
|
|
@ -455,10 +456,11 @@ governorValidator gov =
|
||||||
phoistAcyclic $
|
phoistAcyclic $
|
||||||
plam
|
plam
|
||||||
( \pid rt' ->
|
( \pid rt' ->
|
||||||
let fields =
|
pdata $
|
||||||
pdcons @"vote" # rt'
|
mkRecordConstr
|
||||||
#$ pdcons @"proposalTag" # pdata pid # pdnil
|
PProposalLock
|
||||||
in pdata $ pcon $ PProposalLock fields
|
( #vote .= rt' .& #proposalTag .= pdata pid
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
expectedProposalLocks =
|
expectedProposalLocks =
|
||||||
|
|
@ -468,11 +470,12 @@ governorValidator gov =
|
||||||
expectedOutputDatum =
|
expectedOutputDatum =
|
||||||
pforgetData $
|
pforgetData $
|
||||||
pdata $
|
pdata $
|
||||||
pcon $
|
mkRecordConstr
|
||||||
PStakeDatum $
|
PStakeDatum
|
||||||
pdcons @"stakedAmount" # pdata stakeInputDatum.stakedAmount
|
( #stakedAmount .= stakeInputDatum.stakedAmount
|
||||||
#$ pdcons @"owner" # pdata stakeInputDatum.owner
|
.& #owner .= stakeInputDatum.owner
|
||||||
#$ pdcons @"lockedBy" # pdata expectedProposalLocks # pdnil
|
.& #lockedBy .= pdata expectedProposalLocks
|
||||||
|
)
|
||||||
|
|
||||||
passert "Unexpected stake output datum" $ expectedOutputDatum #== stakeOutputDatum
|
passert "Unexpected stake output datum" $ expectedOutputDatum #== stakeOutputDatum
|
||||||
|
|
||||||
|
|
@ -537,14 +540,15 @@ governorValidator gov =
|
||||||
let expectedOutputProposalDatum =
|
let expectedOutputProposalDatum =
|
||||||
pforgetData $
|
pforgetData $
|
||||||
pdata $
|
pdata $
|
||||||
pcon $
|
mkRecordConstr
|
||||||
PProposalDatum $
|
PProposalDatum
|
||||||
pdcons @"proposalId" # inputProposalDatum.proposalId
|
( #proposalId .= inputProposalDatum.proposalId
|
||||||
#$ pdcons @"effects" # inputProposalDatum.effects
|
.& #effects .= inputProposalDatum.effects
|
||||||
#$ pdcons @"status" # pdata (pcon $ PFinished pdnil)
|
.& #status .= pdata (pcon $ PFinished pdnil)
|
||||||
#$ pdcons @"cosigners" # inputProposalDatum.cosigners
|
.& #cosigners .= inputProposalDatum.cosigners
|
||||||
#$ pdcons @"thresholds" # inputProposalDatum.thresholds
|
.& #thresholds .= inputProposalDatum.thresholds
|
||||||
#$ pdcons @"votes" # inputProposalDatum.votes # pdnil
|
.& #votes .= inputProposalDatum.votes
|
||||||
|
)
|
||||||
|
|
||||||
passert "Unexpected output proposal datum" $
|
passert "Unexpected output proposal datum" $
|
||||||
pforgetData (pdata outputProposalDatum') #== expectedOutputProposalDatum
|
pforgetData (pdata outputProposalDatum') #== expectedOutputProposalDatum
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue