我使用 npm 安装了 zeppelin-solidity 包,以使用 erc-721 合约。
但问题是,当我使用 truffle compile 时,会出现以下错误:
/Users/me/dev/myfolder/erc721/node_modules/zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol:1:1: ParserError: Source file requires different compiler version (current compiler is 0.5.16+commit.9c3226ce.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version
pragma solidity ^0.4.24;
^----------------------^
Error: Truffle is currently using solc 0.5.16, but one or more of your contracts specify "pragma solidity ^0.4.24".
Please update your truffle config or pragma statement(s).
(See https://truffleframework.com/docs/truffle/reference/configuration#compiler-configuration for information on
configuring Truffle to use a specific solc compiler version.)
编译失败。看上面。
我看到的一些答案建议将 pragma solidity 提高到 0.5,但是如何更改包含文件中的版本?
另外,如果这个合同是旧的,我应该使用它,还是有更好的 erc721 实现可用?
更新:我尝试如下更改 solc 编译器,但错误仍然存在:
compilers: {
solc: {
version: "^0.4.24",
//parser: "solcjs",
optimizer: {
enabled: true,
runs: 200
}
}
}