Skip to content

Commit

Permalink
bump v0.9.30-mainnet.171 (#80)
Browse files Browse the repository at this point in the history
* bump  v0.9.30-mainnet.171

* update unit test
  • Loading branch information
StewartYe authored Jun 25, 2023
1 parent f38dc2d commit be49d50
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.9.30-mainnet.171

- change set reward origin

# v0.9.30-mainnet.node.170

- enable amm bot
Expand Down
4 changes: 3 additions & 1 deletion pallets/reward/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ pub mod pallet {

#[pallet::constant]
type RewardTerminateAt: Get<Self::BlockNumber>;

type TreasuryOrigin: EnsureOrigin<Self::RuntimeOrigin>;
}

#[pallet::event]
Expand Down Expand Up @@ -182,7 +184,7 @@ pub mod pallet {
origin: OriginFor<T>,
era_rewards: Balance<T>,
) -> DispatchResultWithPostInfo {
let _ = ensure_root(origin)?;
let _ = T::TreasuryOrigin::ensure_origin(origin)?;
EraRewards::<T>::put(era_rewards);
Self::deposit_event(Event::EraRewardsUpdated(era_rewards));
Ok(().into())
Expand Down
1 change: 1 addition & 0 deletions pallets/reward/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ impl pallet_fuso_reward::Config for Test {
type RewardsPerEra = RewardsPerEra;
type RuntimeEvent = RuntimeEvent;
type TimeCoefficientZoom = TimeCoefficientZoom;
type TreasuryOrigin = EnsureSignedBy<TreasuryMembers, Self::AccountId>;
}

// Configure a mock runtime to test the pallet.
Expand Down
11 changes: 10 additions & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 170,
spec_version: 171,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 3,
Expand Down Expand Up @@ -711,6 +711,14 @@ impl SortedMembers<AccountId> for BridgeAdminMembers {
}
}

pub struct TreasuryMembers;

impl SortedMembers<AccountId> for TreasuryMembers {
fn sorted_members() -> Vec<AccountId> {
vec![TREASURY]
}
}

impl pallet_chainbridge_handler::Config for Runtime {
type BalanceConversion = Token;
type BridgeOrigin = pallet_chainbridge::EnsureBridge<Runtime>;
Expand Down Expand Up @@ -768,6 +776,7 @@ impl pallet_fuso_reward::Config for Runtime {
type RewardsPerEra = RewardsPerEra;
type RuntimeEvent = RuntimeEvent;
type TimeCoefficientZoom = TimeCoefficientZoom;
type TreasuryOrigin = EnsureSignedBy<TreasuryMembers, Self::AccountId>;
}

parameter_types! {
Expand Down

0 comments on commit be49d50

Please sign in to comment.