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.
- Admin management
- Season management
- Member management
- Metadata management
- Non-transferable membership tokens
- Solidity ^0.8.9
- OpenZeppelin Contracts library
Install the OpenZeppelin Contracts library:
npm install @openzeppelin/contracts
- Deploy the
BZDMembershipNFTs
contract. - Use admin management functions to add or remove admins.
- Use season management functions to set the current season.
- Use member management functions to mint and burn membership tokens for each season.
Add an admin to the contract.
function addAdmin(address admin) public onlyAdmin
Remove an admin from the contract.
function removeAdmin(address admin) public onlyAdmin
Returns the number of admins.
function adminsCount() public view returns (uint256)
Set the current season.
function setCurrentSeason(uint256 seasonId) public onlyAdmin
Returns the number of members for the season.
function membersForSeason(uint256 seasonId) public view returns (address[] memory)
Mints membership NFTs to the specified addresses for the current season.
function mintAndAddMembersToSeason(address[] calldata members, uint256 seasonId) public onlyAdmin
Burns the membership NFT for the specified address and season.
function burnAndRemoveMemberFromSeason(address member, uint256 seasonId) public onlyAdmin
Returns the URI for the specified token ID.
function uri(uint256 tokenId) public view override returns (string memory)
This smart contract is released under the MIT License.
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
- 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
- Solidity ^0.8.9
- OpenZeppelin Contracts library
Install the OpenZeppelin Contracts library:
npm install @openzeppelin/contracts
- Inherit or initialize the
BZDMembershipDirectory
contract in your smart contract. - Use the
addMember
andremoveMember
functions to manage the membership. - Use the
memberByIndex
andmembers
functions to access the members.
Access each member by index.
function memberByIndex(uint256 index) public view returns (address)
Access all members in the set.
function members() public view returns (address[] memory)
Add a member to the membership directory.
function addMember(address member) public onlyOwner
Remove a member from the membership directory.
function removeMember(address member) public onlyOwner
This smart contract is released under the MIT License.