Skip to content

Commit

Permalink
review: drop variables, return result value directly
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh committed Aug 2, 2024
1 parent 9aca0d7 commit fe730fa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
10 changes: 4 additions & 6 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7108,11 +7108,10 @@ impl TakerCoinSwapOpsV2 for EthCoin {
args: &GenTakerFundingSpendArgs<'_, Self>,
_swap_unique_data: &[u8],
) -> GenPreimageResult<Self> {
let result = TxPreimageWithSig {
Ok(TxPreimageWithSig {
preimage: args.funding_tx.clone(),
signature: args.funding_tx.signature(),
};
Ok(result)
})
}

/// Eth doesnt have preimages
Expand Down Expand Up @@ -7144,11 +7143,10 @@ impl TakerCoinSwapOpsV2 for EthCoin {
args: &GenTakerPaymentSpendArgs<'_, Self>,
_swap_unique_data: &[u8],
) -> GenPreimageResult<Self> {
let result = TxPreimageWithSig {
Ok(TxPreimageWithSig {
preimage: args.taker_tx.clone(),
signature: args.taker_tx.signature(),
};
Ok(result)
})
}

/// Eth doesnt have preimages
Expand Down
26 changes: 13 additions & 13 deletions mm2src/coins/eth/eth_swap_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,20 @@ impl EthCoin {
&(args.trading_amount.clone() + args.premium_amount.clone()),
self.decimals
));
let maker_address = public_to_address(&Public::from_slice(args.maker_pub));

let funding_time_lock: u32 = try_tx_s!(args.funding_time_lock.try_into());
let payment_time_lock: u32 = try_tx_s!(args.payment_time_lock.try_into());
let funding_args = TakerFundingArgs {
dex_fee,
payment_amount,
maker_address,
taker_secret_hash: try_tx_s!(args.taker_secret_hash.try_into()),
maker_secret_hash: try_tx_s!(args.maker_secret_hash.try_into()),
funding_time_lock,
payment_time_lock,
let funding_args = {
let maker_address = public_to_address(&Public::from_slice(args.maker_pub));
let funding_time_lock: u32 = try_tx_s!(args.funding_time_lock.try_into());
let payment_time_lock: u32 = try_tx_s!(args.payment_time_lock.try_into());
TakerFundingArgs {
dex_fee,
payment_amount,
maker_address,
taker_secret_hash: try_tx_s!(args.taker_secret_hash.try_into()),
maker_secret_hash: try_tx_s!(args.maker_secret_hash.try_into()),
funding_time_lock,
payment_time_lock,
}
};

match &self.coin_type {
EthCoinType::Eth => {
let data = try_tx_s!(self.prepare_taker_eth_funding_data(&funding_args).await);
Expand Down

0 comments on commit fe730fa

Please sign in to comment.