Giter VIP home page Giter VIP logo

membership-nft's Introduction

BZDMembershipNFTs

This is a smart contract that manages BuZhiDAO seasonal membership NFTs using the ERC1155 standard. The contract is responsible for minting, burning, and managing membership tokens for each season.

Features

  • Admin management
  • Season management
  • Member management
  • Metadata management
  • Non-transferable membership tokens

Requirements

  • Solidity ^0.8.9
  • OpenZeppelin Contracts library

Installation

Install the OpenZeppelin Contracts library:

npm install @openzeppelin/contracts

Usage

  1. Deploy the BZDMembershipNFTs contract.
  2. Use admin management functions to add or remove admins.
  3. Use season management functions to set the current season.
  4. Use member management functions to mint and burn membership tokens for each season.

Functions

addAdmin

Add an admin to the contract.

function addAdmin(address admin) public onlyAdmin

removeAdmin

Remove an admin from the contract.

function removeAdmin(address admin) public onlyAdmin

adminsCount

Returns the number of admins.

function adminsCount() public view returns (uint256)

setCurrentSeason

Set the current season.

function setCurrentSeason(uint256 seasonId) public onlyAdmin

membersForSeason

Returns the number of members for the season.

function membersForSeason(uint256 seasonId) public view returns (address[] memory)

mintAndAddMembersToSeason

Mints membership NFTs to the specified addresses for the current season.

function mintAndAddMembersToSeason(address[] calldata members, uint256 seasonId) public onlyAdmin

burnAndRemoveMemberFromSeason

Burns the membership NFT for the specified address and season.

function burnAndRemoveMemberFromSeason(address member, uint256 seasonId) public onlyAdmin

uri

Returns the URI for the specified token ID.

function uri(uint256 tokenId) public view override returns (string memory)

License

This smart contract is released under the MIT License.

BZDMembershipDirectory

This is a smart contract that manages a membership directory using a set-like data structure that's not natively supported in Solidity. The contract allows for adding and deleting members while being able to list all members. And is used for both members and admins in the above membership NFT contract

Features

  • Member count tracking
  • Membership status tracking
  • Timestamp tracking for joining and removal of members
  • Access to each member by index
  • Access to all members in the set

Requirements

  • Solidity ^0.8.9
  • OpenZeppelin Contracts library

Installation

Install the OpenZeppelin Contracts library:

npm install @openzeppelin/contracts

Usage

  1. Inherit or initialize the BZDMembershipDirectory contract in your smart contract.
  2. Use the addMember and removeMember functions to manage the membership.
  3. Use the memberByIndex and members functions to access the members.

Functions

memberByIndex

Access each member by index.

function memberByIndex(uint256 index) public view returns (address)

members

Access all members in the set.

function members() public view returns (address[] memory)

addMember

Add a member to the membership directory.

function addMember(address member) public onlyOwner

removeMember

Remove a member from the membership directory.

function removeMember(address member) public onlyOwner

License

This smart contract is released under the MIT License.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.