check minimum stake amount while voting
This commit is contained in:
parent
90c1e6b076
commit
971d258ad5
10 changed files with 88 additions and 49 deletions
|
|
@ -195,7 +195,7 @@ invalidNewGovernorDatum =
|
|||
GovernorDatum
|
||||
{ proposalThresholds =
|
||||
def
|
||||
{ vote = Tagged (-1)
|
||||
{ toVoting = Tagged (-1)
|
||||
}
|
||||
, nextProposalId = ProposalId 42
|
||||
, proposalTimings = def
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ validGovernorOutputDatum =
|
|||
}
|
||||
|
||||
invalidProposalThresholds :: ProposalThresholds
|
||||
invalidProposalThresholds = ProposalThresholds (-1) (-1) (-1)
|
||||
invalidProposalThresholds = ProposalThresholds (-1) (-1) (-1) (-1)
|
||||
|
||||
invalidMaxTimeRangeWidth :: MaxTimeRangeWidth
|
||||
invalidMaxTimeRangeWidth = MaxTimeRangeWidth 0
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ mkGovernorOutputDatum ValueInvalid =
|
|||
ProposalThresholds
|
||||
{ execute = -1
|
||||
, create = -1
|
||||
, toVoting = -1
|
||||
, vote = -1
|
||||
}
|
||||
in Just $
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ getNextState = \case
|
|||
-- | Calculate the number of GTs per stake in order to exceed the minimum limit.
|
||||
compPerStakeGTsForDraft :: NumStake -> Integer
|
||||
compPerStakeGTsForDraft nCosigners =
|
||||
untag (def :: ProposalThresholds).vote
|
||||
untag (def :: ProposalThresholds).toVoting
|
||||
`div` fromIntegral nCosigners + 1
|
||||
|
||||
dummyDatum :: ()
|
||||
|
|
@ -944,7 +944,7 @@ mkInsufficientCosignsBundle nCosigners nEffects =
|
|||
}
|
||||
where
|
||||
insuffcientPerStakeGTs =
|
||||
untag (def :: ProposalThresholds).vote
|
||||
untag (def :: ProposalThresholds).toVoting
|
||||
`div` fromIntegral nCosigners - 1
|
||||
template = mkValidToNextStateBundle nCosigners nEffects False Draft
|
||||
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ module Sample.Proposal.Vote (
|
|||
moreThanOneProposals,
|
||||
invalidLocks,
|
||||
destroyStakes,
|
||||
insufficientAmount,
|
||||
insufficientAmount1,
|
||||
) where
|
||||
|
||||
import Agora.Governor (Governor (..))
|
||||
|
|
@ -526,3 +528,27 @@ destroyStakes =
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
insufficientAmount :: ParameterBundle
|
||||
insufficientAmount =
|
||||
ownerVoteWithSignleStake
|
||||
{ stakeParameters =
|
||||
ownerVoteWithSignleStake.stakeParameters
|
||||
{ stakeInputParameters =
|
||||
ownerVoteWithSignleStake.stakeParameters.stakeInputParameters
|
||||
{ perStakeGTs = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
insufficientAmount1 :: ParameterBundle
|
||||
insufficientAmount1 =
|
||||
ownerVoteWithMultipleStakes
|
||||
{ stakeParameters =
|
||||
ownerVoteWithMultipleStakes.stakeParameters
|
||||
{ stakeInputParameters =
|
||||
ownerVoteWithMultipleStakes.stakeParameters.stakeInputParameters
|
||||
{ perStakeGTs = 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -189,6 +189,7 @@ instance Default ProposalThresholds where
|
|||
ProposalThresholds
|
||||
{ execute = Tagged 1000
|
||||
, create = Tagged 1
|
||||
, toVoting = Tagged 100
|
||||
, vote = Tagged 100
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue