CALL_EXCEPTION on array getter
See original GitHub issuemaybe i’m missing something here, but i cannot call an array getter successfully with an index different from 0.
my code:
const swap = new Contract(pool.curve.address, curvefi.curveAbi, provider);
console.log(await swap.coins(0)); // works ok
console.log(await swap.coins(1)); // Error: call revert exception (method="coins(int128)", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.5)
getter abi:
{
"name": "coins",
"outputs": [
{
"type": "address",
"name": "out"
}
],
"inputs": [
{
"type": "int128",
"name": "arg0"
}
],
"constant": true,
"payable": false,
"type": "function",
"gas": 2040
}
contract: https://etherscan.io/dapp/0x45f783cce6b7ff23b2ab2d70e416cdb7d6055f51#readContract
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (10 by maintainers)
Top Results From Across the Web
Null Getter, when split throwing exception - java - Stack Overflow
If you're looking for a "prettier" way of doing it, then this is a spot that seems decent for the '?' operator (called...
Read more >Best Practices for Java Getter and Setter - DZone
In this post, we take a closer look at getter and setter methods in Java, common mistakes, and best practices for combating these...
Read more >Java Getter and Setter Tutorial - from Basics to Best Practices
How to write getter and setter methods in Java with in-depth description, various code examples and best practices.
Read more >Getter and Setter Method in Java Example - Javatpoint
The setter method setVal() expecting a reference of an int array, and at line 7, the reference of the int arr[] is getting...
Read more >Introduction to JavaScript getters and setters in ES6
The setName() removes the whitespaces from both ends of the newName argument and throws an exception if the newName is empty. The constructor()...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@cruzdanilo , I got my ABI from etherscan. If I remove
gas
from the abi, my example works too. ethers uses the abi gas when provided.From my testing, different node gives different error when a low gas amount is provided.
infura: call revert exception (method=“coins(int128)”, errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.5
alchemy and Cloudflare {“jsonrpc”:“2.0”,“id”:42,“error”:{“code”:-32000,“message”:“out of gas”}}
etherscan sometimes works sometimes timeout Error: timeout
Actually. This might be something I need to address in ethers.
I currently add 21000 gas to the gas cost in the ABI, but I should compute the intrinsic gas cost of sending the data in the transaction. i.e. the cost of sending a byte in data that is 0, is cheaper than the cost of sending non-zero. So the 1 costs more. Ethers can account for this. It just isn’t now.
Vyper is much more accurate when estimating gas costs, which is why it’s on the edge and this hasn’t come up before.
I’ll look into this soon.