Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execution failed #82

Open
trybye opened this issue Jan 25, 2024 · 0 comments
Open

Execution failed #82

trybye opened this issue Jan 25, 2024 · 0 comments

Comments

@trybye
Copy link

trybye commented Jan 25, 2024

const ethereumMulticall = require("ethereum-multicall");
const { ethers } = require("ethers");

//   let provider = ethers.getDefaultProvider();

async function go() {
  // you can use any ethers provider context here this example is
  // just shows passing in a default provider, ethers hold providers in
  // other context like wallet, signer etc all can be passed in as well.
  const multicall = new ethereumMulticall.Multicall({
    nodeUrl: "https://bsc-pokt.nodies.app",
    tryAggregate: true,
  });

  const contractCallContext = [
    {
      reference: "testContract2",
      contractAddress: "0x55d398326f99059fF775485246999027B3197955",
      abi: [
        {
          name: "totalSupply",
          type: "function",
          inputs: [],
          outputs: [{ name: "", type: "uint256" }],
        },
      ],
      calls: [
        {
          reference: "fooTwoCall",
          methodName: "totalSupply",
          methodParameters: [],
        },
      ],
    },
  ];

  const results = await multicall.call(contractCallContext);
  console.log(results);
}

go();

Fail msg

/Users/js/node_modules/@ethersproject/logger/lib/index.js:238
        var error = new Error(message);
                    ^

Error: unable to determine stateMutability (argument="value", value={"name":"totalSupply","type":"function","inputs":[],"outputs":[{"name":"","type":"uint256"}]}, code=INVALID_ARGUMENT, version=abi/5.7.0)
    at Logger.makeError (/Users/js/node_modules/@ethersproject/logger/lib/index.js:238:21)
    at Logger.throwError (/Users/ll/code/js/node_modules/@ethersproject/logger/lib/index.js:247:20)
    at Logger.throwArgumentError (/Users/ll/code/js/node_modules/@ethersproject/logger/lib/index.js:250:21)
    at verifyState (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:588:16)
    at FunctionFragment.fromObject (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:728:21)
    at Fragment.fromObject (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:371:41)
    at Fragment.from (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/fragments.js:363:25)
    at /Users/ll/code/js/node_modules/@ethersproject/abi/lib/interface.js:101:41
    at Array.map (<anonymous>)
    at new Interface (/Users/ll/code/js/node_modules/@ethersproject/abi/lib/interface.js:100:65) {
  reason: 'unable to determine stateMutability',
  code: 'INVALID_ARGUMENT',
  argument: 'value',
  value: {
    name: 'totalSupply',
    type: 'function',
    inputs: [],
    outputs: [ { name: '', type: 'uint256' } ]
  }
}

Node.js v18.17.1

"ethereum-multicall": "^2.21.0",
"ethers": "^5.7.0",

What's the matter with the code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant