Truffle+Ganache调试问题求教各位大神

rhsor 2019-09-14 09:19:35
各位大神好,小弟刚接触以太坊开发,费了好大功夫装好环境,模拟智能合约又调试不过了,折腾了几个小时,有没哪位朋友能帮指点一下错误原因吗?
truffle下unbox的MetaCoin代码没修改过,直接compile,mirgaration后在console下执行如下命令,一直提示错误。万分感谢

truffle(ganache)> MetaCoin.deployed().getBalance.call(web3.eth.accounts[0])
Thrown:
evalmachine.<anonymous>:0
MetaCoin.deployed().getBalance.call(web3.eth.accounts[0])
^

TypeError: Cannot read property 'call' of undefined
at evalmachine.<anonymous>:0:31
at Script.runInContext (vm.js:133:20)
at runScript (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:535394:21)
at Console.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:535409:21)
at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:385867:18)
at bound (domain.js:402:14)
at REPLServer.runBound [as eval] (domain.js:415:12)
at REPLServer.onLine (repl.js:642:10)
at REPLServer.emit (events.js:198:13)
at REPLServer.EventEmitter.emit (domain.js:448:20)
...全文
97 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
rhsor 2019-09-15
  • 打赏
  • 举报
回复
论坛太冷清了哈。没办法,去翻了truffle官网的说明,应该是实例申明的方式在v5.0下不一样了,用let instance = await MetaCoin.deployed()后搞定了

791

社区成员

发帖
与我相关
我的任务
社区描述
区块链技术专区
区块链 技术论坛(原bbs)
社区管理员
  • 区块链技术
  • ccc908
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧