Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
polkadot-sdk
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
parity
Mirrored projects
polkadot-sdk
Commits
6476f268
Commit
6476f268
authored
7 years ago
by
Gav
Browse files
Options
Downloads
Patches
Plain Diff
Introduce minimum deposit
parent
e8d38add
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
substrate/demo/runtime/src/runtime/democracy.rs
+10
-1
10 additions, 1 deletion
substrate/demo/runtime/src/runtime/democracy.rs
with
10 additions
and
1 deletion
substrate/demo/runtime/src/runtime/democracy.rs
+
10
−
1
View file @
6476f268
...
...
@@ -74,6 +74,7 @@ const PUBLIC_PROP_COUNT: &[u8] = b"dem:cou"; // PropIndex
const
PUBLIC_PROPS
:
&
[
u8
]
=
b"dem:pub"
;
// Vec<(PropIndex, Proposal)>
const
DEPOSIT_OF
:
&
[
u8
]
=
b"dem:dep:"
;
// PropIndex -> (Balance, Vec<AccountId>)
const
LAUNCH_PERIOD
:
&
[
u8
]
=
b"dem:lau"
;
// BlockNumber
const
MINIMUM_DEPOSIT
:
&
[
u8
]
=
b"dem:min"
;
// Balance
// referenda
const
VOTING_PERIOD
:
&
[
u8
]
=
b"dem:per"
;
// BlockNumber
...
...
@@ -83,6 +84,12 @@ const REFERENDUM_INFO_OF: &[u8] = b"dem:pro:"; // ReferendumIndex -> (BlockNumbe
const
VOTERS_FOR
:
&
[
u8
]
=
b"dem:vtr:"
;
// ReferendumIndex -> Vec<AccountId>
const
VOTE_OF
:
&
[
u8
]
=
b"dem:vot:"
;
// (ReferendumIndex, AccountId) -> bool
/// The minimum amount to be used as a deposit for a public referendum proposal.
pub
fn
minimum_deposit
()
->
Balance
{
storage
::
get
(
MINIMUM_DEPOSIT
)
.expect
(
"all core parameters of council module must be in place"
)
}
/// How often (in blocks) to check for new votes.
pub
fn
voting_period
()
->
BlockNumber
{
storage
::
get
(
VOTING_PERIOD
)
...
...
@@ -159,6 +166,7 @@ pub mod public {
/// Propose a sensitive action to be taken.
pub
fn
propose
(
signed
:
&
AccountId
,
proposal
:
&
Proposal
,
value
:
Balance
)
{
assert!
(
value
>=
minimum_deposit
());
let
b
=
staking
::
balance
(
signed
);
assert!
(
b
>=
value
);
...
...
@@ -321,7 +329,8 @@ mod tests {
twox_128
(
b"sta:vac"
)
.to_vec
()
=>
vec!
[]
.and
(
&
3u64
),
twox_128
(
b"sta:era"
)
.to_vec
()
=>
vec!
[]
.and
(
&
1u64
),
twox_128
(
LAUNCH_PERIOD
)
.to_vec
()
=>
vec!
[]
.and
(
&
1u64
),
twox_128
(
VOTING_PERIOD
)
.to_vec
()
=>
vec!
[]
.and
(
&
1u64
)
twox_128
(
VOTING_PERIOD
)
.to_vec
()
=>
vec!
[]
.and
(
&
1u64
),
twox_128
(
MINIMUM_DEPOSIT
)
.to_vec
()
=>
vec!
[]
.and
(
&
1u64
)
]
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment