difftreelog
Merge pull request #1027 from UniqueNetwork/feature/promo-rate
in: master
feature(runtime): app promoi rate is changed
4 files changed
js-packages/tests/sub/appPromotion/appPromotion.test.tsdiffbeforeafterboth983function calculateIncome(base: bigint, iter = 0, calcPeriod: bigint = UNLOCKING_PERIOD): bigint {983function calculateIncome(base: bigint, iter = 0, calcPeriod: bigint = UNLOCKING_PERIOD): bigint {984 const DAY = 7200n;984 const DAY = 7200n;985 const ACCURACY = 1_000_000_000n;985 const ACCURACY = 1_000_000_000n;986 // 5n / 10_000n = 0.05% p/day986 // 453_256n / 1_000_000_000n = 0.0453256% /day987 const income = base + base * (ACCURACY * (calcPeriod * 5n) / (10_000n * DAY)) / ACCURACY ;987 const income = base + base * (ACCURACY * (calcPeriod * 453_256n) / (1_000_000_000n * DAY)) / ACCURACY ;988988989 if(iter > 1) {989 if(iter > 1) {990 return calculateIncome(income, iter - 1, calcPeriod);990 return calculateIncome(income, iter - 1, calcPeriod);pallets/collator-selection/src/mock.rsdiffbeforeafterboth208 pub const DefaultWeightToFeeCoefficient: u64 = 100_000;208 pub const DefaultWeightToFeeCoefficient: u64 = 100_000;209 pub const DefaultMinGasPrice: u64 = 100_000;209 pub const DefaultMinGasPrice: u64 = 100_000;210 pub const MaxXcmAllowedLocations: u32 = 16;210 pub const MaxXcmAllowedLocations: u32 = 16;211 pub AppPromotionDailyRate: Perbill = Perbill::from_rational(5u32, 10_000);211 pub AppPromotionDailyRate: Perbill = Perbill::from_parts(453_256);212 pub const DayRelayBlocks: u32 = 1;212 pub const DayRelayBlocks: u32 = 1;213 pub const LicenceBondIdentifier: [u8; 16] = *b"licenceidentifie";213 pub const LicenceBondIdentifier: [u8; 16] = *b"licenceidentifie";214}214}runtime/common/config/pallets/app_promotion.rsdiffbeforeafterboth15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use frame_support::{parameter_types, PalletId};17use frame_support::{parameter_types, PalletId};18use sp_arithmetic::Perbill;19use up_common::{18use up_common::{20 constants::{DAYS, RELAY_DAYS, UNIQUE},19 constants::{DAYS, RELAY_DAYS, UNIQUE},21 types::Balance,20 types::Balance,22};21};232223use super::AppPromotionDailyRate;24use crate::{24use crate::{25 runtime_common::config::pallets::{RelayChainBlockNumberProvider, TreasuryAccountId},25 runtime_common::config::pallets::{RelayChainBlockNumberProvider, TreasuryAccountId},26 Balances, BlockNumber, EvmContractHelpers, Maintenance, Runtime, RuntimeEvent, Unique,26 Balances, BlockNumber, EvmContractHelpers, Maintenance, Runtime, RuntimeEvent, Unique,32 pub const PendingInterval: BlockNumber = 7 * DAYS;32 pub const PendingInterval: BlockNumber = 7 * DAYS;33 pub const Nominal: Balance = UNIQUE;33 pub const Nominal: Balance = UNIQUE;34 pub const HoldAndFreezeIdentifier: [u8; 16] = *b"appstakeappstake";34 pub const HoldAndFreezeIdentifier: [u8; 16] = *b"appstakeappstake";35 pub IntervalIncome: Perbill = Perbill::from_rational(5u32, 10_000);36 pub MaintenanceMode: bool = Maintenance::is_enabled();35 pub MaintenanceMode: bool = Maintenance::is_enabled();37}36}383747 type RecalculationInterval = RecalculationInterval;46 type RecalculationInterval = RecalculationInterval;48 type PendingInterval = PendingInterval;47 type PendingInterval = PendingInterval;49 type Nominal = Nominal;48 type Nominal = Nominal;50 type IntervalIncome = IntervalIncome;49 type IntervalIncome = AppPromotionDailyRate;51 type RuntimeEvent = RuntimeEvent;50 type RuntimeEvent = RuntimeEvent;52 type FreezeIdentifier = HoldAndFreezeIdentifier;51 type FreezeIdentifier = HoldAndFreezeIdentifier;53 type IsMaintenanceModeEnabled = MaintenanceMode;52 type IsMaintenanceModeEnabled = MaintenanceMode;runtime/common/config/pallets/mod.rsdiffbeforeafterboth151}151}152152153parameter_types! {153parameter_types! {154 pub AppPromotionDailyRate: Perbill = Perbill::from_rational(5u32, 10_000);154 pub AppPromotionDailyRate: Perbill = Perbill::from_parts(453_256);155 pub const MaxCollators: u32 = MAX_COLLATORS;155 pub const MaxCollators: u32 = MAX_COLLATORS;156 pub const LicenseBond: Balance = GENESIS_LICENSE_BOND;156 pub const LicenseBond: Balance = GENESIS_LICENSE_BOND;157157