# Condor 紫色Dapper获取

By [Tokenmore](https://paragraph.com/@tokenmore) · 2022-09-26

---

1.打开Remix,创建一个空白模板，命名abc.sol

[https://remix.ethereum.org/](https://remix.ethereum.org/)

![](https://storage.googleapis.com/papyrus_images/fc86ed6d4d9c958d5d52982a7c9c098b305d8a271df7e4aebdf9aadeee7c0206.png)

2\. 将以下代码粘贴至abc.sol，编译器选择0.8.7，右键点击 complie

    pragma solidity ^0.8.0;
    
    // import "hardhat/console.sol";
    
    contract Comments {
      // Exposed data structure
      struct Comment {
        uint32 id;
        string topic;
        address creator_address;
        string message;
        uint256 created_at;
      }
    
      // Notify users that a comment was added
      event CommentAdded(Comment comment);
    
      uint32 private idCounter;
      mapping(string => Comment[]) private commentsByTopic;
    
      // Fetch a list of comments for a topic
      function getComments(string calldata topic) public view returns(Comment[] memory) {
        return commentsByTopic[topic];
      }
    
      // Persist a new comment
      function addComment(string calldata topic, string calldata message) public {
        Comment memory comment = Comment({
            id: idCounter,
            topic: topic,
            creator_address: msg.sender,
            message: message,
            created_at: block.timestamp
        });
        commentsByTopic[topic].push(comment);
        idCounter++;
        emit CommentAdded(comment);
      }
    
      // Delete comment
      function deleteComment(string calldata id) public {}
    }
    

3.如下图所示进行合约部署，切换到condor链，连接Metamask, 单击deploy. 支付gas后复制生成的合约代码，下一步用到。

![](https://storage.googleapis.com/papyrus_images/391c57d490ceef80f3f28599a2bc86c94f48d944ec90848435eeeec283e722ff.png)

3\. 打开[replit](https://replit.com/@phantum/Condor-User-Comment?v=1) , 点击fork

![](https://storage.googleapis.com/papyrus_images/14dbbd580bdf7f46fe63cf8770e391131e69a1a514aad707eb1c8479c2806584.png)

4\. 找到 hooks>useCommentsContract.ts 文件，用刚刚生成的合约，替换第160行的合约，之后运行

![](https://storage.googleapis.com/papyrus_images/3957e7a6c81cb3b35531260f31f7cb41028c7192f95c66594a401ba04d51ed2d.png)

![](https://storage.googleapis.com/papyrus_images/41b28e5942ff43507e254bfbf9072c58a9e530a6852f8f2b2ab71143847ba85e.png)

5.复制url 去discord提交（提交时候，repl得处于运行状态，等拿到角色后可以关闭网页）

![](https://storage.googleapis.com/papyrus_images/61c9d3f5ddb49af926b62b62708affa86de1ac181a9c570c858af22958d09521.png)

---

*Originally published on [Tokenmore](https://paragraph.com/@tokenmore/condor-dapper)*
