Skip to content

Instantly share code, notes, and snippets.

@leeduckgo
Created January 8, 2024 07:38
Show Gist options
  • Save leeduckgo/682a63e504626b553b923b554c7bbdb0 to your computer and use it in GitHub Desktop.
Save leeduckgo/682a63e504626b553b923b554c7bbdb0 to your computer and use it in GitHub Desktop.
MoveSpaceTaggerCollection
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title ItemTagger v1.0.0
* @dev Implements tagger process along with judger.
*/
contract ItemTagger {
address public chairperson;
string public vectorName;
string public vectorDescription;
uint256 public tagIndex;
uint256 public judgeIndex;
struct Tag {
uint256 assetId;
string metadata; // arweave transaction id
address creator;
}
mapping(uint256 => Tag) public tags;
mapping(uint256 => bool) public judges;
event TagSet(address indexed tagger, uint256 assetId, string metadata);
event JudgeSet(uint256 tagIndex, bool decide);
constructor(string memory _vectorName, string memory _vectorDescription) {
chairperson = msg.sender;
vectorName = _vectorName;
vectorDescription = _vectorDescription;
tagIndex = 0;
}
function tagItem(uint256 _assetId, string memory _metadata) public {
tags[tagIndex] = Tag(_assetId, _metadata, msg.sender);
emit TagSet(msg.sender, _assetId, _metadata);
tagIndex+=1;
}
function judgeTag(uint256 _tagIndex, bool _decide) public {
require(msg.sender == chairperson, "Caller is not chairman");
judges[judgeIndex] = _decide;
emit JudgeSet(_tagIndex, _decide);
judgeIndex+=1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment