Deposits, not fees.

This commit is contained in:
Gav
2018-03-03 19:01:39 +01:00
parent e07aef7766
commit cf81e1dbb6
@@ -96,7 +96,7 @@ pub fn launch_period() -> BlockNumber {
} }
/// The public proposals. Unsorted. /// 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) storage::get_or_default(PUBLIC_PROPS)
} }
@@ -240,10 +240,15 @@ pub mod internal {
.enumerate() .enumerate()
.max_by_key(|x| locked_for((x.1).0)) .max_by_key(|x| locked_for((x.1).0))
{ {
let (prop_index, proposal, _) = public_props.swap_remove(winner_index); let (prop_index, proposal) = public_props.swap_remove(winner_index);
storage::kill(&prop_index.to_keyed_vec(DEPOSIT_OF)); 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); storage::put(PUBLIC_PROPS, &public_props);
inject_referendum(now + voting_period(), proposal, VoteThreshold::SuperMajorityApprove); inject_referendum(now + voting_period(), proposal, VoteThreshold::SuperMajorityApprove);
} }
} }