/retirement-certificate-NFT-associated-ticket

This is the smart contract that associate Retirement Certificate NFTs with special tickets that includes special privilege as "Retirement Certificate NFT-associated Ticket" (ERC-1155). Random Number generated via Chainlink VRF is associated with each Retirement Certificate NFT-associated Tickets as kind of serial number of tickets in order to avoid that fraud tickets are used in secondry market.

Primary LanguageTypeScriptMIT LicenseMIT

Retirement Certificate NFT-associated Ticket 🎫

Overview

  • This is the smart contract that associate Retirement Certificate NFTs with special tickets that includes special privilege as "Retirement Certificate NFT-associated Ticket"
    • ERC-1155 type of NFT is used for this Retirement Certificate NFT-associated Ticket.

    • This ticket is in order to incentivize people who try to offset carbons as individual climate action and increase these people in the Voluntary Carbon Market (VCM).

    • Retirement Certificate NFT are minted via existing ReFi protocols such as Toucan Protocol when user offset carbon with carbon reference tokens (eg. $BCT Token of Toncan Protocol).

      • An example of Retirement Certificate NFT (=ERC-721) that is minted via Toucan Protocol: https://polygonscan.com/token/0x5e377f16e4ec6001652befd737341a28889af002
      • NOTE: This time, I use mock of Retirement Certificate NFT instead of Toucan Protocol's one above because of limitation of time to implement this smart contract. Ideally, Retirement Certificate NFT on ReFi protocols (such as Toucan Protocol) is better in the future.

  • Random Number generated via Chainlink VRF is associated with each Retirement Certificate NFT-associated Tickets as kind of serial number of tickets in order to avoid that fraud tickets are used in secondry market. (It's also in order to prevent being manipulated by any single entity including oracle operators, miners, users, or smart contract developers)
    • Random Number is called via Chainlink VRF and saved as a metadata in the RetirementCertificateNFTAssociatedTicket.sol


Use case of Retirement Certificate NFT-associated Ticket

  • Ticket sales of professional sports teams
    • Retirement Certificate NFT-associated Ticket gated access
      • eg). Only Retirement Certificate NFT-associated Ticket holders can access special space or events in their home stadium.

  • Ticket sales of music concerts
    • Retirement Certificate NFT-associated Ticket gated access
      • eg). Only Retirement Certificate NFT-associated Ticket holders can access special space or events in their music concert hall.

Workflow

  • Diagram of workflow
    diagram-of-workflow_retirement-certificate-NFT-associated-ticket

Installation

  • Write .env by referencing .env.example
    • Then, adding .env to the root directory.

  • Install modules
yarn

  • Compile smart contracts
yarn compile

  • Generate typescript files of smart contracts for Typechain
yarn typechain

Test (Mainnet-forking test)

  • Scenario test
yarn test-scenario:retirement-certificate-NFT-associated-ticket

  • Unit test
yarn test-unit:retirement-certificate-NFT-associated-ticket

Demo (of Scenario test)


Deployment files (for using hardhat-deploy module)


Technical Stack

  • Solidity
  • ethers.js (v5)
  • Hardhat
    • Modules:
      • hardhat-deploy, etc
  • TypeChain

References