From 0ac0b1d0f2e2d9281eecbe5d414339da20959b5f Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Sun, 17 May 2026 15:08:13 +0200 Subject: [PATCH 1/3] refactor(evm): fix typo getTokenGasLimitForContact -> getTokenGasLimitForContract The method takes an ERC-20 Contract, not a Contact. Pure rename, all in-file callers updated. --- src/integration/blockchain/shared/evm/evm-client.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/integration/blockchain/shared/evm/evm-client.ts b/src/integration/blockchain/shared/evm/evm-client.ts index 048d7375bf..f2edd071cd 100644 --- a/src/integration/blockchain/shared/evm/evm-client.ts +++ b/src/integration/blockchain/shared/evm/evm-client.ts @@ -184,10 +184,10 @@ export abstract class EvmClient extends BlockchainClient { protected async getTokenGasLimitForAsset(token: Asset, amount: EthersNumber): Promise { const contract = this.getERC20ContractForDex(token.chainId); - return this.getTokenGasLimitForContact(contract, this.randomReceiverAddress, amount); + return this.getTokenGasLimitForContract(contract, this.randomReceiverAddress, amount); } - async getTokenGasLimitForContact(contract: Contract, to: string, amount: EthersNumber): Promise { + async getTokenGasLimitForContract(contract: Contract, to: string, amount: EthersNumber): Promise { const gasEstimate = await contract.estimateGas.transfer(to, amount); return gasEstimate.mul(12).div(10); } @@ -241,7 +241,7 @@ export abstract class EvmClient extends BlockchainClient { to: asset.chainId, data: EvmUtil.encodeErc20Transfer(toAddress, amountWei), value: '0', - gasLimit: await this.getTokenGasLimitForContact(contract, toAddress, amountWei), + gasLimit: await this.getTokenGasLimitForContract(contract, toAddress, amountWei), }; } } @@ -858,7 +858,7 @@ export abstract class EvmClient extends BlockchainClient { const token = await this.getTokenByContract(contract); const targetAmount = EvmUtil.toWeiAmount(amount, token.decimals); - const gasLimit = +(await this.getTokenGasLimitForContact(contract, toAddress, targetAmount)); + const gasLimit = +(await this.getTokenGasLimitForContract(contract, toAddress, targetAmount)); const gasPrice = +(await this.getRecommendedGasPrice()); const currentNonce = await this.getNonce(fromAddress); const txNonce = nonce ?? currentNonce; From bb7d0a02d60b8af9b7ee493bda6df3c129b20103 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Sun, 17 May 2026 15:08:21 +0200 Subject: [PATCH 2/3] refactor(evm): extract shared OpStackEvmClient for Optimism + Base Optimism and Base are both OP Stack L2s and had identical implementations of getCurrentGasCostForCoinTransaction, getCurrentGasCostForTokenTransaction, getTxActualFee and the l2Provider getter (all using @eth-optimism/sdk). Move them into a shared abstract OpStackEvmClient. OptimismClient and BaseClient now only contain their bridge-specific logic (CrossChainMessenger). Each had its own local OptimismTransactionReceipt / BaseTransactionReceipt interface with the same fields; collapsed into one OpStackTransactionReceipt. --- .../blockchain/base/base-client.ts | 59 ++----------------- .../blockchain/optimism/optimism-client.ts | 59 ++----------------- .../shared/evm/op-stack-evm-client.ts | 56 ++++++++++++++++++ 3 files changed, 66 insertions(+), 108 deletions(-) create mode 100644 src/integration/blockchain/shared/evm/op-stack-evm-client.ts diff --git a/src/integration/blockchain/base/base-client.ts b/src/integration/blockchain/base/base-client.ts index f69c8a8d3e..73a9065471 100644 --- a/src/integration/blockchain/base/base-client.ts +++ b/src/integration/blockchain/base/base-client.ts @@ -1,21 +1,15 @@ -import { CrossChainMessenger, L2Provider, MessageStatus, asL2Provider, estimateTotalGasCost } from '@eth-optimism/sdk'; -import { BigNumber, ethers } from 'ethers'; +import { CrossChainMessenger, MessageStatus } from '@eth-optimism/sdk'; +import { ethers } from 'ethers'; import { GetConfig } from 'src/config/config'; import { Asset } from 'src/shared/models/asset/asset.entity'; import { DfxLogger } from 'src/shared/services/dfx-logger'; import { Util } from 'src/shared/utils/util'; -import { EvmClient, EvmClientParams } from '../shared/evm/evm-client'; +import { EvmClientParams } from '../shared/evm/evm-client'; import { EvmUtil } from '../shared/evm/evm.util'; import { L2BridgeEvmClient } from '../shared/evm/interfaces'; +import { OpStackEvmClient } from '../shared/evm/op-stack-evm-client'; -interface BaseTransactionReceipt extends ethers.providers.TransactionReceipt { - l1Fee: BigNumber; - l1GasPrice: BigNumber; - l1GasUsed: BigNumber; - l1FeeScalar: number; -} - -export class BaseClient extends EvmClient implements L2BridgeEvmClient { +export class BaseClient extends OpStackEvmClient implements L2BridgeEvmClient { protected override readonly logger = new DfxLogger(BaseClient); private readonly l1Provider: ethers.providers.JsonRpcProvider; @@ -140,47 +134,4 @@ export class BaseClient extends EvmClient implements L2BridgeEvmClient { return false; } } - - /** - * @overwrite - */ - - async getCurrentGasCostForCoinTransaction(amount: number): Promise { - const totalGasCost = await estimateTotalGasCost(this.l2Provider, { - from: this.walletAddress, - to: this.randomReceiverAddress, - value: EvmUtil.toWeiAmount(amount).toString(), - type: 2, - }); - - return EvmUtil.fromWeiAmount(totalGasCost); - } - - async getCurrentGasCostForTokenTransaction(token: Asset, amount: number): Promise { - const amountWei = EvmUtil.toWeiAmount(amount, token.decimals); - const totalGasCost = await estimateTotalGasCost(this.l2Provider, { - from: this.walletAddress, - to: token.chainId, - data: EvmUtil.encodeErc20Transfer(this.randomReceiverAddress, amountWei), - type: 2, - }); - - return EvmUtil.fromWeiAmount(totalGasCost); - } - - async getTxActualFee(txHash: string): Promise { - const receipt = await this.l2Provider.getTransactionReceipt(txHash); - - const { gasUsed, effectiveGasPrice, l1Fee } = receipt as BaseTransactionReceipt; - - const l2Fee = gasUsed.mul(effectiveGasPrice); - - return EvmUtil.fromWeiAmount(l1Fee.add(l2Fee)); - } - - //*** HELPER METHODS ***// - - private get l2Provider(): L2Provider { - return asL2Provider(this.provider); - } } diff --git a/src/integration/blockchain/optimism/optimism-client.ts b/src/integration/blockchain/optimism/optimism-client.ts index 3e5e2a2afb..2825aa15d5 100644 --- a/src/integration/blockchain/optimism/optimism-client.ts +++ b/src/integration/blockchain/optimism/optimism-client.ts @@ -1,21 +1,15 @@ -import { CrossChainMessenger, L2Provider, MessageStatus, asL2Provider, estimateTotalGasCost } from '@eth-optimism/sdk'; -import { BigNumber, ethers } from 'ethers'; +import { CrossChainMessenger, MessageStatus } from '@eth-optimism/sdk'; +import { ethers } from 'ethers'; import { GetConfig } from 'src/config/config'; import { Asset } from 'src/shared/models/asset/asset.entity'; import { DfxLogger } from 'src/shared/services/dfx-logger'; import { Util } from 'src/shared/utils/util'; -import { EvmClient, EvmClientParams } from '../shared/evm/evm-client'; +import { EvmClientParams } from '../shared/evm/evm-client'; import { EvmUtil } from '../shared/evm/evm.util'; import { L2BridgeEvmClient } from '../shared/evm/interfaces'; +import { OpStackEvmClient } from '../shared/evm/op-stack-evm-client'; -interface OptimismTransactionReceipt extends ethers.providers.TransactionReceipt { - l1GasPrice: BigNumber; - l1GasUsed: BigNumber; - l1FeeScalar: number; - l1Fee: BigNumber; -} - -export class OptimismClient extends EvmClient implements L2BridgeEvmClient { +export class OptimismClient extends OpStackEvmClient implements L2BridgeEvmClient { protected override readonly logger = new DfxLogger(OptimismClient); private readonly l1Provider: ethers.providers.JsonRpcProvider; @@ -140,47 +134,4 @@ export class OptimismClient extends EvmClient implements L2BridgeEvmClient { return false; } } - - /** - * @overwrite - */ - - async getCurrentGasCostForCoinTransaction(amount: number): Promise { - const totalGasCost = await estimateTotalGasCost(this.l2Provider, { - from: this.walletAddress, - to: this.randomReceiverAddress, - value: EvmUtil.toWeiAmount(amount).toString(), - type: 2, - }); - - return EvmUtil.fromWeiAmount(totalGasCost); - } - - async getCurrentGasCostForTokenTransaction(token: Asset, amount: number): Promise { - const amountWei = EvmUtil.toWeiAmount(amount, token.decimals); - const totalGasCost = await estimateTotalGasCost(this.l2Provider, { - from: this.walletAddress, - to: token.chainId, - data: EvmUtil.encodeErc20Transfer(this.randomReceiverAddress, amountWei), - type: 2, - }); - - return EvmUtil.fromWeiAmount(totalGasCost); - } - - async getTxActualFee(txHash: string): Promise { - const receipt = await this.l2Provider.getTransactionReceipt(txHash); - - const { gasUsed, effectiveGasPrice, l1Fee } = receipt as OptimismTransactionReceipt; - - const l2Fee = gasUsed.mul(effectiveGasPrice); - - return EvmUtil.fromWeiAmount(l1Fee.add(l2Fee)); - } - - //*** HELPER METHODS ***// - - private get l2Provider(): L2Provider { - return asL2Provider(this.provider); - } } diff --git a/src/integration/blockchain/shared/evm/op-stack-evm-client.ts b/src/integration/blockchain/shared/evm/op-stack-evm-client.ts new file mode 100644 index 0000000000..f15a14b1c8 --- /dev/null +++ b/src/integration/blockchain/shared/evm/op-stack-evm-client.ts @@ -0,0 +1,56 @@ +import { L2Provider, asL2Provider, estimateTotalGasCost } from '@eth-optimism/sdk'; +import { BigNumber, ethers } from 'ethers'; +import { Asset } from 'src/shared/models/asset/asset.entity'; +import { EvmClient } from './evm-client'; +import { EvmUtil } from './evm.util'; + +interface OpStackTransactionReceipt extends ethers.providers.TransactionReceipt { + l1GasPrice: BigNumber; + l1GasUsed: BigNumber; + l1FeeScalar: number; + l1Fee: BigNumber; +} + +/** + * Shared base for OP Stack L2 EVM clients (Optimism, Base, ...). Provides the L2-aware + * gas estimation and fee calculation that uses `@eth-optimism/sdk`. Concrete clients add + * their own bridge logic on top. + */ +export abstract class OpStackEvmClient extends EvmClient { + async getCurrentGasCostForCoinTransaction(amount: number): Promise { + const totalGasCost = await estimateTotalGasCost(this.l2Provider, { + from: this.walletAddress, + to: this.randomReceiverAddress, + value: EvmUtil.toWeiAmount(amount).toString(), + type: 2, + }); + + return EvmUtil.fromWeiAmount(totalGasCost); + } + + async getCurrentGasCostForTokenTransaction(token: Asset, amount: number): Promise { + const amountWei = EvmUtil.toWeiAmount(amount, token.decimals); + const totalGasCost = await estimateTotalGasCost(this.l2Provider, { + from: this.walletAddress, + to: token.chainId, + data: EvmUtil.encodeErc20Transfer(this.randomReceiverAddress, amountWei), + type: 2, + }); + + return EvmUtil.fromWeiAmount(totalGasCost); + } + + async getTxActualFee(txHash: string): Promise { + const receipt = await this.l2Provider.getTransactionReceipt(txHash); + + const { gasUsed, effectiveGasPrice, l1Fee } = receipt as OpStackTransactionReceipt; + + const l2Fee = gasUsed.mul(effectiveGasPrice); + + return EvmUtil.fromWeiAmount(l1Fee.add(l2Fee)); + } + + protected get l2Provider(): L2Provider { + return asL2Provider(this.provider); + } +} From 948bb281df022b4afad0b31db6828746b301e388 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Sun, 17 May 2026 15:11:49 +0200 Subject: [PATCH 3/3] refactor(evm): unify gas-cost method naming on getCurrentGasCostFor* The EvmClient methods that return the gas cost in coin units were already named getCurrentGasCost*, but the wrapping service and strategy methods dropped the "Cost" suffix even though they returned the same value. Rename the layers above to match the client convention so the return value is self-documenting at every layer: - PayoutEvmService + Optimism/Base/Gnosis overrides: getCurrentGasForXTransaction -> getCurrentGasCostForXTransaction - EvmStrategy + 20 concrete EVM strategies: getCurrentGasForTransaction -> getCurrentGasCostForTransaction - PayInEvmService.getGasCostForCoinTransaction -> getCurrentGasCostForCoinTransaction (adds the "Current" prefix for consistency with the rest) - evm-coin send strategy caller updated EvmClient.getCurrentGasForCoinTransaction(from, to, amount) is intentionally unchanged: it returns raw gas units, not gas cost in coin. --- .../supporting/payin/services/base/payin-evm.service.ts | 2 +- .../payin/strategies/send/impl/base/evm-coin.strategy.ts | 2 +- .../supporting/payout/services/payout-base.service.ts | 4 ++-- .../supporting/payout/services/payout-evm.service.ts | 4 ++-- .../supporting/payout/services/payout-gnosis.service.ts | 4 ++-- .../supporting/payout/services/payout-optimism.service.ts | 4 ++-- .../payout/strategies/payout/impl/arbitrum-coin.strategy.ts | 4 ++-- .../strategies/payout/impl/arbitrum-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/base-coin.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/base-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/base/evm.strategy.ts | 6 +++--- .../payout/strategies/payout/impl/bsc-coin.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/bsc-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/citrea-coin.strategy.ts | 4 ++-- .../strategies/payout/impl/citrea-testnet-coin.strategy.ts | 4 ++-- .../strategies/payout/impl/citrea-testnet-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/citrea-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/ethereum-coin.strategy.ts | 4 ++-- .../strategies/payout/impl/ethereum-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/gnosis-coin.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/gnosis-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/optimism-coin.strategy.ts | 4 ++-- .../strategies/payout/impl/optimism-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/polygon-coin.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/polygon-token.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/sepolia-coin.strategy.ts | 4 ++-- .../payout/strategies/payout/impl/sepolia-token.strategy.ts | 4 ++-- 27 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/subdomains/supporting/payin/services/base/payin-evm.service.ts b/src/subdomains/supporting/payin/services/base/payin-evm.service.ts index 3ade97018f..f9c418c50c 100644 --- a/src/subdomains/supporting/payin/services/base/payin-evm.service.ts +++ b/src/subdomains/supporting/payin/services/base/payin-evm.service.ts @@ -23,7 +23,7 @@ export abstract class PayInEvmService { return this.#client.sendTokenFromAccount(account, addressTo, tokenName, amount); } - async getGasCostForCoinTransaction(amount: number): Promise { + async getCurrentGasCostForCoinTransaction(amount: number): Promise { return this.#client.getCurrentGasCostForCoinTransaction(amount); } diff --git a/src/subdomains/supporting/payin/strategies/send/impl/base/evm-coin.strategy.ts b/src/subdomains/supporting/payin/strategies/send/impl/base/evm-coin.strategy.ts index 941a549a97..c11b58e0b6 100644 --- a/src/subdomains/supporting/payin/strategies/send/impl/base/evm-coin.strategy.ts +++ b/src/subdomains/supporting/payin/strategies/send/impl/base/evm-coin.strategy.ts @@ -46,7 +46,7 @@ export abstract class EvmCoinStrategy extends EvmStrategy { const groupAmount = this.getTotalGroupAmount(payInGroup, type); // use fresh gas cost (not cached estimate) to avoid value + gas > balance - const freshGasCost = await this.payInEvmService.getGasCostForCoinTransaction(groupAmount); + const freshGasCost = await this.payInEvmService.getCurrentGasCostForCoinTransaction(groupAmount); const gasCost = Math.max(freshGasCost, estimatedNativeFee); const amount = Util.round(groupAmount - gasCost * 1.05, 12); diff --git a/src/subdomains/supporting/payout/services/payout-base.service.ts b/src/subdomains/supporting/payout/services/payout-base.service.ts index 8d656a6eab..4ff0906573 100644 --- a/src/subdomains/supporting/payout/services/payout-base.service.ts +++ b/src/subdomains/supporting/payout/services/payout-base.service.ts @@ -13,11 +13,11 @@ export class PayoutBaseService extends PayoutEvmService { this.baseClient = baseService.getDefaultClient(); } - async getCurrentGasForCoinTransaction(amount: number): Promise { + async getCurrentGasCostForCoinTransaction(amount: number): Promise { return this.baseClient.getCurrentGasCostForCoinTransaction(amount); } - async getCurrentGasForTokenTransaction(token: Asset, amount: number): Promise { + async getCurrentGasCostForTokenTransaction(token: Asset, amount: number): Promise { return this.baseClient.getCurrentGasCostForTokenTransaction(token, amount); } } diff --git a/src/subdomains/supporting/payout/services/payout-evm.service.ts b/src/subdomains/supporting/payout/services/payout-evm.service.ts index 9394e63cb7..5ec5cb467c 100644 --- a/src/subdomains/supporting/payout/services/payout-evm.service.ts +++ b/src/subdomains/supporting/payout/services/payout-evm.service.ts @@ -32,11 +32,11 @@ export abstract class PayoutEvmService { return { state: 'failed', isOutOfGas }; } - async getCurrentGasForCoinTransaction(amount: number): Promise { + async getCurrentGasCostForCoinTransaction(amount: number): Promise { return this.client.getCurrentGasCostForCoinTransaction(amount); } - async getCurrentGasForTokenTransaction(token: Asset, amount: number): Promise { + async getCurrentGasCostForTokenTransaction(token: Asset, amount: number): Promise { return this.client.getCurrentGasCostForTokenTransaction(token, amount); } diff --git a/src/subdomains/supporting/payout/services/payout-gnosis.service.ts b/src/subdomains/supporting/payout/services/payout-gnosis.service.ts index eaa3b738cb..2ad263ad12 100644 --- a/src/subdomains/supporting/payout/services/payout-gnosis.service.ts +++ b/src/subdomains/supporting/payout/services/payout-gnosis.service.ts @@ -13,11 +13,11 @@ export class PayoutGnosisService extends PayoutEvmService { this.gnosisClient = gnosisService.getDefaultClient(); } - async getCurrentGasForCoinTransaction(amount: number): Promise { + async getCurrentGasCostForCoinTransaction(amount: number): Promise { return this.gnosisClient.getCurrentGasCostForCoinTransaction(amount); } - async getCurrentGasForTokenTransaction(token: Asset, amount: number): Promise { + async getCurrentGasCostForTokenTransaction(token: Asset, amount: number): Promise { return this.gnosisClient.getCurrentGasCostForTokenTransaction(token, amount); } } diff --git a/src/subdomains/supporting/payout/services/payout-optimism.service.ts b/src/subdomains/supporting/payout/services/payout-optimism.service.ts index 3ac8852592..5070daae5d 100644 --- a/src/subdomains/supporting/payout/services/payout-optimism.service.ts +++ b/src/subdomains/supporting/payout/services/payout-optimism.service.ts @@ -13,11 +13,11 @@ export class PayoutOptimismService extends PayoutEvmService { this.optimismClient = optimismService.getDefaultClient(); } - async getCurrentGasForCoinTransaction(amount: number): Promise { + async getCurrentGasCostForCoinTransaction(amount: number): Promise { return this.optimismClient.getCurrentGasCostForCoinTransaction(amount); } - async getCurrentGasForTokenTransaction(token: Asset, amount: number): Promise { + async getCurrentGasCostForTokenTransaction(token: Asset, amount: number): Promise { return this.optimismClient.getCurrentGasCostForTokenTransaction(token, amount); } } diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-coin.strategy.ts index d8b3d01dd9..f1f3757949 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-coin.strategy.ts @@ -31,8 +31,8 @@ export class ArbitrumCoinStrategy extends EvmStrategy { return this.arbitrumService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.arbitrumService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.arbitrumService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-token.strategy.ts index dadcbe2dbc..4a8033f885 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/arbitrum-token.strategy.ts @@ -31,8 +31,8 @@ export class ArbitrumTokenStrategy extends EvmStrategy { return this.arbitrumService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.arbitrumService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.arbitrumService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/base-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/base-coin.strategy.ts index 70f618270e..313fc7d823 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/base-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/base-coin.strategy.ts @@ -31,8 +31,8 @@ export class BaseCoinStrategy extends EvmStrategy { return this.baseService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.baseService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.baseService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/base-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/base-token.strategy.ts index 39abe68bc7..fd763a7aea 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/base-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/base-token.strategy.ts @@ -31,8 +31,8 @@ export class BaseTokenStrategy extends EvmStrategy { return this.baseService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.baseService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.baseService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/base/evm.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/base/evm.strategy.ts index d4ce117ffc..ff025ce7d6 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/base/evm.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/base/evm.strategy.ts @@ -22,10 +22,10 @@ export abstract class EvmStrategy extends PayoutStrategy { } protected abstract dispatchPayout(order: PayoutOrder): Promise; - protected abstract getCurrentGasForTransaction(token: Asset, amount: number): Promise; + protected abstract getCurrentGasCostForTransaction(token: Asset, amount: number): Promise; async estimateFee(targetAsset: Asset, _address: string, amount: number, _asset: Asset): Promise { - const gasPerTransaction = await this.getCurrentGasForTransaction(targetAsset, amount); + const gasPerTransaction = await this.getCurrentGasCostForTransaction(targetAsset, amount); return { asset: await this.feeAsset(), amount: gasPerTransaction }; } @@ -35,7 +35,7 @@ export abstract class EvmStrategy extends PayoutStrategy { // the transferred amount. Use 1 wei (minimal non-zero amount) to avoid balance-related // estimateGas reverts on the dex wallet. const previewAmount = EvmUtil.fromWeiAmount(1, asset.decimals); - const gasPerTransaction = await this.getCurrentGasForTransaction(asset, previewAmount); + const gasPerTransaction = await this.getCurrentGasCostForTransaction(asset, previewAmount); return { asset: await this.feeAsset(), amount: gasPerTransaction }; } diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/bsc-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/bsc-coin.strategy.ts index b1fa9372f0..5df9e3f6c6 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/bsc-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/bsc-coin.strategy.ts @@ -31,8 +31,8 @@ export class BscCoinStrategy extends EvmStrategy { return this.bscService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.bscService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.bscService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/bsc-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/bsc-token.strategy.ts index ae01a33ef3..dcc3c9a577 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/bsc-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/bsc-token.strategy.ts @@ -31,8 +31,8 @@ export class BscTokenStrategy extends EvmStrategy { return this.bscService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.bscService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.bscService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-coin.strategy.ts index 13e285e798..862d714458 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-coin.strategy.ts @@ -31,8 +31,8 @@ export class CitreaCoinStrategy extends EvmStrategy { return this.citreaService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.citreaService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.citreaService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-coin.strategy.ts index 0c82ba1f94..0a717b7416 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-coin.strategy.ts @@ -31,8 +31,8 @@ export class CitreaTestnetCoinStrategy extends EvmStrategy { return this.citreaTestnetService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.citreaTestnetService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.citreaTestnetService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-token.strategy.ts index 835a86d7ec..e9a59d3fbc 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-testnet-token.strategy.ts @@ -31,8 +31,8 @@ export class CitreaTestnetTokenStrategy extends EvmStrategy { return this.citreaTestnetService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.citreaTestnetService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.citreaTestnetService.getCurrentGasCostForTokenTransaction(token, amount); } protected async getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-token.strategy.ts index cc7741d495..925af81840 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/citrea-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/citrea-token.strategy.ts @@ -31,8 +31,8 @@ export class CitreaTokenStrategy extends EvmStrategy { return this.citreaService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.citreaService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.citreaService.getCurrentGasCostForTokenTransaction(token, amount); } protected async getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-coin.strategy.ts index 9cf49b1315..30281b204a 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-coin.strategy.ts @@ -31,8 +31,8 @@ export class EthereumCoinStrategy extends EvmStrategy { return this.ethereumService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.ethereumService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.ethereumService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-token.strategy.ts index cfbb9b913b..f6e7da0ce0 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/ethereum-token.strategy.ts @@ -31,8 +31,8 @@ export class EthereumTokenStrategy extends EvmStrategy { return this.ethereumService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.ethereumService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.ethereumService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-coin.strategy.ts index 9539152719..677cd9fa9d 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-coin.strategy.ts @@ -31,8 +31,8 @@ export class GnosisCoinStrategy extends EvmStrategy { return this.gnosisService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.gnosisService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.gnosisService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-token.strategy.ts index 54e792f233..cc5dc7c7d2 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/gnosis-token.strategy.ts @@ -31,8 +31,8 @@ export class GnosisTokenStrategy extends EvmStrategy { return this.gnosisService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.gnosisService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.gnosisService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/optimism-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/optimism-coin.strategy.ts index 22612f92c5..3e794d9161 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/optimism-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/optimism-coin.strategy.ts @@ -31,8 +31,8 @@ export class OptimismCoinStrategy extends EvmStrategy { return this.optimismService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.optimismService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.optimismService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/optimism-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/optimism-token.strategy.ts index 95a1523138..6313180de8 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/optimism-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/optimism-token.strategy.ts @@ -31,8 +31,8 @@ export class OptimismTokenStrategy extends EvmStrategy { return this.optimismService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.optimismService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.optimismService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/polygon-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/polygon-coin.strategy.ts index 9e9650a6cc..5117a2880c 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/polygon-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/polygon-coin.strategy.ts @@ -31,8 +31,8 @@ export class PolygonCoinStrategy extends EvmStrategy { return this.polygonService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.polygonService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.polygonService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/polygon-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/polygon-token.strategy.ts index dd9f61cb65..2f66f83804 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/polygon-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/polygon-token.strategy.ts @@ -31,8 +31,8 @@ export class PolygonTokenStrategy extends EvmStrategy { return this.polygonService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.polygonService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.polygonService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-coin.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-coin.strategy.ts index 57a237a0aa..ddee4ffdc5 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-coin.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-coin.strategy.ts @@ -31,8 +31,8 @@ export class SepoliaCoinStrategy extends EvmStrategy { return this.sepoliaService.sendNativeCoin(order.destinationAddress, order.amount, nonce); } - protected getCurrentGasForTransaction(_token: Asset, amount: number): Promise { - return this.sepoliaService.getCurrentGasForCoinTransaction(amount); + protected getCurrentGasCostForTransaction(_token: Asset, amount: number): Promise { + return this.sepoliaService.getCurrentGasCostForCoinTransaction(amount); } protected getFeeAsset(): Promise { diff --git a/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-token.strategy.ts b/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-token.strategy.ts index 82c1f3c6e2..165bdedb48 100644 --- a/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-token.strategy.ts +++ b/src/subdomains/supporting/payout/strategies/payout/impl/sepolia-token.strategy.ts @@ -31,8 +31,8 @@ export class SepoliaTokenStrategy extends EvmStrategy { return this.sepoliaService.sendToken(order.destinationAddress, order.asset, order.amount, nonce); } - protected getCurrentGasForTransaction(token: Asset, amount: number): Promise { - return this.sepoliaService.getCurrentGasForTokenTransaction(token, amount); + protected getCurrentGasCostForTransaction(token: Asset, amount: number): Promise { + return this.sepoliaService.getCurrentGasCostForTokenTransaction(token, amount); } protected getFeeAsset(): Promise {