Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate xpallet-dex-spot to attribute macro #559

Merged
merged 3 commits into from
Jun 16, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion xpallets/dex/spot/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ benchmarks! {
set_price_fluctuation {
}: _(RawOrigin::Root, PAIR_ID, 1000)
verify {
assert_eq!(PriceFluctuationOf::get(PAIR_ID), 1000);
assert_eq!(PriceFluctuationOf::<T>::get(PAIR_ID), 1000);
}

add_trading_pair {
Expand Down
2 changes: 1 addition & 1 deletion xpallets/dex/spot/src/execution/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use super::*;
use xpallet_assets::AssetType::{self, ReservedDexSpot, Usable};

impl<T: Config> Module<T> {
impl<T: Config> Pallet<T> {
/// Delivery the assets to maker and taker respectively when executing the order.
pub(super) fn delivery_asset_to_each_other(
maker_order_side: Side,
Expand Down
2 changes: 1 addition & 1 deletion xpallets/dex/spot/src/execution/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use frame_support::log::debug;
use super::*;
use crate::types::*;

impl<T: Config> Module<T> {
impl<T: Config> Pallet<T> {
fn check_bid_price(
quote: T::Price,
lowest_ask: T::Price,
Expand Down
4 changes: 2 additions & 2 deletions xpallets/dex/spot/src/execution/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use super::*;
use sp_runtime::traits::CheckedAdd;
use sp_std::cmp::Ordering;

impl<T: Config> Module<T> {
impl<T: Config> Pallet<T> {
/// When the price is far from the current handicap, i.e.,
/// - buy: less than the lowest_ask
/// - sell: larger than the highest_bid
Expand Down Expand Up @@ -353,7 +353,7 @@ impl<T: Config> Module<T> {
let pair = Self::trading_pair(pair_id)?;

let trading_history_idx = Self::trading_history_index_of(pair_id);
TradingHistoryIndexOf::insert(pair_id, trading_history_idx + 1);
TradingHistoryIndexOf::<T>::insert(pair_id, trading_history_idx + 1);

Self::update_order_on_execute(maker_order, &turnover, trading_history_idx);
Self::update_order_on_execute(taker_order, &turnover, trading_history_idx);
Expand Down
2 changes: 1 addition & 1 deletion xpallets/dex/spot/src/execution/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::types::Side::{Buy, Sell};
use sp_runtime::traits::{CheckedAdd, CheckedSub};

/// Internal mutables
impl<T: Config> Module<T> {
impl<T: Config> Pallet<T> {
/// It's worth noting that the handicap is not always related to some real orders, i.e.,
/// current lowest_ask(or highest_bid) is suprious.
///
Expand Down
Loading