TypeError: This type is only supported in the new experimental ABI encoder. Use "pragma experimental ABIEncoderV2;" to enable the feature.

进行智能合约编写和编译:

第一次进行智能合约编写时,会遇到错误。当编写好智能合约文件后,在命令行输出truffle compile时,出现一下错误:
具体运行时的错误结果图片

开发工具

Atom代码编辑器
truffle 开发框架
npm包管理工具

解决办法

在智能合约文件文件中的solidity语言版本说明那行代码后插入一行代码“pragma experimental ABIEncoderV2;”,再次编译就可以通过。

运行结果

插入代码后的运行结果

Logo

Agent 垂直技术社区,欢迎活跃、内容共建。

更多推荐