当我试图在我的react前端与我的智能合约交互时,我收到了这个错误消息。我正在运行localhost3000,它需要元掩码才能登录。
Unhandled Rejection (Error): call revert exception (method="symbol()", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.8)
Logger.makeError
/Users/username/Desktop/final-4/src.ts/index.ts:205
Logger.throwError
/Users/username/Desktop/final-4/src.ts/index.ts:217
Interface.decodeFunctionResult
/Users/username/Desktop/final-4/src.ts/interface.ts:326
323 | eventFragment = this.getEvent(eventFragment);
324 | }
325 | const topics = [];
> 326 | const dataTypes = [];
| ^ 327 | const dataValues = [];
328 | if (!eventFragment.anonymous) {
329 | topics.push(this.getEventTopic(eventFragment));
View compiled
Contract.<anonymous>
/Users/username/Desktop/final-4/src.ts/index.ts:309
fulfilled
http://localhost:3000/static/js/0.chunk.js:5079:24同样在inspect中的source选项卡中:
未捕获(in promise)错误:调用还原异常(method="symbol()",errorSignature=null,errorArgs=null,reason=null,code=CALL_EXCEPTION,version=abi/5.0.8)未捕获(in promise)错误:调用还原异常(method="balanceOf(address)",errorSignature=null,errorArgs=null,reason=null,code=CALL_EXCEPTION,version=abi/5.0.8)
下面是我的目录结构:
client
|--node_modules
|-—public
|—-src
|—-contracts
|—-Address.json
|—-Context.json
|—-ERC20.json
|—-IERC20.json
|—-Migrations.json
|—-PreciousChicken.json
|——SafeMath.json
|—-App.css
|—-App.js
|—-App.test.js
|—-index.css
|—-logo.svg
|—-reportWebVitalls.js
|—-setupTests.js
|—-gitignore
|—-package-lock.json
|—-package.json
|—-yarn.lock
|—-contracts
|—-Migrations.sol
|—-MyPreciousToken
|—-migrations
|—-1_initial_migations.js
|—-2_deploy_contracts.js
|—-node-modules
|—-test发布于 2021-05-19 10:54:52
当您的智能合约尚未部署时,会发生此错误(CALL_EXCEPTION)。
等待事务结束:
await contract.deployTransaction.wait()发布于 2021-11-15 18:54:02
对我来说,原因是当我重新部署契约时,在构建中生成的契约json文件也需要在我的react应用程序中替换。
发布于 2021-11-30 01:52:02
在钱包中连接适当的测试网络可以防止在测试网络中构建智能合约时出现此问题。例如,对我来说,我必须在钱包中连接Rinkeby网络,但实际上指向的是一个主网络。
https://stackoverflow.com/questions/64951267
复制相似问题