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 submissionssubmissionCount
: Total number of submissionsseasonCount
: Total number of seasonsprotocolWallet
: Address where protocol fees are senttokenPrice
: Price of each tokenisShutdown
: Flag indicating if the contract is shut downlatestTokenID
: Latest token ID used for minting
Structs
Submission
: Represents a submission with its token ID, season, token URI, and ownerSeason
: 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 structssubmissions
: Maps submission IDs to Submission structsartifactTopBuyer
: Maps token IDs to the address of the top buyertopAmontOfTokenSold
: Maps token IDs to the highest amount purchased by an addresstotalAmountOfTokensSold
: Maps token IDs to the total amount of tokens soldtotalTokensPurchasedPerAddressPerSeason
: Maps addresses and season IDs to the total tokens purchasedtotalAmountPurchasedPerToken
: Maps addresses and token IDs to the total amount of tokens purchasedamountToTokenIDsOfSeason
: Maps season IDs and amounts to arrays of token IDsisBlacklistedInSeason
: Maps to a submission blacklisted in a specific seasonamountSoldBeforeBlackList
: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 timestampendTime
: 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 submissionamount
: 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 submissionamount
: 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.