Skip to content

Instantly share code, notes, and snippets.

@jochasinga
Created July 14, 2022 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jochasinga/8644723116bfeaba22cb0e257acd36bf to your computer and use it in GitHub Desktop.
Save jochasinga/8644723116bfeaba22cb0e257acd36bf to your computer and use it in GitHub Desktop.
Implementing event tickets as ERC-1155 tokens
// contracts/EventTickets.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
contract EventTicket is ERC1155 {
// Declare all the type IDs
uint256 public constant GENERAL = 0;
uint256 public constant VIP = 1;
uint256 public constant RSVP = 2;
constructor() public ERC1155("ipfs://storage.link/bafyreidtc6fs4xrnc5b7klvvtrs2bsijkt54qqnonk54stkjj3rtdb5wee/{id}.json") {
_mint(msg.sender, GENERAL, 10**2, "");
_mint(msg.sender, VIP, 1, "");
_mint(msg.sender, RSVP, 20, "");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment