Skip to main content
All CollectionsResources
Artizen Smart Contract
Artizen Smart Contract

Seasons Smart Contract

Updated over 9 months ago

Artizen Smart Contract

The Seasons contract provides a robust infrastructure for managing digital artifacts across different seasons in a decentralized manner on the Artizen platform. It leverages the ERC1155 token standard and access control mechanisms to ensure secure and efficient operation. It allows visionaries to participate in seasons to raise funds to kickstart their projects. With features for creating submissions, managing seasons, and minting artifacts, the contract offers a comprehensive platform for artists and collectors to engage in the creation and exchange of digital art.

Ethereum Mainnet Contract Address: 0x20CdDf283164ee59742c80AA5CE9b97127f123cE

Prequisits

  • Solidity version 0.8.18

  • OpenZeppelin Contracts Upgradeable library

  • Hardhat testing framework

Contract Overview

Storage Variables

  • startTokenID: Starting token ID for submissions

  • submissionCount: Total number of submissions

  • seasonCount: Total number of seasons

  • protocolWallet: Address where protocol fees are sent

  • tokenPrice: Price of each token

  • isShutdown: Flag indicating if the contract is shut down

  • latestTokenID: Latest token ID used for minting

Structs

  • Submission: Represents a submission with its token ID, season, token URI, and owner

  • Season: Represents a season with submission and token IDs, start and end times, last token ID, and closed flag

Mappings

  • seasons: Maps season IDs to Season structs

  • submissions: Maps submission IDs to Submission structs

  • artifactTopBuyer: Maps token IDs to the address of the top buyer

  • topAmontOfTokenSold: Maps token IDs to the highest amount purchased by an address

  • totalAmountOfTokensSold: Maps token IDs to the total amount of tokens sold

  • totalTokensPurchasedPerAddressPerSeason: Maps addresses and season IDs to the total tokens purchased

  • totalAmountPurchasedPerToken: Maps addresses and token IDs to the total amount of tokens purchased

  • amountToTokenIDsOfSeason: Maps season IDs and amounts to arrays of token IDs

  • isBlacklistedInSeason: Maps to a submission blacklisted in a specific season

  • amountSoldBeforeBlackList:Maps to the amount of tokens sold before blacklist

Functions

function setProtocolWalletAddress(address payable protocolWallet)

Use this function to set central protocol wallet address after deployment. This wallet is a multisig wallet that will store all funds.

  • address payable protocolWallet: address of Ethereum wallet

function setTokenPrice(uint256 price)

Sets the price of a single NFT.

  • uint256 price: token price in wei

function shutdown(bool isShutdown)

This is an emergency function that shuts all main functionalities of the contract in case of a security alert.

function createSeason( uint startTime, uint endTime)

Creates a season with given details.

  • startTime: time of the season opening, in unix timestamp

  • endTime: time of the season closing, in unix timestamp

function createSubmission(uint256 _season, string memory _tokenURI address payable _submissionOwner)

Creates a submission with given details.

  • _season: ID of season

  • _tokenURI: tokenURI for NFT

  • _submissionOwner: address of the submission owner/registered project wallet

function closeSeason(uint256 _season)

Closes a season, so there can be no more submission submitted to it. It mints the amount of each tokenID sold within the season to the protocol wallet.

  • _season: ID of season

function mintArtifact( uint[] memory submissionID, uint[] memory amount)

Mints given amount of open edition artifacts to buyers wallet. It records a balance for the submission owner (artist) to be able to claim their tokens as well as other calculations for the leaderboard and the top submission of the season.

  • submissionID: ID of submission

  • amount: amount to mint for user

function artistClaim( uint[] memory submissionID,uint[] memory amount)

Submission owners (artists) can claim copies of their own artifacts according to their claim balance. The maximum amount of artifacts to claim is equivalent to the maximum amount of artifacts sold at any given time. Once their claim balance is 0, they claimed all available artifacts.

  • submissionID: ID of submission

  • amount: amount to mint for user

function calculateTopSubmissionsOfSeason(uint _seasonID)

Calculates the top submission with the most open edition NFTs sold. This function doesn't return any data, you have to call getSeason or getTopSubmissionOfSeason view functions to see the results.

  • _season: ID of season

function withdraw()

Withdraws all ETH from the contract to the protocol wallet.

Did this answer your question?