Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature(runtime): app promoi rate is changed #1027

Merged
merged 4 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions js-packages/tests/sub/appPromotion/appPromotion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -983,8 +983,8 @@ async function payUntilRewardFor(account: string, helper: DevUniqueHelper) {
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);
Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ parameter_types! {
pub const DefaultWeightToFeeCoefficient: u64 = 100_000;
pub const DefaultMinGasPrice: u64 = 100_000;
pub const MaxXcmAllowedLocations: u32 = 16;
pub AppPromotionDailyRate: Perbill = Perbill::from_rational(5u32, 10_000);
pub AppPromotionDailyRate: Perbill = Perbill::from_parts(453_256);
pub const DayRelayBlocks: u32 = 1;
pub const LicenceBondIdentifier: [u8; 16] = *b"licenceidentifie";
}
Expand Down
5 changes: 2 additions & 3 deletions runtime/common/config/pallets/app_promotion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -32,7 +32,6 @@ parameter_types! {
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();
}

Expand All @@ -47,7 +46,7 @@ impl pallet_app_promotion::Config for Runtime {
type RecalculationInterval = RecalculationInterval;
type PendingInterval = PendingInterval;
type Nominal = Nominal;
type IntervalIncome = IntervalIncome;
type IntervalIncome = AppPromotionDailyRate;
type RuntimeEvent = RuntimeEvent;
type FreezeIdentifier = HoldAndFreezeIdentifier;
type IsMaintenanceModeEnabled = MaintenanceMode;
Expand Down
2 changes: 1 addition & 1 deletion runtime/common/config/pallets/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl pallet_unique::Config for Runtime {
}

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;

Expand Down
Loading