简体   繁体   English

我需要帮助来建立具有5.0版或更高版本的ERC-721合同

[英]I need help to build ERC-721 contract with solidity version 5.0 or higher

I am trying to write a contract with ERC-721 token system. 我正在尝试与ERC-721令牌系统签订合同。 I have experience with ERC-20, so I thought I can find a tutorial and follow the tutorial. 我具有ERC-20的经验,因此我认为可以找到一个教程并按照该教程进行操作。 However, tutorials I found are based on solidity version between 4.0~4.2. 但是,我发现的教程基于4.0〜4.2之间的solidity版本。 Nowadays we use 5.0~6.0. 如今我们使用5.0〜6.0。 Therefore tutorial codes are not working. 因此,教程代码不起作用。 Is there any tutorial, or code can I look and learn? 是否有任何教程,或者我可以阅读和学习代码? HELP! 救命!

I tried to fix the code, and make suitable for 5.0 or higher, but I failed. 我试图修复该代码,并使其适用于5.0或更高版本,但失败了。 Therefore I tried to downgrade solidity and use docker but still get 因此,我尝试降级稳定性并使用docker,但仍然得到

Error: CompileError: ParsedContract.sol:3:1: ParserError: Source "zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol" not found: Unknown exception in read callback. 错误:CompileError:ParsedContract.sol:3:1:ParserError:未找到源“ zeppelin-solidity / contracts / token / ERC721 / ERC721Token.sol”:读回调中的未知异常。 import 'zeppelin-solidity/contracts/token/ERC721/ERC721Token.sol'; 导入'zeppelin-solidity / contracts / token / ERC721 / ERC721Token.sol'; this error. 这个错误。 :( :(

+ I found https://github.com/OpenZeppelin/openzeppelin-solidity , this but I do not know how to write test. +我找到了https://github.com/OpenZeppelin/openzeppelin-solidity ,但是我不知道如何编写测试。 Thank you for your time to read this !. 感谢您抽出宝贵的时间阅读此内容!

due to renaming, ERC721Token.sol is no longer available in the latest version of OpenZeppelin v2.3.0. 由于重命名,因此ERC721Token.sol在最新版本的OpenZeppelin v2.3.0中不再可用。 change ERC721Token.sol to ERC721.sol , and it should work. ERC721Token.sol更改为ERC721.sol ,它应该可以工作。

I suggest you have a look at the OpenZeppelin documentation: https://docs.openzeppelin.org/v2.3.0/tokens#erc721 我建议您看一下OpenZeppelin文档: https ://docs.openzeppelin.org/v2.3.0/tokens#erc721

If you have more questions about OpenZeppelin you can always ask in the community forum 如果您对OpenZeppelin有更多疑问,可以随时在社区论坛中提问

I can put together a sample contract in the community forum if you need. 如果需要,我可以在社区论坛中整理一份合同样本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 ERC-721 智能合约与另一个智能合约连接起来 - How to connect a ERC-721 smart contract with another smart contract @solana/web3.js ERC721 元数据有 API 吗? - @solana/web3.js Is there an API for ERC721 Metadata? 固体合同中的代币自动转移 - Automatic Transfer of Token in Solidity Contract 检测发送到合约的 ERC20 代币 -? - Detection of ERC20 tokens sent to Contract -? 如何在 Solidity 智能合约中启用 Claim Tokens? - How to enable Claim Tokens in Solidity Smart Contract? 在 ERC20 合约中设置最大代币数量的问题 - Issues setting a maximum amount of tokens in ERC20 contract 尝试编译 Solidity 令牌合约但不断收到编译错误 - Trying to compile solidity token contract but keep getting compile error Solidity 库 openzeppelin-solidity/contracts/utils/Context.sol:15:1: ParserError: Expected pragma, abstract contract Context { ^------^ - Solidity library openzeppelin-solidity/contracts/utils/Context.sol:15:1: ParserError: Expected pragma, abstract contract Context { ^------^ 以太坊ERC20代币合约通过重新混合部署的合约地址添加到钱包时返回0.00代币余额 - Ethereum ERC20 Token contract returns 0.00 token balance when it added to wallet by remix deployed contract address 如何修复 Solidity 上的 Stack Too Deep 错误? - How do I fix Stack Too Deep Error on Solidity?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM