diff --git a/mm2src/coins/eth/eth_swap_v2/eth_maker_swap_v2.rs b/mm2src/coins/eth/eth_swap_v2/eth_maker_swap_v2.rs index b8aa3aaf71..164db7b8a4 100644 --- a/mm2src/coins/eth/eth_swap_v2/eth_maker_swap_v2.rs +++ b/mm2src/coins/eth/eth_swap_v2/eth_maker_swap_v2.rs @@ -43,16 +43,24 @@ struct MakerValidationArgs<'a> { payment_time_lock: u64, } -struct MakerRefundArgs { +struct MakerRefundTimelockArgs { payment_amount: U256, taker_address: Address, - taker_secret: [u8; 32], taker_secret_hash: [u8; 32], maker_secret_hash: [u8; 32], payment_time_lock: u64, token_address: Address, } +struct MakerRefundSecretArgs { + payment_amount: U256, + taker_address: Address, + taker_secret: [u8; 32], + maker_secret_hash: [u8; 32], + payment_time_lock: u64, + token_address: Address, +} + impl EthCoin { pub(crate) async fn send_maker_payment_v2_impl( &self, @@ -216,10 +224,9 @@ impl EthCoin { }; let args = { let taker_address = public_to_address(&Public::from_slice(args.taker_pub)); - MakerRefundArgs { + MakerRefundTimelockArgs { payment_amount, taker_address, - taker_secret: [0u8; 32], taker_secret_hash: try_tx_s!(taker_secret_hash.try_into()), maker_secret_hash: try_tx_s!(maker_secret_hash.try_into()), payment_time_lock: args.time_lock, @@ -261,11 +268,10 @@ impl EthCoin { let payment_amount = try_tx_s!(wei_from_big_decimal(&args.amount, self.decimals)); let args = { let taker_address = public_to_address(args.taker_pub); - MakerRefundArgs { + MakerRefundSecretArgs { payment_amount, taker_address, taker_secret, - taker_secret_hash: [0u8; 32], maker_secret_hash, payment_time_lock: args.time_lock, token_address, @@ -348,7 +354,7 @@ impl EthCoin { /// Prepares data for EtomicSwapMakerV2 contract [refundMakerPaymentTimelock](https://github.com/KomodoPlatform/etomic-swap/blob/5e15641cbf41766cd5b37b4d71842c270773f788/contracts/EtomicSwapMakerV2.sol#L144) method async fn prepare_refund_maker_payment_timelock_data( &self, - args: MakerRefundArgs, + args: MakerRefundTimelockArgs, ) -> Result, PrepareTxDataError> { let function = MAKER_SWAP_V2.function("refundMakerPaymentTimelock")?; let id = self.etomic_swap_id_v2(args.payment_time_lock, &args.maker_secret_hash); @@ -366,7 +372,7 @@ impl EthCoin { /// Prepares data for EtomicSwapMakerV2 contract [refundMakerPaymentSecret](https://github.com/KomodoPlatform/etomic-swap/blob/5e15641cbf41766cd5b37b4d71842c270773f788/contracts/EtomicSwapMakerV2.sol#L190) method async fn prepare_refund_maker_payment_secret_data( &self, - args: MakerRefundArgs, + args: MakerRefundSecretArgs, ) -> Result, PrepareTxDataError> { let function = MAKER_SWAP_V2.function("refundMakerPaymentSecret")?; let id = self.etomic_swap_id_v2(args.payment_time_lock, &args.maker_secret_hash); diff --git a/mm2src/coins/eth/eth_swap_v2/eth_taker_swap_v2.rs b/mm2src/coins/eth/eth_swap_v2/eth_taker_swap_v2.rs index 621d9df743..52c1a2592a 100644 --- a/mm2src/coins/eth/eth_swap_v2/eth_taker_swap_v2.rs +++ b/mm2src/coins/eth/eth_swap_v2/eth_taker_swap_v2.rs @@ -41,17 +41,26 @@ struct TakerFundingArgs { payment_time_lock: u64, } -struct TakerRefundArgs { +struct TakerRefundTimelockArgs { dex_fee: U256, payment_amount: U256, maker_address: Address, - taker_secret: [u8; 32], taker_secret_hash: [u8; 32], maker_secret_hash: [u8; 32], payment_time_lock: u64, token_address: Address, } +struct TakerRefundSecretArgs { + dex_fee: U256, + payment_amount: U256, + maker_address: Address, + taker_secret: [u8; 32], + maker_secret_hash: [u8; 32], + payment_time_lock: u64, + token_address: Address, +} + struct TakerValidationArgs<'a> { swap_id: Vec, amount: U256, @@ -291,11 +300,10 @@ impl EthCoin { }, }; - let args = TakerRefundArgs { + let args = TakerRefundTimelockArgs { dex_fee, payment_amount, maker_address, - taker_secret: [0u8; 32], taker_secret_hash: try_tx_s!(taker_secret_hash.try_into()), maker_secret_hash: try_tx_s!(maker_secret_hash.try_into()), payment_time_lock: args.time_lock, @@ -343,12 +351,11 @@ impl EthCoin { )); let maker_address = public_to_address(args.maker_pubkey); - let refund_args = TakerRefundArgs { + let refund_args = TakerRefundSecretArgs { dex_fee, payment_amount, maker_address, taker_secret, - taker_secret_hash: [0u8; 32], maker_secret_hash, payment_time_lock: args.payment_time_lock, token_address, @@ -511,7 +518,7 @@ impl EthCoin { /// Prepares data for EtomicSwapTakerV2 contract [refundTakerPaymentTimelock](https://github.com/KomodoPlatform/etomic-swap/blob/5e15641cbf41766cd5b37b4d71842c270773f788/contracts/EtomicSwapTakerV2.sol#L208) method async fn prepare_taker_refund_payment_timelock_data( &self, - args: TakerRefundArgs, + args: TakerRefundTimelockArgs, ) -> Result, PrepareTxDataError> { let function = TAKER_SWAP_V2.function("refundTakerPaymentTimelock")?; let id = self.etomic_swap_id_v2(args.payment_time_lock, &args.maker_secret_hash); @@ -530,7 +537,7 @@ impl EthCoin { /// Prepares data for EtomicSwapTakerV2 contract [refundTakerPaymentSecret](https://github.com/KomodoPlatform/etomic-swap/blob/5e15641cbf41766cd5b37b4d71842c270773f788/contracts/EtomicSwapTakerV2.sol#L267) method async fn prepare_taker_refund_payment_secret_data( &self, - args: &TakerRefundArgs, + args: &TakerRefundSecretArgs, ) -> Result, PrepareTxDataError> { let function = TAKER_SWAP_V2.function("refundTakerPaymentSecret")?; let id = self.etomic_swap_id_v2(args.payment_time_lock, &args.maker_secret_hash);