Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

permit setting treasury pallet initial funding through genesis #7214

Merged
merged 1 commit into from
Oct 1, 2020

Conversation

pfcoder
Copy link
Contributor

@pfcoder pfcoder commented Sep 25, 2020

Treasury pallet will set initial balances to account ED, this will cause conflict if we want to set treasury initial funding in genesis, the change is to add a check before setting treasury balances to ED (only when balance is lower than ED)

);
let account_id = <Module<T, I>>::account_id();
let min = T::Currency::minimum_balance();
if T::Currency::free_balance(&account_id) < min {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you setting the initial treasury balance?

Why not adding a extra_genesis parameter that is a Option<Balance> and if that is None we set the initial balance to ED and otherwise to the given value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we set treasury pallet initial balance through genesis endowed_accounts, for example append Treasury::account_id(), if we use a new extra_genesis parameter to control the value in treasury pallet self, seems it will cause imbalance, we hope the Balances::total_issuance() could include this initial value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having Option<Balance> in treasury config is also good, but this way is fine too

@gui1117 gui1117 added A0-please_review Pull request needs code review. B3-apinoteworthy C1-low PR touches the given topic and has a low impact on builders. labels Oct 1, 2020
@bkchr bkchr merged commit d81e3ab into paritytech:master Oct 1, 2020
liuchengxu pushed a commit to liuchengxu/substrate that referenced this pull request Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. C1-low PR touches the given topic and has a low impact on builders.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants