Skip to content

Add Democracy Electorate Configuration#162

Merged
lrazovic merged 3 commits into
mainfrom
feature/update-electorate-calculation
Feb 8, 2024
Merged

Add Democracy Electorate Configuration#162
lrazovic merged 3 commits into
mainfrom
feature/update-electorate-calculation

Conversation

@vstam1

@vstam1 vstam1 commented Feb 8, 2024

Copy link
Copy Markdown
Contributor

No description provided.

@vstam1 vstam1 requested review from JuaniRios and lrazovic and removed request for lrazovic February 8, 2024 14:36

@JuaniRios JuaniRios left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Makes sense

@lrazovic lrazovic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice hotfix!

I don't think it makes a big difference, but what about using the fungible API to get the treasuries balance as stated here?

diff --git a/runtimes/base/src/lib.rs b/runtimes/base/src/lib.rs
index 29b651b..5116cfa 100644
--- a/runtimes/base/src/lib.rs
+++ b/runtimes/base/src/lib.rs
@@ -24,7 +24,7 @@ extern crate frame_benchmarking;
 use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
 use frame_support::{
 	construct_runtime, parameter_types,
-	traits::{fungible::Credit, tokens, ConstU32, Contains, EitherOfDiverse, InstanceFilter, PrivilegeCmp},
+	traits::{fungible::{Credit, Inspect}, tokens, ConstU32, Contains, EitherOfDiverse, InstanceFilter, PrivilegeCmp},
 	weights::{ConstantMultiplier, Weight},
 };
 use frame_system::{EnsureRoot, EnsureSigned};
@@ -489,8 +489,8 @@ pub struct Electorate;
 impl GetElectorate<Balance> for Electorate {
 	fn get_electorate() -> Balance {
 		let total_issuance = Balances::total_issuance();
-		let growth_treasury_balance = Balances::free_balance(Treasury::account_id());
-		let protocol_treasury_balance = Balances::free_balance(PayMaster::get());
+		let growth_treasury_balance = Balances::balance(&Treasury::account_id());
+		let protocol_treasury_balance = Balances::balance(&PayMaster::get());
 		total_issuance.saturating_sub(growth_treasury_balance).saturating_sub(protocol_treasury_balance)
 	}
 }

@lrazovic lrazovic self-requested a review February 8, 2024 15:14

@lrazovic lrazovic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@lrazovic lrazovic merged commit 5326bab into main Feb 8, 2024
@JuaniRios JuaniRios deleted the feature/update-electorate-calculation branch March 26, 2024 08:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants