Rubilmax / ethers-multicall-provider

⚡🕰️ Call any set of functions from any set of smart contracts in a single RPC query, seamlessly using ethers' providers API!
https://github.com/Rubilmax/ethers-multicall-provider
MIT License
62 stars 7 forks source link

Support for RedBelly Testnet #66

Closed bytes0xcr6 closed 4 months ago

bytes0xcr6 commented 4 months ago

Hi!

RedBelly just launched their testnet and I have deployed the MULTICALL3 contract under the next address: 0x9f75981388Bed36E6D4fBE402Effb1f42e120f43

Is there any chance you could add it to the available chains? Please.

Node RPC URL: https://governors.testnet.redbelly.network
Chain ID: 153
Network name: Redbelly Network Testnet
Token symbol: RBNT
Block explorer URL: https://explorer.testnet.redbelly.network
Rubilmax commented 4 months ago

Because the initcode does not match Ethereum mainnet's multicall3 initcode and the RedBelly testnet explorer does not provide source code verification, I cannot add this deployment to the configuration for safety reasons

However, starting from 6.4.0, you can now write to configuration constants and add your own programmatically:

multicall3ChainAddress[153] = "0x9f75981388Bed36E6D4fBE402Effb1f42e120f43";
multicall3DeploymentBlockNumbers[153] = 19_896;
bytes0xcr6 commented 4 months ago

Thanks for the reply @Rubilmax

I have updated the version to "6.4.0" but I am getting an error when running the next script. Any idea? The error is due to "bind" being undefined, but it looks to be something from the "ethers-multicall-provider" package, as I don´t use "bind" anywhere in the code.

TypeError: Cannot read properties of undefined (reading 'bind') at MulticallWrapper.wrap (c:\Users\elric\dev\3a-protocol-api\node_modules\ethers-multicall-provider\lib\multicall-provider.js:128:44) at getChainData (c:\Users\elric\dev\3a-protocol-api\utils\get_chain_data.js:21:46) at Object. (c:\Users\elric\dev\3a-protocol-api\utils\get_chain_data.js:29:1) at Module._compile (node:internal/modules/cjs/loader:1358:14) at Module._extensions..js (node:internal/modules/cjs/loader:1416:10) at Module.load (node:internal/modules/cjs/loader:1208:32) at Module._load (node:internal/modules/cjs/loader:1024:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:174:12) at node:internal/main/run_main_module:28:49

Node.js v20.13.1


- Script: 
```Javascript
const ethers = require('ethers');
const {
  MulticallWrapper,
  multicall3ChainAddress,
  multicall3DeploymentBlockNumbers
} = require('ethers-multicall-provider');
require('dotenv').config();

async function getChainData(chain = process.env.CHAIN) {

  // Adding new chain and multicall3 contract
  multicall3ChainAddress[153] = "0x9f75981388Bed36E6D4fBE402Effb1f42e120f43";
  multicall3DeploymentBlockNumbers[153] = 19896;

  const provider = new ethers.providers.JsonRpcProvider("https: //governors.testnet.redbelly.network");
  const multiCallProvider = MulticallWrapper.wrap(provider);

  return {
    provider,
    jsonData,
    multiCallProvider
  };
}

module.exports = getChainData;
Rubilmax commented 4 months ago

What version were you using before upgrading? What version of ethers are you using?

bytes0xcr6 commented 4 months ago

The problem was the ethers version.

Solved! Thanks for your help @Rubilmax