You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,I have a hardhat project that have a file that does this const arbitrage = new ethers.Contract(config.PROJECT_SETTINGS.ARBITRAGE_ADDRESS, IArbitrage.abi, provider); and it is imported in another js file and that file has a function that wants to estimate gas for a specific function inside the contract.sol file:
const account = new ethers.Wallet(process.env.PRIVATE_KEY, provider)
const arbitrageWithSigner = arbitrage.connect(account);
const estimatedGasLimit = await arbitrageWithSigner.executeTrade.estimateGas(
[await _exchangePath[0].router.getAddress(), await _exchangePath[1].router.getAddress()],
[_token0.address, _token1.address],
_poolFee,
borrowAmount
// ethers.parseUnits("1", _token0.decimals) Use a nominal amount for estimation
);
I have logged the method estimateGas() and the executeTrade() they both exist
typeof arbitrageWithSigner.executeTrade: function
typeof arbitrageWithSigner.executeTrade.estimateGas: function
I also checked for executeTrade() method in my abi and it exist but I'm getting this error:⚠️ Profitability check failed: Cannot read properties of undefined (reading 'executeTrade')"},I'm using Ethers version: 6.15.0,I logged it to make sure that I'm correct.I'm using executeTrade() in an another function in the same file and I'm not getting any error from it.
Now what is the correct way to estimateGas()?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,I have a hardhat project that have a file that does this
const arbitrage = new ethers.Contract(config.PROJECT_SETTINGS.ARBITRAGE_ADDRESS, IArbitrage.abi, provider);
and it is imported in another js file and that file has a function that wants to estimate gas for a specific function inside the contract.sol file:I have logged the method
estimateGas()
and theexecuteTrade()
they both existI also checked for
executeTrade()
method in my abi and it exist but I'm getting this error:⚠️ Profitability check failed: Cannot read properties of undefined (reading 'executeTrade')"}
,I'm usingEthers version: 6.15.0
,I logged it to make sure that I'm correct.I'm usingexecuteTrade()
in an another function in the same file and I'm not getting any error from it.Now what is the correct way to
estimateGas()
?Beta Was this translation helpful? Give feedback.
All reactions