Giter Site home page Giter Site logo

Multicall1 address on 1337 about ethcall HOT 4 CLOSED

destiner avatar destiner commented on May 25, 2024
Multicall1 address on 1337

from ethcall.

Comments (4)

Destiner avatar Destiner commented on May 25, 2024 1

@Majorfi thanks for such a detailed answer! I think I get it now.

Probably the easiest fix would be to switch the order of multicall contracts for getEthBalance, so that the Multicall 3 would be the default.

But I have to think whether this might break something. In the meantime, feel free to give any other ideas.

from ethcall.

Destiner avatar Destiner commented on May 25, 2024 1

Fixed in 5.0.1

from ethcall.

Destiner avatar Destiner commented on May 25, 2024

Hey @Majorfi! Did you tried to query ether balance using ethcall on mainnet, and it failed due to trying to use 0x77dCa2C955b15e9dE4dbBCf1246B4B85b651e50e?

From the code, this address is used on 1337 chain, which is a local devnet if I'm not mistaken. On mainnet, we indeed use 0xeefba1e63905ef1d7acba5a8513c70307c1ce441 (source) as you could expect.

Are you sure you were querying mainnet? If so, could you please provide a snippet or a repo to reproduce?

from ethcall.

Majorfi avatar Majorfi commented on May 25, 2024

Hey!
Sorry for the late answer. It may not be something to change and this may lead to breaking change, so this is probably to take with caution!
I will talk from my xp and the people around me, but when we usualy work with the network 1337, it's to fork the Ethereum Mainnet network (1) and simulate some transactions with the "current state" of eth.
I usually use multicall2 with the tryAll method, but a few weeks ago, I needed to get the ETH balance for an account in one batched call.

The thing is that if I am working with the mainnet fork, my tryAll will use the address 0x5ba1e12693dc8f9c48aad8770482f4739beed696 (which is the same on 1, 5 or 1337), but the getEthBalance will use the address 0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e, which is the same as the one on Goerli, but which did not exists on mainnet, making that specific call fails.

The code of getEthBalance uses the first multicall available:

const multicall = this.multicall || this.multicall2 || this.multicall3;

Which cause the call to fail.

I find it weird that the address for multicall1 is not the same as mainnet (but that's given my xp). However, something should probably be done to call the corresponding multicall based on the method called (all, tryAll, tryEach)

Here a very basic example leading to the error on mainnet fork:

const	ethcallProvider = await providers.newEthCallProvider(currentProvider);
const	erc20TokenContract = new Contract(token, ERC20_ABI);
calls.push(ethcallProvider.getEthBalance(ownerAddress)); //Will use multicall1
calls.push(tokenContract.balanceOf(ownerAddress));
const	results = await ethcallProvider.tryAll(calls); //Will use multicall2

Addresses from the multicall file:

With multicall1:

  • 1: 0xeefba1e63905ef1d7acba5a8513c70307c1ce441
  • 5: 0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e
  • 1337: 0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e

With multicall2:

  • 1: 0x5ba1e12693dc8f9c48aad8770482f4739beed696
  • 5: 0x5ba1e12693dc8f9c48aad8770482f4739beed696
  • 1337: 0x5ba1e12693dc8f9c48aad8770482f4739beed696

With multicall3:

  • 1: 0xca11bde05977b3631167028862be2a173976ca11
  • 5: 0xca11bde05977b3631167028862be2a173976ca11
  • 1337: 0xca11bde05977b3631167028862be2a173976ca11

Please tell me if you want more elements!
Thank you

from ethcall.

Related Issues (20)

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.