Hey, guys. I have such a problem. I have smart contract, that i deployed to 4 chains(Fantom, Avalnche, Polygon and Ethereun) using truffle. On all chains except Ethereum it works great, but at Ethereum the "main" method of contract crashes every time. So i deployed it by remix and got this error: Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?
execution reverted. why is it possible that contract which works on all chains include test doesnt work on ethereum? Thanks for any help

Aug 21, 2022, 7:54 AM
In addition: method failed where i call _safeTransferFrom inside

function _safeTransferFrom(
IERC20 token,
address sender,
address recipient,
uint amount
) private {
bool sent = token.transferFrom(sender, recipient, amount);
require(sent, "Token transfer failed");
}
but i call it with the token parameter that have IERC20Extended type instead of IERC20. Can it be a problem?
Aug 21, 2022, 7:59 AM
post the code of the main function, otherwise it's kinda hard to find the problem.
Probably an external address you're calling
Aug 21, 2022, 8:18 AM
Before this lines just "requires" that successfully passes every time


_safeTransferFrom(usdtToken, msg.sender, tokenWallet, _amount);
_safeTransferFrom(tokenForSale, tokenWallet, msg.sender, amountSelled);
emit Swap(msg.sender, _amount, amountSelled);
that something like swap method, which swap selected token to usdt with static rate
Aug 21, 2022, 8:28 AM
Is the token of USDT correctly configured in the eth contract?
Aug 21, 2022, 8:46 AM
Yes, IERC20(usdtaddress)
suddenly transfer from method doesnt work on ethereum. so it helped me https://ethereum.stackexchange.com/questions/64517/how-to-transfer-and-transferfrom-on-the-tether-smart-contract-from-another-smart
Aug 21, 2022, 6:07 PM

© 2024 Draquery.com All rights reserved.