I’m unable to add liquidity on Uniswap V3 for an ERC20PresetFixedSupply
contract that performs a burn during a transfer.
The following error shows in the dev tools console when the ‘Add’ button is pressed:
Error: cannot estimate gas; transaction may fail or may require manual gas limit (error={"code":-32603,"message":"execution reverted: M0","data":{"originalError":{"code":3,"data":"0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000024d30000000000000000000000000000000000000000000000000000000000000","message":"execution reverted: M0"}}}, method="estimateGas", transaction={"from":"0x78FC40ca8A23cf02654d4A5638Ba4d71BAcaa965","to":"0xC36442b4a4522E871399CD717aBDD847Ab11FE88","value":{"type":"BigNumber","hex":"0x7e38605822f1"},"data":"0xac9650d8000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000012000000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000008413ead562000000000000000000000000b50f87a4257e54e6e291d7c1b787577200f5f01a000000000000000000000000c778417e063141139fce010982780140aa0cd5ab0000000000000000000000000000000000000000000000000000000000000bb8000000000000000000000000000000000000000019994616fedc43f56bf519a100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000016488316456000000000000000000000000b50f87a4257e54e6e291d7c1b787577200f5f01a000000000000000000000000c778417e063141139fce010982780140aa0cd5ab0000000000000000000000000000000000000000000000000000000000000bb8ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff4c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008ac7230489e7b44200000000000000000000000000000000000000000000000000007e38605822f100000000000000000000000000000000000000000000000077d2141c446ae2d7000000000000000000000000000000000000000000000000000000000000000000000000000000000000000078fc40ca8a23cf02654d4a5638ba4d71bacaa9650000000000000000000000000000000000000000000000000000000060e8dfab00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000412210e8a00000000000000000000000000000000000000000000000000000000","accessList":null}, code=UNPREDICTABLE_GAS_LIMIT, version=providers/5.2.0)
at e.value (index.ts:213)
at e.value (index.ts:225)
at ae (json-rpc-provider.ts:76)
at r.<anonymous> (json-rpc-provider.ts:512)
at c (runtime.js:63)
at Generator._invoke (runtime.js:293)
at Generator.throw (runtime.js:118)
at u (4.499580c4.chunk.js:2)
(anonymous) | @ | index.tsx:279
This works fine on Uniswap V2, so I’m not sure if it’s a issue with V3 specifically, or some sort of bug or compatibility issue between V3 and OpenZeppelin Contracts.
Code to reproduce
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetFixedSupply.sol";
contract Foo is ERC20PresetFixedSupply {
constructor() ERC20PresetFixedSupply("Foo", "FOO", 100 * 10 ** decimals(), _msgSender()) {
}
function _transfer(address sender, address recipient, uint256 amount) internal virtual override {
super._transfer(sender, recipient, amount);
_burn(recipient, 1);
}
}
Environment
Truffle 5.3.14