Skip to content
Snippets Groups Projects
Commit 89f21b27 authored by Éloïs's avatar Éloïs
Browse files

fix(pallet-ud): SquareMoneyGrowthRate precision should be PerBill

parent 59ded47e
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ mod benchmarking;
use frame_support::traits::{tokens::ExistenceRequirement, Currency};
use sp_arithmetic::{
per_things::Permill,
per_things::Perbill,
traits::{One, Saturating, Zero},
};
use sp_runtime::traits::StaticLookup;
......@@ -71,7 +71,7 @@ pub mod pallet {
type MembersIds: Get<Vec<<Self as frame_system::Config>::AccountId>>;
#[pallet::constant]
/// Square of the money growth rate per ud reevaluation period
type SquareMoneyGrowthRate: Get<Permill>;
type SquareMoneyGrowthRate: Get<Perbill>;
#[pallet::constant]
/// Universal dividend creation period
type UdCreationPeriod: Get<Self::BlockNumber>;
......@@ -250,7 +250,7 @@ pub mod pallet {
}
fn reeval_ud_formula(
ud_t: BalanceOf<T>,
c_square: Permill,
c_square: Perbill,
monetary_mass: BalanceOf<T>,
mut members_count: BalanceOf<T>,
count_uds_beetween_two_reevals: BalanceOf<T>, // =(dt/udFrequency)
......
......@@ -97,7 +97,7 @@ impl pallet_balances::Config for Test {
parameter_types! {
pub const MembersCount: u64 = 3;
pub const SquareMoneyGrowthRate: Permill = Permill::from_percent(10);
pub const SquareMoneyGrowthRate: Perbill = Perbill::from_percent(10);
pub const UdCreationPeriod: BlockNumber = 2;
pub const UdReevalPeriod: BlockNumber = 8;
}
......
......@@ -18,7 +18,7 @@ use common_runtime::constants::*;
use common_runtime::{Balance, BlockNumber};
use frame_support::parameter_types;
use frame_support::weights::constants::WEIGHT_PER_SECOND;
use sp_arithmetic::Permill;
use sp_arithmetic::Perbill;
use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! {
......@@ -83,7 +83,7 @@ frame_support::parameter_types! {
// Universal dividend
parameter_types! {
// 0.002_381_440 = 0.0488^2
pub const SquareMoneyGrowthRate: Permill = Permill::from_parts(2_381_440);
pub const SquareMoneyGrowthRate: Perbill = Perbill::from_parts(2_381_440);
pub const UdCreationPeriod: BlockNumber = DAYS;
pub const UdReevalPeriod: BlockNumber = 2_620_800; // 86400 * 182 / 6
}
......
......@@ -18,7 +18,7 @@ use common_runtime::constants::*;
use common_runtime::{Balance, BlockNumber};
use frame_support::parameter_types;
use frame_support::weights::constants::WEIGHT_PER_SECOND;
use sp_arithmetic::Permill;
use sp_arithmetic::Perbill;
use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! {
......@@ -81,7 +81,7 @@ frame_support::parameter_types! {
// Universal dividend
parameter_types! {
// 0.002_381_440 = 0.0488^2
pub const SquareMoneyGrowthRate: Permill = Permill::from_parts(2_381_440);
pub const SquareMoneyGrowthRate: Perbill = Perbill::from_parts(2_381_440);
}
// Multisig
......
......@@ -18,7 +18,7 @@ use common_runtime::constants::*;
use common_runtime::{Balance, BlockNumber};
use frame_support::parameter_types;
use frame_support::weights::constants::WEIGHT_PER_SECOND;
use sp_arithmetic::Permill;
use sp_arithmetic::Perbill;
use sp_runtime::transaction_validity::TransactionPriority;
parameter_types! {
......@@ -83,7 +83,7 @@ frame_support::parameter_types! {
// Universal dividend
parameter_types! {
// 0.002_381_440 = 0.0488^2
pub const SquareMoneyGrowthRate: Permill = Permill::from_parts(2_381_440);
pub const SquareMoneyGrowthRate: Perbill = Perbill::from_parts(2_381_440);
pub const UdCreationPeriod: BlockNumber = DAYS;
pub const UdFirstReeval: BlockNumber = 2 * DAYS;
pub const UdReevalPeriod: BlockNumber = 100_800; // 86400 * 7 / 6
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment