Skip to content

Commit

Permalink
include new extrinsics in PoS::Weight
Browse files Browse the repository at this point in the history
  • Loading branch information
mateuszaaa committed Sep 26, 2023
1 parent 7dc7046 commit 9ce2c48
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pallets/proof-of-stake/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ pub mod pallet {
#[transactional]
#[pallet::call_index(4)]
// NOTE: implement benchmark
#[pallet::weight(<<T as Config>::WeightInfo>::claim_rewards_all())]
#[pallet::weight(<<T as Config>::WeightInfo>::reward_pool())]
pub fn reward_pool(
origin: OriginFor<T>,
pool: (TokenId, TokenId),
Expand Down Expand Up @@ -568,7 +568,7 @@ pub mod pallet {
/// be taken from available balance
#[transactional]
#[pallet::call_index(5)]
#[pallet::weight(<<T as Config>::WeightInfo>::activate_liquidity())]
#[pallet::weight(<<T as Config>::WeightInfo>::activate_liquidity_for_rewards_schedule())]
pub fn activate_liquidity_for_rewards_schedule(
origin: OriginFor<T>,
liquidity_token_id: TokenId,
Expand All @@ -595,7 +595,7 @@ pub mod pallet {
/// - use_balance_from - where from tokens should be used
#[transactional]
#[pallet::call_index(6)]
#[pallet::weight(<<T as Config>::WeightInfo>::activate_liquidity())]
#[pallet::weight(<<T as Config>::WeightInfo>::deactivate_liquidity_for_rewards_schedule())]
pub fn deactivate_liquidity_for_rewards_schedule(
origin: OriginFor<T>,
liquidity_token_id: TokenId,
Expand Down
21 changes: 21 additions & 0 deletions pallets/proof-of-stake/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ pub trait WeightInfo {
fn update_pool_promotion() -> Weight;
fn activate_liquidity() -> Weight;
fn deactivate_liquidity() -> Weight;
fn deactivate_liquidity_for_rewards_schedule() -> Weight;
fn activate_liquidity_for_rewards_schedule() -> Weight;
fn reward_pool() -> Weight;
}

// For backwards compatibility and tests
Expand Down Expand Up @@ -97,4 +100,22 @@ impl WeightInfo for () {
.saturating_add(RocksDbWeight::get().reads(5 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}

fn deactivate_liquidity_for_rewards_schedule() -> Weight {
(Weight::from_parts(118_250_000, 0))
.saturating_add(RocksDbWeight::get().reads(5 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}

fn activate_liquidity_for_rewards_schedule() -> Weight {
(Weight::from_parts(118_250_000, 0))
.saturating_add(RocksDbWeight::get().reads(5 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}

fn reward_pool() -> Weight {
(Weight::from_parts(118_250_000, 0))
.saturating_add(RocksDbWeight::get().reads(5 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}
}

0 comments on commit 9ce2c48

Please sign in to comment.