mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-21 19:05:41 +00:00
Backport all v0.6 changes to master... (#552)
* Bump Substrate and versions (#531) * Bump versions * Build fix. * Enable governance (#536) * Enable governance * Tweak a few parameters * Bump substrate, versions. (#538) * Bump substrate, versions. * Build fix * Bump rpc deps (#537) * Update to latest sub * Revert branch update * Update. * Update tests. * Ignore warnings in tests. * Revert substrate (#540) * Version bump * Bump Substrate, versions. (#542) * Bump Substrate, versions. Also revert the enabling of democracy * Build fix * Bump Substrate (#544) * Bump Substrate * Fix * A few tidyups * Bump Substrate (#547) * Bump Substrate * Another bump * Fixed build for new block_import API * Enable grandpa migration. (#549) * Enable grandpa migration. * Bump runtime version
This commit is contained in:
committed by
Bastian Köcher
parent
88150e83d2
commit
bd79b34bb3
@@ -67,8 +67,9 @@
|
||||
//! funds ultimately end up in module's fund sub-account.
|
||||
|
||||
use srml_support::{
|
||||
decl_module, decl_storage, decl_event, storage::child, ensure,
|
||||
traits::{Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement}
|
||||
decl_module, decl_storage, decl_event, storage::child, ensure, traits::{
|
||||
Currency, Get, OnUnbalanced, WithdrawReason, ExistenceRequirement::AllowDeath
|
||||
}
|
||||
};
|
||||
use system::ensure_signed;
|
||||
use sr_primitives::{ModuleId, weights::SimpleDispatchInfo,
|
||||
@@ -204,12 +205,8 @@ decl_module! {
|
||||
ensure!(end > <system::Module<T>>::block_number(), "end must be in the future");
|
||||
|
||||
let deposit = T::SubmissionDeposit::get();
|
||||
let imb = T::Currency::withdraw(
|
||||
&owner,
|
||||
deposit,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath,
|
||||
)?;
|
||||
let transfer = WithdrawReason::Transfer.into();
|
||||
let imb = T::Currency::withdraw(&owner, deposit, transfer, AllowDeath)?;
|
||||
|
||||
let index = FundCount::get();
|
||||
let next_index = index.checked_add(1).ok_or("overflow when adding fund")?;
|
||||
@@ -250,7 +247,7 @@ decl_module! {
|
||||
let now = <system::Module<T>>::block_number();
|
||||
ensure!(fund.end > now, "contribution period ended");
|
||||
|
||||
T::Currency::transfer(&who, &Self::fund_account_id(index), value)?;
|
||||
T::Currency::transfer(&who, &Self::fund_account_id(index), value, AllowDeath)?;
|
||||
|
||||
let balance = Self::contribution_get(index, &who);
|
||||
let balance = balance.saturating_add(value);
|
||||
@@ -375,12 +372,10 @@ decl_module! {
|
||||
ensure!(balance > Zero::zero(), "no contributions stored");
|
||||
|
||||
// Avoid using transfer to ensure we don't pay any fees.
|
||||
let _ = T::Currency::resolve_into_existing(&who, T::Currency::withdraw(
|
||||
&Self::fund_account_id(index),
|
||||
balance,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath
|
||||
)?);
|
||||
let fund_account = &Self::fund_account_id(index);
|
||||
let transfer = WithdrawReason::Transfer.into();
|
||||
let imbalance = T::Currency::withdraw(fund_account, balance, transfer, AllowDeath)?;
|
||||
let _ = T::Currency::resolve_into_existing(&who, imbalance);
|
||||
|
||||
Self::contribution_kill(index, &who);
|
||||
fund.raised = fund.raised.saturating_sub(balance);
|
||||
@@ -404,19 +399,12 @@ decl_module! {
|
||||
let account = Self::fund_account_id(index);
|
||||
|
||||
// Avoid using transfer to ensure we don't pay any fees.
|
||||
let _ = T::Currency::resolve_into_existing(&fund.owner, T::Currency::withdraw(
|
||||
&account,
|
||||
fund.deposit,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath
|
||||
)?);
|
||||
let transfer = WithdrawReason::Transfer.into();
|
||||
let imbalance = T::Currency::withdraw(&account, fund.deposit, transfer, AllowDeath)?;
|
||||
let _ = T::Currency::resolve_into_existing(&fund.owner, imbalance);
|
||||
|
||||
T::OrphanedFunds::on_unbalanced(T::Currency::withdraw(
|
||||
&account,
|
||||
fund.raised,
|
||||
WithdrawReason::Transfer.into(),
|
||||
ExistenceRequirement::AllowDeath
|
||||
)?);
|
||||
let imbalance = T::Currency::withdraw(&account, fund.raised, transfer, AllowDeath)?;
|
||||
T::OrphanedFunds::on_unbalanced(imbalance);
|
||||
|
||||
Self::crowdfund_kill(index);
|
||||
<Funds<T>>::remove(index);
|
||||
|
||||
Reference in New Issue
Block a user