Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreOssun committed Nov 16, 2023
1 parent e6f9101 commit 6b22734
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 50 deletions.
42 changes: 21 additions & 21 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ orml-xcm-support = { git = "https://github.com/open-web3-stack/open-runtime-modu
# Astar pallets & modules
# (wasm)
pallet-block-reward = { path = "./pallets/block-reward", default-features = false }
block-rewards-hybrid = { path = "./pallets/block-rewards-hybrid", default-features = false }
pallet-block-rewards-hybrid = { path = "./pallets/block-rewards-hybrid", default-features = false }
pallet-collator-selection = { path = "./pallets/collator-selection", default-features = false }
pallet-dapps-staking = { path = "./pallets/dapps-staking", default-features = false }
pallet-xc-asset-config = { path = "./pallets/xc-asset-config", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion pallets/block-rewards-hybrid/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "block-rewards-hybrid"
name = "pallet-block-rewards-hybrid"
version = "0.1.0"
license = "Apache-2.0"
description = "FRAME pallet for managing block reward issuance & distribution"
Expand Down
3 changes: 2 additions & 1 deletion pallets/block-rewards-hybrid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@
//! }
//! }
//! ```
//! 4. Set `RewardAmount` to desired block reward value in native currency.
//! 4. Set `MaxBlockRewardAmount` to the max reward amount distributed per block.
//! Max amount will be reached if `ideal_dapps_staking_tvl` is reached.
//!
#![cfg_attr(not(feature = "std"), no_std)]
Expand Down
8 changes: 4 additions & 4 deletions runtime/local/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pallet-transaction-payment-rpc-runtime-api = { workspace = true }

# Astar pallets
astar-primitives = { workspace = true }
block-rewards-hybrid = { workspace = true }
pallet-block-rewards-hybrid = { workspace = true }
pallet-chain-extension-dapps-staking = { workspace = true }
pallet-chain-extension-unified-accounts = { workspace = true }
pallet-chain-extension-xvm = { workspace = true }
Expand Down Expand Up @@ -111,7 +111,7 @@ std = [
"pallet-assets/std",
"pallet-aura/std",
"pallet-balances/std",
"block-rewards-hybrid/std",
"pallet-block-rewards-hybrid/std",
"pallet-contracts/std",
"pallet-contracts-primitives/std",
"pallet-chain-extension-dapps-staking/std",
Expand Down Expand Up @@ -177,7 +177,7 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-dapps-staking/runtime-benchmarks",
"block-rewards-hybrid/runtime-benchmarks",
"pallet-block-rewards-hybrid/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-ethereum/runtime-benchmarks",
Expand All @@ -198,7 +198,7 @@ try-runtime = [
"frame-system/try-runtime",
"pallet-aura/try-runtime",
"pallet-balances/try-runtime",
"block-rewards-hybrid/try-runtime",
"pallet-block-rewards-hybrid/try-runtime",
"pallet-contracts/try-runtime",
"pallet-dapps-staking/try-runtime",
"pallet-grandpa/try-runtime",
Expand Down
12 changes: 6 additions & 6 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub use astar_primitives::{
evm::EvmRevertCodeHandler, AccountId, Address, AssetId, Balance, BlockNumber, Hash, Header,
Index, Signature,
};
pub use block_rewards_hybrid::RewardDistributionConfig;
pub use pallet_block_rewards_hybrid::RewardDistributionConfig;

pub use crate::precompiles::WhitelistedCalls;
#[cfg(feature = "std")]
Expand Down Expand Up @@ -424,7 +424,7 @@ impl Get<Balance> for DappsStakingTvlProvider {
}

pub struct BeneficiaryPayout();
impl block_rewards_hybrid::BeneficiaryPayout<NegativeImbalance> for BeneficiaryPayout {
impl pallet_block_rewards_hybrid::BeneficiaryPayout<NegativeImbalance> for BeneficiaryPayout {
fn treasury(reward: NegativeImbalance) {
Balances::resolve_creating(&TreasuryPalletId::get().into_account_truncating(), reward);
}
Expand All @@ -442,13 +442,13 @@ parameter_types! {
pub const MaxBlockRewardAmount: Balance = 230_718 * MILLIAST;
}

impl block_rewards_hybrid::Config for Runtime {
impl pallet_block_rewards_hybrid::Config for Runtime {
type Currency = Balances;
type DappsStakingTvlProvider = DappsStakingTvlProvider;
type BeneficiaryPayout = BeneficiaryPayout;
type MaxBlockRewardAmount = MaxBlockRewardAmount;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = block_rewards_hybrid::weights::SubstrateWeight<Runtime>;
type WeightInfo = pallet_block_rewards_hybrid::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -1028,7 +1028,7 @@ construct_runtime!(
Balances: pallet_balances,
Vesting: pallet_vesting,
DappsStaking: pallet_dapps_staking,
BlockReward: block_rewards_hybrid,
BlockReward: pallet_block_rewards_hybrid,
TransactionPayment: pallet_transaction_payment,
EVM: pallet_evm,
Ethereum: pallet_ethereum,
Expand Down Expand Up @@ -1158,7 +1158,7 @@ mod benches {
[pallet_balances, Balances]
[pallet_timestamp, Timestamp]
[pallet_dapps_staking, DappsStaking]
[block_rewards_hybrid, BlockReward]
[pallet_block_rewards_hybrid, BlockReward]
[pallet_ethereum_checked, EthereumChecked]
[pallet_dynamic_evm_base_fee, DynamicEvmBaseFee]
);
Expand Down
8 changes: 4 additions & 4 deletions runtime/shibuya/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ orml-xtokens = { workspace = true }

# Astar pallets
astar-primitives = { workspace = true }
block-rewards-hybrid = { workspace = true }
pallet-block-rewards-hybrid = { workspace = true }
pallet-chain-extension-dapps-staking = { workspace = true }
pallet-chain-extension-unified-accounts = { workspace = true }
pallet-chain-extension-xvm = { workspace = true }
Expand Down Expand Up @@ -158,7 +158,7 @@ std = [
"pallet-aura/std",
"pallet-assets/std",
"pallet-balances/std",
"block-rewards-hybrid/std",
"pallet-block-rewards-hybrid/std",
"pallet-contracts/std",
"pallet-contracts-primitives/std",
"pallet-chain-extension-dapps-staking/std",
Expand Down Expand Up @@ -239,7 +239,7 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"pallet-dapps-staking/runtime-benchmarks",
"block-rewards-hybrid/runtime-benchmarks",
"pallet-block-rewards-hybrid/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
Expand All @@ -266,7 +266,7 @@ try-runtime = [
"frame-system/try-runtime",
"pallet-aura/try-runtime",
"pallet-balances/try-runtime",
"block-rewards-hybrid/try-runtime",
"pallet-block-rewards-hybrid/try-runtime",
"pallet-dapps-staking/try-runtime",
"pallet-sudo/try-runtime",
"pallet-timestamp/try-runtime",
Expand Down
24 changes: 12 additions & 12 deletions runtime/shibuya/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub use astar_primitives::{
xcm::AssetLocationIdConverter, AccountId, Address, AssetId, Balance, BlockNumber, Hash, Header,
Index, Signature,
};
pub use block_rewards_hybrid::RewardDistributionConfig;
pub use pallet_block_rewards_hybrid::RewardDistributionConfig;

pub use crate::precompiles::WhitelistedCalls;

Expand Down Expand Up @@ -538,7 +538,7 @@ impl Get<Balance> for DappsStakingTvlProvider {
}

pub struct BeneficiaryPayout();
impl block_rewards_hybrid::BeneficiaryPayout<NegativeImbalance> for BeneficiaryPayout {
impl pallet_block_rewards_hybrid::BeneficiaryPayout<NegativeImbalance> for BeneficiaryPayout {
fn treasury(reward: NegativeImbalance) {
Balances::resolve_creating(&TreasuryPalletId::get().into_account_truncating(), reward);
}
Expand All @@ -556,13 +556,13 @@ parameter_types! {
pub const MaxBlockRewardAmount: Balance = 230_718 * MILLISBY;
}

impl block_rewards_hybrid::Config for Runtime {
impl pallet_block_rewards_hybrid::Config for Runtime {
type Currency = Balances;
type DappsStakingTvlProvider = DappsStakingTvlProvider;
type BeneficiaryPayout = BeneficiaryPayout;
type MaxBlockRewardAmount = MaxBlockRewardAmount;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = block_rewards_hybrid::weights::SubstrateWeight<Runtime>;
type WeightInfo = pallet_block_rewards_hybrid::weights::SubstrateWeight<Runtime>;
}

parameter_types! {
Expand Down Expand Up @@ -1241,7 +1241,7 @@ construct_runtime!(
Balances: pallet_balances = 31,
Vesting: pallet_vesting = 32,
DappsStaking: pallet_dapps_staking = 34,
BlockReward: block_rewards_hybrid = 35,
BlockReward: pallet_block_rewards_hybrid = 35,
Assets: pallet_assets = 36,

Authorship: pallet_authorship = 40,
Expand Down Expand Up @@ -1316,17 +1316,17 @@ pub use frame_support::traits::{OnRuntimeUpgrade, StorageVersion};
pub struct HybridInflationModelMigration;
impl OnRuntimeUpgrade for HybridInflationModelMigration {
fn on_runtime_upgrade() -> Weight {
let mut reward_config = block_rewards_hybrid::RewardDistributionConfig {
let mut reward_config = pallet_block_rewards_hybrid::RewardDistributionConfig {
// 4.66%
treasury_percent: Perbill::from_rational(4663701u32, 100000000u32),
treasury_percent: Perbill::from_rational(4_663_701u32, 100_000_000u32),
// 23.09%
base_staker_percent: Perbill::from_rational(2309024u32, 10000000u32),
base_staker_percent: Perbill::from_rational(2_309_024u32, 10_000_000u32),
// 17.31%
dapps_percent: Perbill::from_rational(173094531u32, 1000000000u32),
dapps_percent: Perbill::from_rational(173_094_531u32, 1_000_000_000u32),
// 2.99%
collators_percent: Perbill::from_rational(29863296u32, 1000000000u32),
collators_percent: Perbill::from_rational(29_863_296u32, 1_000_000_000u32),
// 51.95%
adjustable_percent: Perbill::from_rational(519502763u32, 1000000000u32),
adjustable_percent: Perbill::from_rational(519_502_763u32, 1_000_000_000u32),
// 60.00%
ideal_dapps_staking_tvl: Perbill::from_percent(60),
};
Expand All @@ -1340,7 +1340,7 @@ impl OnRuntimeUpgrade for HybridInflationModelMigration {
reward_config = Default::default();
}

block_rewards_hybrid::RewardDistributionConfigStorage::<Runtime>::put(reward_config);
pallet_block_rewards_hybrid::RewardDistributionConfigStorage::<Runtime>::put(reward_config);

<Runtime as frame_system::pallet::Config>::DbWeight::get().writes(1)
}
Expand Down

0 comments on commit 6b22734

Please sign in to comment.