I have created an ERC20 token using openzeppelin and web3. I am then trying add some of this new token to a contract (An instance of UniswapV2Router02.sol) in order to add liquidity to a liquidity pair. For some reason, when I run the approve function on my new ERC20 contract, the Ethereum explorer is confusing the amount being approved with the token id.

enter image description here

Here is the function I am using

await LToken1.approve(router.address, web3.utils.toWei('0.02'));

Am I calling the function incorrectly?

1 Answer 1


It would help if you add the code of your ERC20 definition (specially the import you do from OpenZeppelin).

However, I already bet that you seem to be using an ERC721 token rather than ERC20 one (and Uniswap only accepts ERC20 or Ether). Notice that your approve function matches with ERC721 standard:

function approve(address _approved, uint256 _tokenId) external payable;

However, you should be using the ERC20 standard:

function approve(address _spender, uint256 _value) public returns (bool success)

If this is not the case, please update the question with your code and will adjust the answer accordingly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.