Skip to content

Commit

Permalink
update gas limit fields names
Browse files Browse the repository at this point in the history
  • Loading branch information
laruh committed Sep 16, 2024
1 parent 8f983ec commit 6961d50
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 30 deletions.
36 changes: 18 additions & 18 deletions mm2src/coins/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ pub mod gas_limit {
pub mod gas_limit_v2 {
/// Gas limits for maker operations in EtomicSwapMakerV2 contract
pub mod maker {
pub const ETH_SEND_PAYMENT: u64 = 65_000;
pub const ERC20_SEND_PAYMENT: u64 = 115_000;
pub const ETH_PAYMENT: u64 = 65_000;
pub const ERC20_PAYMENT: u64 = 115_000;
pub const ETH_TAKER_SPEND: u64 = 65_000;
pub const ERC20_TAKER_SPEND: u64 = 65_000;
pub const ETH_MAKER_REFUND_TIMELOCK: u64 = 65_000;
Expand All @@ -267,8 +267,8 @@ pub mod gas_limit_v2 {

/// Gas limits for taker operations in EtomicSwapTakerV2 contract
pub mod taker {
pub const ETH_SEND_PAYMENT: u64 = 65_000;
pub const ERC20_SEND_PAYMENT: u64 = 115_000;
pub const ETH_PAYMENT: u64 = 65_000;
pub const ERC20_PAYMENT: u64 = 115_000;
pub const ETH_MAKER_SPEND: u64 = 100_000;
pub const ERC20_MAKER_SPEND: u64 = 115_000;
pub const ETH_TAKER_REFUND_TIMELOCK: u64 = 65_000;
Expand All @@ -279,8 +279,8 @@ pub mod gas_limit_v2 {
}

pub mod nft_maker {
pub const ERC721_SEND_PAYMENT: u64 = 130_000;
pub const ERC1155_SEND_PAYMENT: u64 = 130_000;
pub const ERC721_PAYMENT: u64 = 130_000;
pub const ERC1155_PAYMENT: u64 = 130_000;
pub const ERC721_TAKER_SPEND: u64 = 100_000;
pub const ERC1155_TAKER_SPEND: u64 = 100_000;
pub const ERC721_MAKER_REFUND_TIMELOCK: u64 = 100_000;
Expand Down Expand Up @@ -341,8 +341,8 @@ pub struct EthGasLimitV2 {
#[derive(Deserialize)]
#[serde(default)]
pub struct MakerGasLimitV2 {
pub eth_send_payment: u64,
pub erc20_send_payment: u64,
pub eth_payment: u64,
pub erc20_payment: u64,
pub eth_taker_spend: u64,
pub erc20_taker_spend: u64,
pub eth_maker_refund_timelock: u64,
Expand All @@ -354,8 +354,8 @@ pub struct MakerGasLimitV2 {
#[derive(Deserialize)]
#[serde(default)]
pub struct TakerGasLimitV2 {
pub eth_send_payment: u64,
pub erc20_send_payment: u64,
pub eth_payment: u64,
pub erc20_payment: u64,
pub eth_maker_spend: u64,
pub erc20_maker_spend: u64,
pub eth_taker_refund_timelock: u64,
Expand All @@ -368,8 +368,8 @@ pub struct TakerGasLimitV2 {
#[derive(Deserialize)]
#[serde(default)]
pub struct NftMakerGasLimitV2 {
pub erc721_send_payment: u64,
pub erc1155_send_payment: u64,
pub erc721_payment: u64,
pub erc1155_payment: u64,
pub erc721_taker_spend: u64,
pub erc1155_taker_spend: u64,
pub erc721_maker_refund_timelock: u64,
Expand All @@ -381,8 +381,8 @@ pub struct NftMakerGasLimitV2 {
impl Default for MakerGasLimitV2 {
fn default() -> Self {
MakerGasLimitV2 {
eth_send_payment: gas_limit_v2::maker::ETH_SEND_PAYMENT,
erc20_send_payment: gas_limit_v2::maker::ERC20_SEND_PAYMENT,
eth_payment: gas_limit_v2::maker::ETH_PAYMENT,
erc20_payment: gas_limit_v2::maker::ERC20_PAYMENT,
eth_taker_spend: gas_limit_v2::maker::ETH_TAKER_SPEND,
erc20_taker_spend: gas_limit_v2::maker::ERC20_TAKER_SPEND,
eth_maker_refund_timelock: gas_limit_v2::maker::ETH_MAKER_REFUND_TIMELOCK,
Expand All @@ -396,8 +396,8 @@ impl Default for MakerGasLimitV2 {
impl Default for TakerGasLimitV2 {
fn default() -> Self {
TakerGasLimitV2 {
eth_send_payment: gas_limit_v2::taker::ETH_SEND_PAYMENT,
erc20_send_payment: gas_limit_v2::taker::ERC20_SEND_PAYMENT,
eth_payment: gas_limit_v2::taker::ETH_PAYMENT,
erc20_payment: gas_limit_v2::taker::ERC20_PAYMENT,
eth_maker_spend: gas_limit_v2::taker::ETH_MAKER_SPEND,
erc20_maker_spend: gas_limit_v2::taker::ERC20_MAKER_SPEND,
eth_taker_refund_timelock: gas_limit_v2::taker::ETH_TAKER_REFUND_TIMELOCK,
Expand All @@ -412,8 +412,8 @@ impl Default for TakerGasLimitV2 {
impl Default for NftMakerGasLimitV2 {
fn default() -> Self {
NftMakerGasLimitV2 {
erc721_send_payment: gas_limit_v2::nft_maker::ERC721_SEND_PAYMENT,
erc1155_send_payment: gas_limit_v2::nft_maker::ERC1155_SEND_PAYMENT,
erc721_payment: gas_limit_v2::nft_maker::ERC721_PAYMENT,
erc1155_payment: gas_limit_v2::nft_maker::ERC1155_PAYMENT,
erc721_taker_spend: gas_limit_v2::nft_maker::ERC721_TAKER_SPEND,
erc1155_taker_spend: gas_limit_v2::nft_maker::ERC1155_TAKER_SPEND,
erc721_maker_refund_timelock: gas_limit_v2::nft_maker::ERC721_MAKER_REFUND_TIMELOCK,
Expand Down
4 changes: 2 additions & 2 deletions mm2src/coins/eth/eth_swap_v2/eth_maker_swap_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl EthCoin {
payment_amount,
Action::Call(maker_swap_v2_contract),
data,
U256::from(self.gas_limit_v2.maker.eth_send_payment),
U256::from(self.gas_limit_v2.maker.eth_payment),
)
.compat()
.await
Expand All @@ -92,7 +92,7 @@ impl EthCoin {
U256::from(ZERO_VALUE),
Action::Call(maker_swap_v2_contract),
data,
U256::from(self.gas_limit_v2.maker.erc20_send_payment),
U256::from(self.gas_limit_v2.maker.erc20_payment),
)
.compat()
.await
Expand Down
4 changes: 2 additions & 2 deletions mm2src/coins/eth/eth_swap_v2/eth_taker_swap_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ impl EthCoin {
eth_total_payment,
Action::Call(taker_swap_v2_contract),
data,
U256::from(self.gas_limit_v2.taker.eth_send_payment),
U256::from(self.gas_limit_v2.taker.eth_payment),
)
.compat()
.await
Expand All @@ -110,7 +110,7 @@ impl EthCoin {
U256::from(ZERO_VALUE),
Action::Call(taker_swap_v2_contract),
data,
U256::from(self.gas_limit_v2.taker.erc20_send_payment),
U256::from(self.gas_limit_v2.taker.erc20_payment),
)
.compat()
.await
Expand Down
4 changes: 2 additions & 2 deletions mm2src/coins/eth/nft_swap_v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ impl EthCoin {

let data = try_tx_s!(self.prepare_nft_maker_payment_v2_data(&args, htlc_data).await);
let gas_limit = match args.nft_swap_info.contract_type {
ContractType::Erc1155 => self.gas_limit_v2.nft_maker.erc1155_send_payment,
ContractType::Erc721 => self.gas_limit_v2.nft_maker.erc721_send_payment,
ContractType::Erc1155 => self.gas_limit_v2.nft_maker.erc1155_payment,
ContractType::Erc721 => self.gas_limit_v2.nft_maker.erc721_payment,
};
self.sign_and_send_transaction(
ZERO_VALUE.into(),
Expand Down
14 changes: 8 additions & 6 deletions mm2src/mm2_main/tests/docker_tests/eth_docker_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1446,6 +1446,7 @@ fn eth_coin_v2_activation_with_random_privkey(
coin
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_by_secret_eth() {
// sepolia test
Expand Down Expand Up @@ -1506,6 +1507,7 @@ fn send_and_refund_taker_funding_by_secret_eth() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_by_secret_erc20() {
thread::sleep(Duration::from_secs(30));
Expand Down Expand Up @@ -1567,6 +1569,7 @@ fn send_and_refund_taker_funding_by_secret_erc20() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 200);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_pre_approve_timelock_eth() {
// sepolia test
Expand Down Expand Up @@ -1631,6 +1634,7 @@ fn send_and_refund_taker_funding_exceed_pre_approve_timelock_eth() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn taker_send_approve_and_spend_eth() {
// sepolia test
Expand Down Expand Up @@ -1740,6 +1744,7 @@ fn taker_send_approve_and_spend_eth() {
block_on(taker_coin.wait_for_taker_payment_spend(&spend_tx, 0u64, payment_time_lock)).unwrap();
}

#[ignore]
#[test]
fn taker_send_approve_and_spend_erc20() {
// sepolia test
Expand Down Expand Up @@ -1849,6 +1854,7 @@ fn taker_send_approve_and_spend_erc20() {
block_on(taker_coin.wait_for_taker_payment_spend(&spend_tx, 0u64, payment_time_lock)).unwrap();
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_payment_timelock_eth() {
// sepolia test
Expand Down Expand Up @@ -1932,6 +1938,7 @@ fn send_and_refund_taker_funding_exceed_payment_timelock_eth() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_payment_timelock_erc20() {
// sepolia test
Expand Down Expand Up @@ -2017,6 +2024,7 @@ fn send_and_refund_taker_funding_exceed_payment_timelock_erc20() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_refund_taker_funding_exceed_pre_approve_timelock_erc20() {
// sepolia test
Expand Down Expand Up @@ -2083,7 +2091,6 @@ fn send_and_refund_taker_funding_exceed_pre_approve_timelock_erc20() {
wait_for_confirmations(&taker_coin, &funding_tx_refund, 150);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_timelock_eth() {
thread::sleep(Duration::from_secs(150));
Expand Down Expand Up @@ -2136,7 +2143,6 @@ fn send_maker_payment_and_refund_timelock_eth() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_timelock_erc20() {
thread::sleep(Duration::from_secs(120));
Expand Down Expand Up @@ -2190,7 +2196,6 @@ fn send_maker_payment_and_refund_timelock_erc20() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_secret_eth() {
thread::sleep(Duration::from_secs(90));
Expand Down Expand Up @@ -2240,7 +2245,6 @@ fn send_maker_payment_and_refund_secret_eth() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_maker_payment_and_refund_secret_erc20() {
thread::sleep(Duration::from_secs(60));
Expand Down Expand Up @@ -2291,7 +2295,6 @@ fn send_maker_payment_and_refund_secret_erc20() {
wait_for_confirmations(&maker_coin, &payment_tx_refund, 100);
}

#[ignore]
#[test]
fn send_and_spend_maker_payment_eth() {
let taker_coin = get_or_create_sepolia_coin(&MM_CTX1, SEPOLIA_TAKER_PRIV, ETH, &eth_sepolia_conf(), false);
Expand Down Expand Up @@ -2353,7 +2356,6 @@ fn send_and_spend_maker_payment_eth() {
block_on(maker_coin.wait_for_maker_payment_spend(&spend_tx, 0u64, payment_time_lock)).unwrap();
}

#[ignore]
#[test]
fn send_and_spend_maker_payment_erc20() {
thread::sleep(Duration::from_secs(30));
Expand Down

0 comments on commit 6961d50

Please sign in to comment.