When i test with hardhat my arbitrage trading bot i get this error: Error: Transaction reverted: function returned an unexpected amount of data
from this function here:
function executeTrade(
address _tokenA,
address _tokenB,
uint _tokensFromFlashLoan,
bool _startOnUniswap
) external {
uint balanceBefore = IERC20(_tokenA).balanceOf(_tokenA);
bytes memory data = abi.encode(
_startOnUniswap,
_tokenA,
_tokenB,
_tokensFromFlashLoan,
balanceBefore
);
flashloan(_tokenA, _tokensFromFlashLoan, data);
}
The error comes from this line: uint balanceBefore = IERC20(_tokenA).balanceOf(address(this));
I dont know what this line is returning of unexpected, if you have any suggestion please help me its now 2 weeks that im stuck on this bug and any type of help would really help me out.