Giter Club home page Giter Club logo

Comments (3)

Mrtenz avatar Mrtenz commented on June 16, 2024

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:

const value = typeof next === 'bigint' ? next : toNumber(next[1].slice(0, 32));

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:

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.

LefterisJP avatar LefterisJP commented on June 16, 2024

This works fine with eth_call, but not with Solidity's contract.call

So when called from inside contracts you had problems, but when called from the node it was all fine, right?

from eth-scan.

Mrtenz avatar Mrtenz commented on June 16, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.