git.delta.rocks / unique-network / refs/commits / 1f5718ca8c83

difftreelog

Merge pull request #1027 from UniqueNetwork/feature/promo-rate

Yaroslav Bolyukin2023-11-16parents: #32f66f7 #48d2385.patch.diff
in: master
feature(runtime): app promoi rate is changed

4 files changed

modifiedjs-packages/tests/sub/appPromotion/appPromotion.test.tsdiffbeforeafterboth
--- a/js-packages/tests/sub/appPromotion/appPromotion.test.ts
+++ b/js-packages/tests/sub/appPromotion/appPromotion.test.ts
@@ -983,8 +983,8 @@
 function calculateIncome(base: bigint, iter = 0, calcPeriod: bigint = UNLOCKING_PERIOD): bigint {
   const DAY = 7200n;
   const ACCURACY = 1_000_000_000n;
-  // 5n / 10_000n = 0.05% p/day
-  const income = base + base * (ACCURACY * (calcPeriod * 5n) / (10_000n * DAY)) / ACCURACY ;
+  // 453_256n / 1_000_000_000n = 0.0453256% /day
+  const income = base + base * (ACCURACY * (calcPeriod * 453_256n) / (1_000_000_000n * DAY)) / ACCURACY ;
 
   if(iter > 1) {
     return calculateIncome(income, iter - 1, calcPeriod);
modifiedpallets/collator-selection/src/mock.rsdiffbeforeafterboth
208 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}
modifiedruntime/common/config/pallets/app_promotion.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/app_promotion.rs
+++ b/runtime/common/config/pallets/app_promotion.rs
@@ -15,12 +15,12 @@
 // along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
 
 use frame_support::{parameter_types, PalletId};
-use sp_arithmetic::Perbill;
 use up_common::{
 	constants::{DAYS, RELAY_DAYS, UNIQUE},
 	types::Balance,
 };
 
+use super::AppPromotionDailyRate;
 use crate::{
 	runtime_common::config::pallets::{RelayChainBlockNumberProvider, TreasuryAccountId},
 	Balances, BlockNumber, EvmContractHelpers, Maintenance, Runtime, RuntimeEvent, Unique,
@@ -32,7 +32,6 @@
 	pub const PendingInterval: BlockNumber = 7 * DAYS;
 	pub const Nominal: Balance = UNIQUE;
 	pub const HoldAndFreezeIdentifier: [u8; 16] = *b"appstakeappstake";
-	pub IntervalIncome: Perbill = Perbill::from_rational(5u32, 10_000);
 	pub MaintenanceMode: bool =  Maintenance::is_enabled();
 }
 
@@ -47,7 +46,7 @@
 	type RecalculationInterval = RecalculationInterval;
 	type PendingInterval = PendingInterval;
 	type Nominal = Nominal;
-	type IntervalIncome = IntervalIncome;
+	type IntervalIncome = AppPromotionDailyRate;
 	type RuntimeEvent = RuntimeEvent;
 	type FreezeIdentifier = HoldAndFreezeIdentifier;
 	type IsMaintenanceModeEnabled = MaintenanceMode;
modifiedruntime/common/config/pallets/mod.rsdiffbeforeafterboth
--- a/runtime/common/config/pallets/mod.rs
+++ b/runtime/common/config/pallets/mod.rs
@@ -151,7 +151,7 @@
 }
 
 parameter_types! {
-	pub AppPromotionDailyRate: Perbill = Perbill::from_rational(5u32, 10_000);
+	pub AppPromotionDailyRate: Perbill = Perbill::from_parts(453_256);
 	pub const MaxCollators: u32 = MAX_COLLATORS;
 	pub const LicenseBond: Balance = GENESIS_LICENSE_BOND;