Skip to content

Commit

Permalink
Fixes after merge.
Browse files Browse the repository at this point in the history
  • Loading branch information
artemii235 committed May 6, 2021
1 parent 6d98724 commit c001252
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 35 deletions.
53 changes: 20 additions & 33 deletions mm2src/coins/utxo/slp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

use super::utxo_standard::UtxoStandardCoin;
use crate::utxo::{UtxoCommonOps, UtxoTx};
use crate::{CoinBalance, FeeApproxStage, FoundSwapTxSpend, HistorySyncState, MarketCoinOps, MmCoin, SwapOps, TradeFee,
TradePreimageError, TradePreimageValue, TransactionDetails, TransactionEnum, TransactionFut,
ValidateAddressResult, WithdrawRequest};
use crate::{BalanceFut, CoinBalance, FeeApproxStage, FoundSwapTxSpend, HistorySyncState, MarketCoinOps, MmCoin,
SwapOps, TradeFee, TradePreimageFut, TradePreimageValue, TransactionEnum, TransactionFut,
ValidateAddressResult, WithdrawFut, WithdrawRequest};
use common::mm_ctx::MmArc;
use common::mm_number::{BigDecimal, MmNumber};
use futures::compat::Future01CompatExt;
Expand Down Expand Up @@ -52,26 +52,24 @@ impl MarketCoinOps for SlpToken {

fn my_address(&self) -> Result<String, String> { unimplemented!() }

fn my_balance(&self) -> Box<dyn Future<Item = CoinBalance, Error = String> + Send> {
fn my_balance(&self) -> BalanceFut<CoinBalance> {
let coin = self.clone();
let fut = async move {
let (unspents, _) = try_s!(
coin.platform_utxo
.list_unspent_ordered(&coin.platform_utxo.as_ref().my_address)
.await
);
let (unspents, _) = coin
.platform_utxo
.list_unspent_ordered(&coin.platform_utxo.as_ref().my_address)
.await?;
for unspent in unspents {
if unspent.value != coin.platform_utxo.as_ref().dust_amount {
continue;
}
let prev_tx_bytes = try_s!(
coin.platform_utxo
.as_ref()
.rpc_client
.get_transaction_bytes(unspent.outpoint.hash.reversed().into())
.compat()
.await
);
let prev_tx_bytes = coin
.platform_utxo
.as_ref()
.rpc_client
.get_transaction_bytes(unspent.outpoint.hash.reversed().into())
.compat()
.await?;
let prev_tx: UtxoTx = deserialize(prev_tx_bytes.0.as_slice()).unwrap();
let script: Script = prev_tx.outputs[0].script_pubkey.clone().into();
}
Expand All @@ -83,7 +81,7 @@ impl MarketCoinOps for SlpToken {
Box::new(fut.boxed().compat())
}

fn base_coin_balance(&self) -> Box<dyn Future<Item = BigDecimal, Error = String> + Send> { unimplemented!() }
fn base_coin_balance(&self) -> BalanceFut<BigDecimal> { unimplemented!() }

/// Receives raw transaction bytes in hexadecimal format as input and returns tx hash in hexadecimal format
fn send_raw_tx(&self, tx: &str) -> Box<dyn Future<Item = String, Error = String> + Send> { unimplemented!() }
Expand Down Expand Up @@ -267,9 +265,7 @@ impl SwapOps for SlpToken {
impl MmCoin for SlpToken {
fn is_asset_chain(&self) -> bool { unimplemented!() }

fn withdraw(&self, req: WithdrawRequest) -> Box<dyn Future<Item = TransactionDetails, Error = String> + Send> {
unimplemented!()
}
fn withdraw(&self, req: WithdrawRequest) -> WithdrawFut { unimplemented!() }

fn decimals(&self) -> u8 { unimplemented!() }

Expand All @@ -284,26 +280,17 @@ impl MmCoin for SlpToken {
/// Get fee to be paid per 1 swap transaction
fn get_trade_fee(&self) -> Box<dyn Future<Item = TradeFee, Error = String> + Send> { unimplemented!() }

fn get_sender_trade_fee(
&self,
value: TradePreimageValue,
stage: FeeApproxStage,
) -> Box<dyn Future<Item = TradeFee, Error = TradePreimageError> + Send> {
fn get_sender_trade_fee(&self, value: TradePreimageValue, stage: FeeApproxStage) -> TradePreimageFut<TradeFee> {
unimplemented!()
}

fn get_receiver_trade_fee(
&self,
stage: FeeApproxStage,
) -> Box<dyn Future<Item = TradeFee, Error = TradePreimageError> + Send> {
unimplemented!()
}
fn get_receiver_trade_fee(&self, stage: FeeApproxStage) -> TradePreimageFut<TradeFee> { unimplemented!() }

fn get_fee_to_send_taker_fee(
&self,
dex_fee_amount: BigDecimal,
stage: FeeApproxStage,
) -> Box<dyn Future<Item = TradeFee, Error = TradePreimageError> + Send> {
) -> TradePreimageFut<TradeFee> {
unimplemented!()
}

Expand Down
1 change: 0 additions & 1 deletion mm2src/common/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#![feature(optin_builtin_traits)]
#![feature(drain_filter)]
#![feature(const_fn)]
#![feature(negative_impls)]
#![cfg_attr(target_arch = "wasm32", allow(unused_imports))]
#![cfg_attr(target_arch = "wasm32", allow(dead_code))]

Expand Down
3 changes: 2 additions & 1 deletion mm2src/rpc/dispatcher/dispatcher_legacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::net::SocketAddr;

use super::lp_commands::*;
use crate::mm2::lp_ordermatch::{best_orders_rpc, buy, cancel_all_orders, cancel_order, my_orders, order_status,
orderbook_depth_rpc, orderbook_rpc, sell, set_price};
orderbook_depth_rpc, orderbook_rpc, sell, set_price, update_maker_order};
use crate::mm2::lp_swap::{active_swaps_rpc, all_swaps_uuids_by_filter, ban_pubkey_rpc, coins_needed_for_kick_start,
import_swaps, list_banned_pubkeys_rpc, max_taker_vol, my_recent_swaps, my_swap_status,
recover_funds_of_swap, stats_swap_status, unban_pubkeys_rpc};
Expand Down Expand Up @@ -126,6 +126,7 @@ pub fn dispatcher(req: Json, ctx: MmArc) -> DispatcherRes {
"stop" => stop(ctx),
"trade_preimage" => hyres(into_legacy::trade_preimage(ctx, req)),
"unban_pubkeys" => hyres(unban_pubkeys_rpc(ctx, req)),
"update_maker_order" => hyres(update_maker_order(ctx, req)),
"validateaddress" => hyres(validate_address(ctx, req)),
"version" => version(),
"withdraw" => hyres(into_legacy::withdraw(ctx, req)),
Expand Down

0 comments on commit c001252

Please sign in to comment.