ccniuj / optimistic-rollup-example-erc721

Optimistic Rollup Example: ERC721
MIT License
10 stars 5 forks source link

Error on step to confirm the balance of the owner of tokens in L1 #2

Open jensendarren opened 2 years ago

jensendarren commented 2 years ago

When executing the following in Hardhat console for confirm the balance of the owner of tokens in L1:

await ERC721.connect(deployer).balanceOf(deployer.address)

There is the following error returned:

Uncaught:
Error: call revert exception (method="balanceOf(address)", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION, version=abi/5.3.0)
    at step (./optimistic-rollup-example-erc721/node_modules/@ethersproject/contracts/lib/index.js:48:23)
    at Contract.<anonymous> (./optimistic-rollup-example-erc721/node_modules/@ethersproject/contracts/src.ts/index.ts:321:44)
    at Interface.decodeFunctionResult (./optimistic-rollup-example-erc721/node_modules/@ethersproject/abi/src.ts/interface.ts:384:23)
    at Logger.throwError (./optimistic-rollup-example-erc721/node_modules/@ethersproject/logger/src.ts/index.ts:225:20)
    at Logger.makeError (./optimistic-rollup-example-erc721/node_modules/@ethersproject/logger/src.ts/index.ts:213:28) {
  reason: null,
  code: 'CALL_EXCEPTION',
  method: 'balanceOf(address)',
  errorArgs: null,
  errorName: null,
  errorSignature: null,
  address: '0xFD471836031dc5108809D173A067e8486B9047A3',
  args: [ '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266' ],
  transaction: {
    data: '0x70a08231000000000000000000000000f39fd6e51aad88f6f4ce6ab8827279cfffb92266',
    to: '0xFD471836031dc5108809D173A067e8486B9047A3',
    from: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'
  }
}

I am running Optimism in Docker using the latest build version of Optimism Monorepo (SHA 349279289).

I've followed all the steps successfully up to this point with the nodes running (in Docker), contracts deployed, tokens minted etc. Is there anything that I am missing?

Thank you for your support.

jensendarren commented 2 years ago

I figured this out and managed to get this tutorial working without any issues.

The mistake I made was not using the contract addresses that were returned by the deploy.js script in my Hardhat terminals. So anyone who is following this tutorial, be sure to use the returned addresses from that script when running through the examples in Hardhat and everything should work perfectly! :)