Skip to content
Snippets Groups Projects
Commit cf81e1db authored by Gav's avatar Gav
Browse files

Deposits, not fees.

parent e07aef77
No related merge requests found
......@@ -96,7 +96,7 @@ pub fn launch_period() -> BlockNumber {
}
/// The public proposals. Unsorted.
pub fn public_props() -> Vec<(PropIndex, Proposal, Balance)> {
pub fn public_props() -> Vec<(PropIndex, Proposal)> {
storage::get_or_default(PUBLIC_PROPS)
}
......@@ -240,10 +240,15 @@ pub mod internal {
.enumerate()
.max_by_key(|x| locked_for((x.1).0))
{
let (prop_index, proposal, _) = public_props.swap_remove(winner_index);
storage::kill(&prop_index.to_keyed_vec(DEPOSIT_OF));
let (prop_index, proposal) = public_props.swap_remove(winner_index);
let (deposit, depositors): (Balance, Vec<AccountId>) =
storage::take(&prop_index.to_keyed_vec(DEPOSIT_OF))
.expect("depositors always exist for current proposals");
// refund depositors
for d in &depositors {
staking::internal::set_balance(d, staking::balance(d) + deposit);
}
storage::put(PUBLIC_PROPS, &public_props);
inject_referendum(now + voting_period(), proposal, VoteThreshold::SuperMajorityApprove);
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment