Skip to content

Commit

Permalink
fix-zenlink-upgrade-tests (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
herryho committed Aug 27, 2021
1 parent 04f780e commit 27c5b31
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 63 deletions.
4 changes: 2 additions & 2 deletions pallets/flexible-fee/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,14 +215,14 @@ parameter_types! {
}

impl zenlink_protocol::Config for Test {
type Conversion = ();
type Event = Event;
type GetExchangeFee = GetExchangeFee;
type MultiAssetsHandler = MultiAssets;
type PalletId = ZenlinkPalletId;
type SelfParaId = SelfParaId;

type TargetChains = ();
type XcmExecutor = ();
type Conversion = ();
}

type MultiAssets = ZenlinkMultiAssets<ZenlinkProtocol, Balances, LocalAssetAdaptor<Currencies>>;
Expand Down
38 changes: 0 additions & 38 deletions pallets/flexible-fee/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,6 @@ fn basic_setup() {
let asset_1_currency_id: AssetId = AssetId::try_from(CURRENCY_ID_1).unwrap();
let asset_2_currency_id: AssetId = AssetId::try_from(CURRENCY_ID_2).unwrap();

assert_ok!(ZenlinkProtocol::create_pair(
Origin::signed(ALICE),
asset_0_currency_id,
asset_1_currency_id
));

let mut deadline: BlockNumberFor<Test> = <frame_system::Pallet<Test>>::block_number() +
<Test as frame_system::Config>::BlockNumber::from(100u32);
assert_ok!(ZenlinkProtocol::add_liquidity(
Expand All @@ -101,17 +95,6 @@ fn basic_setup() {
deadline
));

assert_ok!(ZenlinkProtocol::create_pair(
Origin::signed(ALICE),
asset_0_currency_id,
asset_2_currency_id
)); // asset 0 and 2

let pool_0_2_account = ZenlinkProtocol::lp_metadata((asset_0_currency_id, asset_2_currency_id))
.unwrap()
.0;
println!("pool_0_2_account: {:?}", pool_0_2_account);

// pool 0 2
deadline = <frame_system::Pallet<Test>>::block_number() +
<Test as frame_system::Config>::BlockNumber::from(100u32);
Expand Down Expand Up @@ -199,27 +182,6 @@ fn ensure_can_charge_fee_should_work() {
Some(asset_order_list_vec.clone()),
);

let native_asset_id: AssetId = AssetId::try_from(CURRENCY_ID_0).unwrap();
let asset_id: AssetId = AssetId::try_from(CURRENCY_ID_1).unwrap();

let path = vec![asset_id, native_asset_id];
let pool_0_1_account = ZenlinkProtocol::lp_metadata((native_asset_id, asset_id)).unwrap().0;

println!("pool_0_1_account: {:?}", pool_0_1_account);

let pool_0_1_price = ZenlinkProtocol::get_amount_in_by_path(100, &path);
let pool_0_1_account = ZenlinkProtocol::lp_metadata((native_asset_id, asset_id)).unwrap().0;

println!("pool_0_1_price: {:?}", pool_0_1_price);
println!(
"crrency 0 total balance of pool_0_1: {:?}",
Currencies::total_balance(CURRENCY_ID_0, &pool_0_1_account)
);
println!(
"crrency 1 total balance of pool_0_1: {:?}",
Currencies::total_balance(CURRENCY_ID_1, &pool_0_1_account)
);

assert_ok!(<Test as crate::Config>::FeeDealer::ensure_can_charge_fee(
&ALICE,
100,
Expand Down
1 change: 0 additions & 1 deletion pallets/minter-reward/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ parameter_types! {
impl zenlink_protocol::Config for Runtime {
type Conversion = ();
type Event = Event;
type GetExchangeFee = GetExchangeFee;
type MultiAssetsHandler = MultiAssets;
type PalletId = ZenlinkPalletId;
// type SelfParaId = SelfParaId;
Expand Down
21 changes: 0 additions & 21 deletions pallets/minter-reward/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,6 @@ fn minter_reward_should_work() {
let vksm_asset_id: AssetId =
AssetId::try_from(CurrencyId::VToken(TokenSymbol::KSM)).unwrap();

assert_ok!(ZenlinkProtocol::create_pair(
Origin::signed(ALICE),
ausd_asset_id,
dot_asset_id
));
assert_ok!(ZenlinkProtocol::create_pair(
Origin::signed(ALICE),
ausd_asset_id,
vdot_asset_id
));
assert_ok!(ZenlinkProtocol::create_pair(
Origin::signed(ALICE),
ausd_asset_id,
ksm_asset_id
));
assert_ok!(ZenlinkProtocol::create_pair(
Origin::signed(ALICE),
ausd_asset_id,
vksm_asset_id
));

let deadline: BlockNumberFor<Runtime> = <frame_system::Pallet<Runtime>>::block_number() +
<Runtime as frame_system::Config>::BlockNumber::from(100u32);
assert_ok!(ZenlinkProtocol::add_liquidity(
Expand Down
1 change: 0 additions & 1 deletion pallets/vtoken-mint/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ parameter_types! {
impl zenlink_protocol::Config for Runtime {
type Conversion = ();
type Event = Event;
type GetExchangeFee = GetExchangeFee;
type MultiAssetsHandler = MultiAssets;
type PalletId = ZenlinkPalletId;
type SelfParaId = ();
Expand Down

0 comments on commit 27c5b31

Please sign in to comment.