countingVote,create,startVoting to execute,create,vote
Let's embrace consistancy between Haskell types and Plutarch types.
This commit is contained in:
parent
9090b7c84e
commit
c98f39c6aa
7 changed files with 18 additions and 18 deletions
|
|
@ -185,7 +185,7 @@ invalidNewGovernorDatum =
|
|||
GovernorDatum
|
||||
{ proposalThresholds =
|
||||
def
|
||||
{ countVoting = Tagged (-1)
|
||||
{ vote = Tagged (-1)
|
||||
}
|
||||
, nextProposalId = ProposalId 42
|
||||
, proposalTimings = def
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ advanceProposalSuccess params =
|
|||
outcome0WinningVotes =
|
||||
ProposalVotes $
|
||||
updateMap
|
||||
(\_ -> Just $ untag (def :: ProposalThresholds).countVoting + 1)
|
||||
(\_ -> Just $ untag (def :: ProposalThresholds).vote + 1)
|
||||
(ResultTag 0)
|
||||
emptyVotes'
|
||||
|
||||
|
|
@ -611,7 +611,7 @@ advanceProposalFailureTimeout params =
|
|||
outcome0WinningVotes =
|
||||
ProposalVotes $
|
||||
updateMap
|
||||
(\_ -> Just $ untag (def :: ProposalThresholds).countVoting + 1)
|
||||
(\_ -> Just $ untag (def :: ProposalThresholds).vote + 1)
|
||||
(ResultTag 0)
|
||||
emptyVotes'
|
||||
|
||||
|
|
@ -720,7 +720,7 @@ advanceFinishedPropsoal =
|
|||
outcome0WinningVotes =
|
||||
ProposalVotes $
|
||||
AssocMap.fromList
|
||||
[ (ResultTag 0, untag (def :: ProposalThresholds).countVoting + 1)
|
||||
[ (ResultTag 0, untag (def :: ProposalThresholds).vote + 1)
|
||||
, (ResultTag 1, 0)
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -189,9 +189,9 @@ proposalValidatorAddress = scriptHashAddress proposalValidatorHash
|
|||
instance Default ProposalThresholds where
|
||||
def =
|
||||
ProposalThresholds
|
||||
{ countVoting = Tagged 1000
|
||||
{ execute = Tagged 1000
|
||||
, create = Tagged 1
|
||||
, startVoting = Tagged 10
|
||||
, vote = Tagged 10
|
||||
}
|
||||
|
||||
authorityToken :: AuthorityToken
|
||||
|
|
|
|||
|
|
@ -185,7 +185,7 @@ specs =
|
|||
( ResultTag 0
|
||||
, case initialState of
|
||||
Draft -> 0
|
||||
_ -> untag (def :: ProposalThresholds).countVoting + 1
|
||||
_ -> untag (def :: ProposalThresholds).vote + 1
|
||||
)
|
||||
, (ResultTag 1, 0)
|
||||
]
|
||||
|
|
@ -232,7 +232,7 @@ specs =
|
|||
( ResultTag 0
|
||||
, case initialState of
|
||||
Draft -> 0
|
||||
_ -> untag (def :: ProposalThresholds).countVoting + 1
|
||||
_ -> untag (def :: ProposalThresholds).vote + 1
|
||||
)
|
||||
, (ResultTag 1, 0)
|
||||
]
|
||||
|
|
@ -301,7 +301,7 @@ specs =
|
|||
, votes =
|
||||
ProposalVotes
|
||||
( AssocMap.fromList
|
||||
[ (ResultTag 0, untag (def :: ProposalThresholds).countVoting + 1)
|
||||
[ (ResultTag 0, untag (def :: ProposalThresholds).vote + 1)
|
||||
, (ResultTag 1, 0)
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -189,11 +189,11 @@ governorDatumValid = phoistAcyclic $
|
|||
plam $ \datum -> unTermCont $ do
|
||||
thresholds <-
|
||||
tcont $
|
||||
pletFields @'["execute", "draft", "vote"] $
|
||||
pletFields @'["execute", "create", "vote"] $
|
||||
pfield @"proposalThresholds" # datum
|
||||
|
||||
PDiscrete execute' <- pmatchC thresholds.execute
|
||||
PDiscrete draft' <- pmatchC thresholds.draft
|
||||
PDiscrete draft' <- pmatchC thresholds.create
|
||||
PDiscrete vote' <- pmatchC thresholds.vote
|
||||
|
||||
execute <- tclet $ pextract # execute'
|
||||
|
|
|
|||
|
|
@ -140,14 +140,14 @@ PlutusTx.makeIsDataIndexed ''ProposalStatus [('Draft, 0), ('VotingReady, 1), ('L
|
|||
to 'Proposal's when they are created.
|
||||
-}
|
||||
data ProposalThresholds = ProposalThresholds
|
||||
{ countVoting :: Tagged GTTag Integer
|
||||
{ execute :: Tagged GTTag Integer
|
||||
-- ^ How much GT minimum must a particular 'ResultTag' accumulate for it to pass.
|
||||
, create :: Tagged GTTag Integer
|
||||
-- ^ How much GT required to "create" a proposal.
|
||||
--
|
||||
-- It is recommended this be a high enough amount, in order to prevent DOS from bad
|
||||
-- actors.
|
||||
, startVoting :: Tagged GTTag Integer
|
||||
, vote :: Tagged GTTag Integer
|
||||
-- ^ How much GT required to allow voting to happen.
|
||||
-- (i.e. to move into 'VotingReady')
|
||||
}
|
||||
|
|
@ -327,7 +327,7 @@ newtype PProposalThresholds (s :: S) = PProposalThresholds
|
|||
s
|
||||
( PDataRecord
|
||||
'[ "execute" ':= PDiscrete GTTag
|
||||
, "draft" ':= PDiscrete GTTag
|
||||
, "create" ':= PDiscrete GTTag
|
||||
, "vote" ':= PDiscrete GTTag
|
||||
]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,11 +13,11 @@ Agora/Proposal/validator/cosignature/stake,162540553,402961,4561
|
|||
Agora/Proposal/validator/voting/proposal,181998338,491168,5652
|
||||
Agora/Proposal/validator/voting/stake,127693475,328703,4614
|
||||
Agora/Proposal/validator/advancing/successfully advance to next state/Draft -> VotringReady,98071575,260351,5030
|
||||
Agora/Proposal/validator/advancing/successfully advance to next state/VotingReady -> Locked,97228153,258848,5039
|
||||
Agora/Proposal/validator/advancing/successfully advance to next state/Locked -> Finished,98924620,262454,5039
|
||||
Agora/Proposal/validator/advancing/successfully advance to next state/VotingReady -> Locked,97228153,258848,5033
|
||||
Agora/Proposal/validator/advancing/successfully advance to next state/Locked -> Finished,98924620,262454,5033
|
||||
Agora/Proposal/validator/advancing/successfully advance to failed state: timeout/Draft -> Finished,96941774,257621,5032
|
||||
Agora/Proposal/validator/advancing/successfully advance to failed state: timeout/VotingReady -> Finished,95532863,254916,5039
|
||||
Agora/Proposal/validator/advancing/successfully advance to failed state: timeout/Locked -> Finished,96663841,257320,5039
|
||||
Agora/Proposal/validator/advancing/successfully advance to failed state: timeout/VotingReady -> Finished,95532863,254916,5033
|
||||
Agora/Proposal/validator/advancing/successfully advance to failed state: timeout/Locked -> Finished,96663841,257320,5033
|
||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct simple,21017788,55883,806
|
||||
Agora/AuthorityToken/singleAuthorityTokenBurned/Correct many inputs,33204186,88241,900
|
||||
Agora/Treasury/Validator/Positive/Allows for effect changes,29938856,79744,1841
|
||||
|
|
|
|||
|
Loading…
Add table
Add a link
Reference in a new issue