Skip to content

Commit

Permalink
update weights calls
Browse files Browse the repository at this point in the history
  • Loading branch information
enthusiastmartin committed Jul 5, 2023
1 parent 3c038a0 commit 2ed11b8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions pallets/stableswap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ pub mod pallet {
///
/// Emits `FeesUpdated` event if successful.
#[pallet::call_index(1)]
#[pallet::weight(<T as Config>::WeightInfo::update_pool())]
#[pallet::weight(<T as Config>::WeightInfo::update_pool_fees())]

Check warning on line 371 in pallets/stableswap/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

pallets/stableswap/src/lib.rs#L371

Added line #L371 was not covered by tests
#[transactional]
pub fn update_pool_fees(
origin: OriginFor<T>,
Expand Down Expand Up @@ -407,7 +407,7 @@ pub mod pallet {
///
/// Emits `AmplificationUpdated` event if successful.
#[pallet::call_index(2)]
#[pallet::weight(<T as Config>::WeightInfo::update_pool())]
#[pallet::weight(<T as Config>::WeightInfo::update_amplification())]

Check warning on line 410 in pallets/stableswap/src/lib.rs

View check run for this annotation

Codecov / codecov/patch

pallets/stableswap/src/lib.rs#L410

Added line #L410 was not covered by tests
#[transactional]
pub fn update_amplification(
origin: OriginFor<T>,
Expand Down
23 changes: 14 additions & 9 deletions pallets/stableswap/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,13 @@ use sp_std::marker::PhantomData;
/// Weight functions needed for pallet_stableswap.
pub trait WeightInfo {
fn create_pool() -> Weight;
fn update_pool() -> Weight;
fn add_liquidity() -> Weight;
fn remove_liquidity_one_asset() -> Weight;
fn sell() -> Weight;
fn buy() -> Weight;
fn set_asset_tradable_state() -> Weight;
fn update_pool_fees() -> Weight;
fn update_amplification() -> Weight;
}

pub struct BasiliskWeight<T>(PhantomData<T>);
Expand All @@ -63,10 +64,6 @@ impl<T: frame_system::Config> WeightInfo for BasiliskWeight<T> {
.saturating_add(T::DbWeight::get().writes(12 as u64))
}

fn update_pool() -> Weight {
Weight::from_ref_time(0u128 as u64)
}

fn add_liquidity() -> Weight {
Weight::from_ref_time(64_481_000 as u64)
.saturating_add(T::DbWeight::get().reads(10 as u64))
Expand All @@ -87,10 +84,15 @@ impl<T: frame_system::Config> WeightInfo for BasiliskWeight<T> {
.saturating_add(T::DbWeight::get().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(5 as u64))
}

fn set_asset_tradable_state() -> Weight {
Weight::from_ref_time(0)
}
fn update_pool_fees() -> Weight {
Weight::from_ref_time(0)
}
fn update_amplification() -> Weight {
Weight::from_ref_time(0)
}
}

// For backwards compatibility and tests
Expand All @@ -100,9 +102,6 @@ impl WeightInfo for () {
.saturating_add(RocksDbWeight::get().reads(13 as u64))
.saturating_add(RocksDbWeight::get().writes(12 as u64))
}
fn update_pool() -> Weight {
Weight::from_ref_time(0u128 as u64)
}
fn add_liquidity() -> Weight {
Weight::from_ref_time(64_481_000 as u64)
.saturating_add(RocksDbWeight::get().reads(10 as u64))
Expand All @@ -127,4 +126,10 @@ impl WeightInfo for () {
fn set_asset_tradable_state() -> Weight {
Weight::from_ref_time(0)
}
fn update_pool_fees() -> Weight {
Weight::from_ref_time(0)
}
fn update_amplification() -> Weight {
Weight::from_ref_time(0)
}
}

0 comments on commit 2ed11b8

Please sign in to comment.