Skip to content

Commit

Permalink
remove warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
dmoka committed Nov 8, 2023
1 parent ff338ae commit c96f1f1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 28 deletions.
2 changes: 0 additions & 2 deletions integration-tests/src/dca.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use hydradx_traits::Registry;
use orml_traits::MultiCurrency;
use orml_traits::MultiReservableCurrency;
use pallet_dca::types::{Order, Schedule};
use pallet_route_executor::TradeExecution;
use pallet_stableswap::types::AssetAmount;
use pallet_stableswap::MAX_ASSETS_IN_POOL;
use polkadot_primitives::v2::BlockNumber;
Expand Down Expand Up @@ -2117,7 +2116,6 @@ mod stableswap {
mod with_onchain_route {
use super::*;
use hydradx_traits::router::PoolType;
use pallet_lbp::Pool;

#[test]
fn buy_should_work_with_omnipool_and_stable_with_onchain_routes() {
Expand Down
16 changes: 2 additions & 14 deletions integration-tests/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#![allow(clippy::identity_op)]
use super::assert_balance;
use crate::polkadot_test_net::*;
use sp_runtime::BoundedVec;
use std::convert::Into;

use hydradx_adapters::OmnipoolHookAdapter;
Expand All @@ -21,8 +20,6 @@ use pallet_omnipool::traits::OmnipoolHooks;
use pallet_omnipool::weights::WeightInfo as OmnipoolWeights;
use pallet_route_executor::AmmTradeWeights;

use pallet_xyk::types::AssetPair;

use hydradx_traits::router::AssetPair as Pair;

use primitives::AssetId;
Expand Down Expand Up @@ -2218,7 +2215,7 @@ mod set_route {

Hydra::execute_with(|| {
//Arrange
let (pool_id, stable_asset_1, stable_asset_2) = init_stableswap().unwrap();
let (pool_id, stable_asset_1, _) = init_stableswap().unwrap();

init_omnipool();

Expand Down Expand Up @@ -2283,7 +2280,6 @@ mod set_route {

//Test which is better
//TODO: once this feature is finalized, we can remove these helper trades, they were just used to check which price is really better
let amount_to_sell = 100 * UNITS;
assert_balance!(ALICE.into(), DOT, ALICE_INITIAL_DOT_BALANCE);

//A scenario
Expand Down Expand Up @@ -2393,8 +2389,6 @@ mod set_route {

Hydra::execute_with(|| {
//Arrange
let pool_id = 11;
let stable_asset_1 = 9876;
init_omnipool();

assert_ok!(Currencies::update_balance(
Expand Down Expand Up @@ -2447,7 +2441,6 @@ mod set_route {

Hydra::execute_with(|| {
//Arrange
let pool_id = 11;
init_omnipool();

assert_ok!(Currencies::update_balance(
Expand Down Expand Up @@ -2524,7 +2517,7 @@ mod with_on_chain_and_default_route {

Hydra::execute_with(|| {
//Arrange
let (pool_id, stable_asset_1, stable_asset_2) = init_stableswap().unwrap();
let (pool_id, stable_asset_1, _) = init_stableswap().unwrap();

init_omnipool();

Expand Down Expand Up @@ -2810,11 +2803,6 @@ mod with_on_chain_and_default_route {
}
}

pub fn create_bounded_vec(trades: Vec<Trade<AssetId>>) -> BoundedVec<Trade<AssetId>, ConstU32<5>> {
let bounded_vec: BoundedVec<Trade<AssetId>, sp_runtime::traits::ConstU32<5>> = trades.try_into().unwrap();
bounded_vec
}

fn create_lbp_pool(accumulated_asset: u32, distributed_asset: u32) {
assert_ok!(LBP::create_pool(
RuntimeOrigin::root(),
Expand Down
14 changes: 6 additions & 8 deletions pallets/dca/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ use sp_runtime::{
DispatchError,
};

use hydradx_adapters::inspect::MultiInspectAdapter;

use hydra_dx_math::support::rational::{round_to_rational, Rounding};
use sp_runtime::traits::Zero;
use sp_runtime::{DispatchResult, FixedU128};
Expand Down Expand Up @@ -485,9 +483,9 @@ impl TradeExecution<OriginForRuntime, AccountId, AssetId, Balance> for OmniPool
}

fn get_liquidity_depth(
pool_type: PoolType<AssetId>,
asset_a: AssetId,
asset_b: AssetId,
_pool_type: PoolType<AssetId>,
_asset_a: AssetId,
_asset_b: AssetId,
) -> Result<Balance, ExecutorError<Self::Error>> {
todo!("Not implemented as not used directly within DCA context")
}
Expand Down Expand Up @@ -590,9 +588,9 @@ impl TradeExecution<OriginForRuntime, AccountId, AssetId, Balance> for Xyk {
}

fn get_liquidity_depth(
pool_type: PoolType<AssetId>,
asset_a: AssetId,
asset_b: AssetId,
_pool_type: PoolType<AssetId>,
_asset_a: AssetId,
_asset_b: AssetId,
) -> Result<Balance, ExecutorError<Self::Error>> {
todo!("No need to implement it as this is not used directly in DCA")
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/route-executor/src/tests/buy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn buy_should_work_when_route_has_single_trade() {
}

#[test]
fn buy_should_work_with_omnipooL_when_no_route_or_onchain_route_exist() {
fn buy_should_work_with_omnipool_when_no_route_or_onchain_route_exist() {
ExtBuilder::default().build().execute_with(|| {
//Arrange
let amount_to_buy = 10;
Expand Down
6 changes: 3 additions & 3 deletions runtime/hydradx/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use super::*;
use crate::system::NativeAssetId;

use hydradx_adapters::{
inspect::MultiInspectAdapter, EmaOraclePriceAdapter, FreezableNFT, MultiCurrencyLockedBalance, OmnipoolHookAdapter,
OracleAssetVolumeProvider, PriceAdjustmentAdapter, StableswapHooksAdapter, VestingInfo,
EmaOraclePriceAdapter, FreezableNFT, MultiCurrencyLockedBalance, OmnipoolHookAdapter, OracleAssetVolumeProvider,
PriceAdjustmentAdapter, StableswapHooksAdapter, VestingInfo,
};

use hydradx_adapters::{RelayChainBlockHashProvider, RelayChainBlockNumberProvider};
Expand Down Expand Up @@ -51,7 +51,7 @@ use frame_support::{
BoundedVec, PalletId,
};
use frame_system::{EnsureRoot, EnsureSigned, RawOrigin};
use hydradx_traits::router::{inverse_route, RouteProvider, Trade};
use hydradx_traits::router::{inverse_route, Trade};
use orml_traits::currency::MutationHooks;
use orml_traits::GetByKey;
use pallet_dynamic_fees::types::FeeParams;
Expand Down

0 comments on commit c96f1f1

Please sign in to comment.