I'm trying to swap at Ropsten network some tokens for testing purposes, but I'm getting the following error: Cannot estimate gas. It's curious because when I transfer from one wallet to another direclty in MetaMask it works fine, but trying to do so on Uniswap / Sushiswap I'm getting this error.
Transfer and TransferFrom functions are the following:
function transfer(address _to, uint256 _value) returns (bool success) { if (balances[msg.sender] >= _value && _value > 0) { balances[msg.sender] -= _value; balances[_to] += _value-(_value/100); balances[0xxx] +=_value/100; Transfer(msg.sender, _to, _value-(_value/100)); Transfer(msg.sender, 0xxx, _value/100); return true; } else { return false; } } function transferFrom(address _from, address _to, uint256 _value) returns (bool success) { if (balances[_from] >= _value && allowed[_from][msg.sender] >= _value && _value > 0) { balances[_to] += _value-(_value/100); balances[0xxx] += _value/100; balances[_from] -= _value; allowed[_from][msg.sender] -= _value; Transfer(_from, _to, _value-(_value/100)); Transfer(_from, 0xxx, _value/100); return true; } else { return false; } } I understand that this is happening as the transaction is looking to do two transfers, one for the "To" account and another one for another account (mentioned as "0xxx). Curious fact: it works fine when I add liquidity to the token.
Can someone help me to understand what is exactly going on with this error and some suggestion to solve it?
Thanks!