Adding Liquidity to Uniswap fails

Viewed 934

I'm trying to add liquidity to my smart contract on Uniswap, however whenever I try to add liquidity, I can approve the transaction, but hitting apply does nothing. The Javascript console shows an error saying: not able to predict gas gee. There's also a problem with TransferFrom.

 function transfer(address to, uint value) public returns(bool) {
        require(balanceOf(msg.sender) >= value, 'balance too low');
        //burn&tax
        burn(msg.sender,burnTaxFee(value));
        sendDev(msg.sender,devTaxFee(value));

        balances[to] += value; //send the value - burnt tokens to reciever
        balances[msg.sender] -= value ; //subtract value sent from sender.
    emit Transfer(msg.sender, to, value);
        return true;
    }
    
    function transferFrom(address from, address to, uint value) public returns(bool) {
        require(balanceOf(from) >= value, 'balance too low');
        require(allowance[from][msg.sender] >= value, 'allowance too low');
        
        //burn&tax
        burn(msg.sender,burnTaxFee(value));
        sendDev(msg.sender,devTaxFee(value));
    
        balances[to] += value; //send the value - burnt tokens to reciever
        balances[from] -= value; //subtract value sent from sender.
        emit Transfer(from, to, value);
        return true;   
    }

I'm thinking it might have to do with my smart contract? for each transfer, I also do 2 separate transfers that go into two separate wallets. Do multiple transfers triggered by the normal transfer function cause problems with uniswap?

Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"code":-32603,"message":"execution reverted: TransferHelper: TRANSFER_FROM_FAILED","data":{"originalError":{"code":3,"data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000245472616e7366657248656c7065723a205452414e534645525f46524f4d5f4641494c454400000000000000000000000000000000000000000000000000000000","message":"execution reverted: TransferHelper: TRANSFER_FROM_FAILED"}}}, method="estimateGas", transaction={"from":"0xA6486944b1119CDAB743694873e28ad8eF3f89e2","to":"0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D","value":{"type":"BigNumber","hex":"0x1717b72f0a4000"},"data":"0xf305d71900000000000000000000000054620e1c1c39d689fc73214bb1de16f743214dce0000000000000000000000000000000000000000000113d788ba2b887b6c80000000000000000000000000000000000000000000000113d788ba2b887b6c8000000000000000000000000000000000000000000000000000001717b72f0a4000000000000000000000000000a6486944b1119cdab743694873e28ad8ef3f89e20000000000000000000000000000000000000000000000000000000060c1817e","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.2.0)

Another idea I had was that I'm not using the SafeMath library, would non-safemath equations cause issues with Uniswap?

0 Answers
Related