Replies: 7 comments
-
Can you post the results of a |
Beta Was this translation helpful? Give feedback.
-
Yes, sir.
|
Beta Was this translation helpful? Give feedback.
-
I'm also facing a similar issue trying to read constant functions on the Uniswap v1 exchange contract after upgrading to ethers v5. With the v5 upgrade, it started giving me a call revert exception to read things like tokenAddress, balanceOf, totalSupply, etc. Interestingly, I don't get this issue when calling constant functions on other contracts (such as the ERC20 ABI) with v5. I tried using the human-readable ABI as mentioned above, and that works fine.
My provider doesn't seem out of sync block-wise (calling getBlockNumber on the provider returns what I expect), and like I said above, it works fine with similar constant function calls on other contracts. For now, I'll use the human-readable ABI, but wanted to add my issue on here. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure if this is related, but it sounds like it's got something to do with it and hopefully it will help someone else that has the same issue. If I use this in my human readable abi it does NOT work and I get the
If I change it to
|
Beta Was this translation helpful? Give feedback.
-
@treeder Can you provide a transaction example where those two don't do the same thing? The |
Beta Was this translation helpful? Give feedback.
-
Is the OP still an issue? I'm moving it to discussions, but would love more feedback on the problem or if it has been resolved. |
Beta Was this translation helpful? Give feedback.
-
( |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I wish to read from Uniswap V1 smart contract:
const uniswapFactoryV1ABI = fs.readFileSync('./src/UniswapFactoryV1.json','utf8'); const contract = new ethers.Contract("0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95",uniswapFactoryV1ABI,wallet); contract.tokenCount().then(count => console.log(count.toNumber()));
but it throws an exception:
UnhandledPromiseRejectionWarning: Error: call revert exception (method="tokenCount()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.1)
However when I used the human-readable ABI
const uniswapFactoryV1ABI = ["function tokenCount() view returns(uint)"];
it works and returns a number.
The JSON ABI is obtained from Etherscan and I have verified that this exception does not occur with Uniswap v2.
Beta Was this translation helpful? Give feedback.
All reactions