Skip to content

Instantly share code, notes, and snippets.

@dobestan
Created July 24, 2022 11:46
Show Gist options
  • Save dobestan/ed7257355eb224b3c996d6d5627f38fc to your computer and use it in GitHub Desktop.
Save dobestan/ed7257355eb224b3c996d6d5627f38fc to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract FeedbackToken is ERC1155 {
uint256 public constant WARNINGS = 0;
uint256 public constant IS_PROFILE_POSITIVE = 1;
uint256 public constant IS_PROFILE_NEUTRAL = 2;
uint256 public constant IS_PROFILE_NEGATIVE = 3;
address public managerAddress;
modifier onlyManager() {
require(msg.sender == managerAddress);
_;
}
// TODO: ERC1155 contains metadata uri.
constructor() ERC1155("") {
// _mint input = to, id, amount, data
// TODO: refactor to batch minting
_mint(msg.sender, WARNINGS, 1000, "");
_mint(msg.sender, IS_PROFILE_POSITIVE, 1000, "");
_mint(msg.sender, IS_PROFILE_NEUTRAL, 1000, "");
_mint(msg.sender, IS_PROFILE_NEGATIVE, 1000, "");
}
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override onlyManager {
super.safeTransferFrom(from, to, id, amount);
// require(
// from == _msgSender() || isApprovedForAll(from, _msgSender()),
// "ERC1155: caller is not token owner nor approved"
// );
// _safeTransferFrom(from, to, id, amount, data);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment