Comments (3)
Thanks for bringing this up! I'm not sure why this happens for this particular contract. I'm not familiar with Vyper, but I will try and look more into this. Any suggestions as to why this might happen are much appreciated too.
It could potentially be solved by using just the first 32 bytes, which is what we do in the JavaScript library:
Line 16 in 0b10a29
Regarding the old versus new contract: We ran into similar issues with certain contracts, like non-ERC-20 compliant proxy contracts, where the balanceOf
function isn't a view function. This works fine with eth_call
, but not with Solidity's contract.call
. We went through some iterations, and ended up with specifying whether the call succeeded or not, which is used by the JS library to re-fetch balance if necessary. I don't remember the exact details, but this seemed like the best way to solve it at the time.
We also had issues with the call running out of gas, due to a non-compliant token using up the entire gas limit. I believe this is because a call to a non-view function uses up all of the gas.
Some of the contracts that were causing issues before:
- https://etherscan.io/address/0x57Ab1E02fEE23774580C119740129eAC7081e9D3#code
- https://etherscan.io/address/0xC011A72400E58ecD99Ee497CF89E3775d4bd732F#code
Having the result in bytes. I really don't get this. The original contract had it in uint256 which was exactly what you need. We are always dealing with uint256. Either token balances or eth balances. What was the reason to do this?
Again, I'm not a 100% sure what the exact reason for this was, but I think it may have to do with reading revert reasons.
I'm happy to accept any contributions!
from eth-scan.
This works fine with
eth_call
, but not with Solidity'scontract.call
So when called from inside contracts you had problems, but when called from the node it was all fine, right?
from eth-scan.
So when called from inside contracts you had problems, but when called from the node it was all fine, right?
Yes. So in the JavaScript library we check if the call failed, and fetch again by calling eth_call
on a node directly.
from eth-scan.
Related Issues (14)
- HttpProvider should throw an error if it receives an invalid error HOT 5
- Export BalanceMap interface HOT 3
- getTokenBalances & getTokensBalances | Not functional HOT 4
- Myeth HOT 1
- BSC HOT 5
- Can the version of tron be deployed? I can provide gas HOT 3
- Error on BSC: Failed to get data from contract: Error: Input must be hexadecimal HOT 2
- Minimal project with your example code throws an exception about importing uuid-random-es.js HOT 3
- Save gas, precompute hashed value HOT 2
- Balance per block
- made new deployment on bsc mainnet
- Anti-pattern : Prefer that unbound methods are called with their expected scope
- Bug risk in : async function should have await expression
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eth-scan.