Created
October 28, 2021 18:42
-
-
Save mkwng/936292ab1febb6d11404ef6b54a15c75 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.2+commit.661d1103.js&optimize=true&runs=200&gist=
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// // SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.2; | |
import "@openzeppelin/contracts/access/Ownable.sol"; | |
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; | |
contract CompanionBoxcutter2000 is ERC1155, Ownable { | |
uint256 public tokenCounter; | |
uint256 public constant MAX_SUPPLY = 888; | |
uint256 public boxcutterId = 1; | |
bool private ownerMinted; | |
constructor() ERC1155("ipfs://QmZogDdfz7CCHu4C8s9MyagKHFVfK2R3ecFtEN3NxRctyf") { | |
tokenCounter = 0; | |
ownerMinted = false; | |
} | |
function mint() public returns (uint256) { | |
require(tokenCounter <= MAX_SUPPLY, "Further minting would exceed max supply"); | |
require(balanceOf(msg.sender, boxcutterId) == 0, "Each address may only mint one box cutter"); | |
_mint(msg.sender, boxcutterId, 1, ""); | |
tokenCounter = tokenCounter + 1; | |
return tokenCounter; | |
} | |
function ownerMint() public onlyOwner { | |
require(tokenCounter + 88 <= MAX_SUPPLY, "Further minting would exceed max supply"); | |
require(ownerMinted == false, "Can only be done once!"); | |
_mint(msg.sender, boxcutterId, 88, ""); | |
tokenCounter = tokenCounter + 88; | |
ownerMinted = true; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment