Hello,
I’m retrieving all newly deployed contracts on Uniswap V2 & V3, and I’ve encountered a problem related to differences between contract versions. I’m using a standard ABI:
const erc20Abi = [ "function name() public view returns (string memory)", "function symbol() public view returns (string memory)", "function owner() public view returns (address)", "function decimals() public view returns (uint8)", "function totalSupply() public view returns (uint256)", "function balanceOf(address account) public view returns (uint256)", ];
However, some contracts have this signature:
function name() public pure returns (string memory)
Due to the presence of “pure”, I can’t call it using the standard ABI. I’m currently using the ethers library with Infura. What’s my best approach to call a function without the same signature and make calls that are compatible with all contracts?