naming
This commit is contained in:
parent
13c72a6180
commit
14b8d30d57
1 changed files with 20 additions and 20 deletions
|
|
@ -341,18 +341,18 @@ governorValidator gov =
|
||||||
let oldParams' = pfromData @PGovernorDatum $ punsafeCoerce datum'
|
let oldParams' = pfromData @PGovernorDatum $ punsafeCoerce datum'
|
||||||
oldParams <- pletFields @'["proposalThresholds", "nextProposalId"] oldParams'
|
oldParams <- pletFields @'["proposalThresholds", "nextProposalId"] oldParams'
|
||||||
|
|
||||||
let ownInputDatumNFTAmount = stateTokenValueOf # ownInput.value
|
let ownInputGSTAmount = stateTokenValueOf # ownInput.value
|
||||||
passert "Own input should have exactly one state token" $
|
passert "Own input should have exactly one state token" $
|
||||||
ownInputDatumNFTAmount #== 1
|
ownInputGSTAmount #== 1
|
||||||
|
|
||||||
ownOutputs <- plet $ findOutputsToAddress # txInfo' # selfAddress
|
ownOutputs <- plet $ findOutputsToAddress # txInfo' # selfAddress
|
||||||
passert "Exactly one utxo should be sent to the governor" $
|
passert "Exactly one utxo should be sent to the governor" $
|
||||||
plength # ownOutputs #== 1
|
plength # ownOutputs #== 1
|
||||||
|
|
||||||
ownOutput <- pletFields @'["value", "datumHash"] $ phead # ownOutputs
|
ownOutput <- pletFields @'["value", "datumHash"] $ phead # ownOutputs
|
||||||
let ownOuputDatumNFTAmount = stateTokenValueOf # ownOutput.value
|
let ownOuputGSTAmount = stateTokenValueOf # ownOutput.value
|
||||||
passert "State token should stay at governor's address" $
|
passert "State token should stay at governor's address" $
|
||||||
ownOuputDatumNFTAmount #== 1
|
ownOuputGSTAmount #== 1
|
||||||
passert "Output utxo to governor should have datum" $
|
passert "Output utxo to governor should have datum" $
|
||||||
pisDJust # ownOutput.datumHash
|
pisDJust # ownOutput.datumHash
|
||||||
|
|
||||||
|
|
@ -400,23 +400,23 @@ governorValidator gov =
|
||||||
passert "Proposal datum must be valid" $
|
passert "Proposal datum must be valid" $
|
||||||
proposalDatumValid # outputProposalDatum'
|
proposalDatumValid # outputProposalDatum'
|
||||||
|
|
||||||
proposalDatum <-
|
outputProposalDatum <-
|
||||||
pletFields
|
pletFields
|
||||||
@'["id", "status", "cosigners", "thresholds", "votes"]
|
@'["id", "status", "cosigners", "thresholds", "votes"]
|
||||||
outputProposalDatum'
|
outputProposalDatum'
|
||||||
|
|
||||||
passert "Invalid proposal id in proposal datum" $
|
passert "Invalid proposal id in proposal datum" $
|
||||||
proposalDatum.id #== oldParams.nextProposalId
|
outputProposalDatum.id #== oldParams.nextProposalId
|
||||||
|
|
||||||
passert "Invalid thresholds in proposal datum" $
|
passert "Invalid thresholds in proposal datum" $
|
||||||
proposalDatum.thresholds #== oldParams.proposalThresholds
|
outputProposalDatum.thresholds #== oldParams.proposalThresholds
|
||||||
|
|
||||||
passert "Initial proposal votes should be empty" $
|
passert "Initial proposal votes should be empty" $
|
||||||
pnull #$ pto $ pto $ pfromData proposalDatum.votes
|
pnull #$ pto $ pto $ pfromData outputProposalDatum.votes
|
||||||
|
|
||||||
-- TODO: should we check cosigners here?
|
-- TODO: should we check cosigners here?
|
||||||
|
|
||||||
passert "Proposal state should be draft" $ proposalDatum.status #== pconstantData Draft
|
passert "Proposal state should be draft" $ outputProposalDatum.status #== pconstantData Draft
|
||||||
|
|
||||||
popaque $ pconstant ()
|
popaque $ pconstant ()
|
||||||
PMintGATs _ -> P.do
|
PMintGATs _ -> P.do
|
||||||
|
|
@ -476,7 +476,7 @@ governorValidator gov =
|
||||||
passert "Proposal must be in executable state in order to execute effects" $
|
passert "Proposal must be in executable state in order to execute effects" $
|
||||||
inputProposalDatum.status #== pconstantData Executable
|
inputProposalDatum.status #== pconstantData Executable
|
||||||
|
|
||||||
let expectedOutputDatum =
|
let expectedOutputProposalDatum =
|
||||||
pforgetData $
|
pforgetData $
|
||||||
pdata $
|
pdata $
|
||||||
pcon $
|
pcon $
|
||||||
|
|
@ -489,7 +489,7 @@ governorValidator gov =
|
||||||
#$ pdcons @"votes" # inputProposalDatum.votes # pdnil
|
#$ pdcons @"votes" # inputProposalDatum.votes # pdnil
|
||||||
|
|
||||||
passert "Unexpected output proposal datum" $
|
passert "Unexpected output proposal datum" $
|
||||||
pforgetData (pdata outputProposalDatum') #== expectedOutputDatum
|
pforgetData (pdata outputProposalDatum') #== expectedOutputProposalDatum
|
||||||
|
|
||||||
-- TODO: anything else to check here?
|
-- TODO: anything else to check here?
|
||||||
|
|
||||||
|
|
@ -535,7 +535,7 @@ governorValidator gov =
|
||||||
# phoistAcyclic
|
# phoistAcyclic
|
||||||
( plam
|
( plam
|
||||||
( \((pfield @"value" #) -> value) ->
|
( \((pfield @"value" #) -> value) ->
|
||||||
0 #< psymbolValueOf # pgatSym # value
|
0 #< psymbolValueOf # pgatSymbol # value
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# pfromData txInfo.outputs
|
# pfromData txInfo.outputs
|
||||||
|
|
@ -561,7 +561,7 @@ governorValidator gov =
|
||||||
mustBePJust # "Receiver is not in the effect list"
|
mustBePJust # "Receiver is not in the effect list"
|
||||||
#$ plookup # scriptHash # effects
|
#$ plookup # scriptHash # effects
|
||||||
|
|
||||||
passert "GAT must be tagged by the effect hash" $ authorityTokensValidIn # pgatSym # output'
|
passert "GAT must be tagged by the effect hash" $ authorityTokensValidIn # pgatSymbol # output'
|
||||||
passert "Unexpected datum" $ datumHash #== expectedDatumHash
|
passert "Unexpected datum" $ datumHash #== expectedDatumHash
|
||||||
pconstant ()
|
pconstant ()
|
||||||
)
|
)
|
||||||
|
|
@ -574,13 +574,13 @@ governorValidator gov =
|
||||||
# pconstant ()
|
# pconstant ()
|
||||||
# outputsWithGAT
|
# outputsWithGAT
|
||||||
PMutateGovernor _ -> P.do
|
PMutateGovernor _ -> P.do
|
||||||
popaque $ singleAuthorityTokenBurned pgatSym ctx.txInfo txInfo.mint
|
popaque $ singleAuthorityTokenBurned pgatSymbol ctx.txInfo txInfo.mint
|
||||||
where
|
where
|
||||||
stateTokenAssetClass :: AssetClass
|
stateTokenAssetClass :: AssetClass
|
||||||
stateTokenAssetClass = gstAssetClass gov
|
stateTokenAssetClass = gstAssetClass gov
|
||||||
|
|
||||||
proposalDatum :: Proposal
|
proposalParameters :: Proposal
|
||||||
proposalDatum =
|
proposalParameters =
|
||||||
Proposal
|
Proposal
|
||||||
{ governorSTAssetClass = stateTokenAssetClass
|
{ governorSTAssetClass = stateTokenAssetClass
|
||||||
}
|
}
|
||||||
|
|
@ -588,7 +588,7 @@ governorValidator gov =
|
||||||
proposalSymbol :: CurrencySymbol
|
proposalSymbol :: CurrencySymbol
|
||||||
proposalSymbol = mintingPolicySymbol policy
|
proposalSymbol = mintingPolicySymbol policy
|
||||||
where
|
where
|
||||||
policy = mkMintingPolicy $ proposalPolicy proposalDatum
|
policy = mkMintingPolicy $ proposalPolicy proposalParameters
|
||||||
|
|
||||||
pproposalSymbol :: Term s PCurrencySymbol
|
pproposalSymbol :: Term s PCurrencySymbol
|
||||||
pproposalSymbol = phoistAcyclic $ pconstant proposalSymbol
|
pproposalSymbol = phoistAcyclic $ pconstant proposalSymbol
|
||||||
|
|
@ -597,7 +597,7 @@ governorValidator gov =
|
||||||
proposalValidatorAddress = Address (ScriptCredential hash) Nothing
|
proposalValidatorAddress = Address (ScriptCredential hash) Nothing
|
||||||
where
|
where
|
||||||
hash = validatorHash validator
|
hash = validatorHash validator
|
||||||
validator = mkValidator $ proposalValidator proposalDatum
|
validator = mkValidator $ proposalValidator proposalParameters
|
||||||
|
|
||||||
pproposalValidatorAddress :: Term s PAddress
|
pproposalValidatorAddress :: Term s PAddress
|
||||||
pproposalValidatorAddress = phoistAcyclic $ pconstant proposalValidatorAddress
|
pproposalValidatorAddress = phoistAcyclic $ pconstant proposalValidatorAddress
|
||||||
|
|
@ -605,8 +605,8 @@ governorValidator gov =
|
||||||
stateTokenValueOf :: Term s (PValue :--> PInteger)
|
stateTokenValueOf :: Term s (PValue :--> PInteger)
|
||||||
stateTokenValueOf = passetClassValueOf' stateTokenAssetClass
|
stateTokenValueOf = passetClassValueOf' stateTokenAssetClass
|
||||||
|
|
||||||
pgatSym :: Term s PCurrencySymbol
|
pgatSymbol :: Term s PCurrencySymbol
|
||||||
pgatSym = phoistAcyclic $ pconstant $ gatSymbol gov
|
pgatSymbol = phoistAcyclic $ pconstant $ gatSymbol gov
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue