Smart contracts to create Blueprints (series of NFTs) for the async platform
This repository contains the smart contracts source code for the Async Blueprints Protocol. The repository uses Hardhat as development enviroment for compilation, testing and deployment tasks.
This smart contract allows for the creation of non-fungible tokens (NFTS) using the ERC721 standard. A blueprint is then a series of NFT artworks that are static images generated from provably random layers.
An artist can create a blueprint of a series of pieces and sell them using this smart contract. Fans of the artist can then purchase a provably random artwork related to the blueprint.
A blueprint must be prepared before sales can begin. The preparation of a Blueprint is restricted only to the Async platform and can be configured by specifying the following:
- The blueprint artist: the creator of the artwork and a recipient of fees.
- The capacity of artworks associated with the blueprint.
- The price per blueprint artwork.
- An ERC20 token address if the payment must be made in a token that is not Eth (if the payment should be an Eth amount, then this address must be the 0 address).
- Random Seed Signature Hash
- Base Token URI
- Fee Recipients: an array of alternative fee recipients can be specified. If not then fee recipients are defaulted to the Async fee recipient.
- Fee BPS that align with the above fee recipients. Must match the number of entries in the provided fee recipients.
- A Merkleroot can be provided that allows for whitelisted addresses to make a purchase prior to the sale commencing.
- A presale amount of artwork that the artist can mint. This number can be set to allow the artist to mint artwork in the blueprint for free prior to the sale commencing.
- A presale amount of artwork that the platform can mint. This number can be set to allow the platform to mint artwork in the blueprint for free prior to the sale commencing.
The admin of the Blueprint contract can perform the following tasks:
If a blueprint has been prepared, the admin can begin the sale and allow users to purchase the blueprint artwork.
If a sale has started, the admin can pause the sale and stop users from purchasing blueprint artwork. The sale can also be unpaused to allow purchasing to resume.
If a blueprint has been prepared, the admin can update the base token URI for that blueprint.
The platform can reveal the seed of a prepared blueprint. This function will emit an event with the blueprint ID and corresponding seed.
The default fee recipient can be set to recieve a percentage of all sales. The percentage is initially set to 5% but can be updated in basis points of 10000.
The platform address can be updated. This address is assigned the admin role and is able to perform all of the above functions.
Once the platform has started the sale, any user can purchase blueprint artwork as long as they meet the price. The purchaser can purchase multiple artworks at once, but they must match the exact price in Eth or ERC20 token specified for that blueprint.
If a user is on the whitelist for a blueprint, the blueprint sale does not need to be started for them to purchase the artwork. However a Merkle proof must be provided that matches the artists address and the quantity of artworks they are whitelisted for.
The platform or the blueprint artist are able to mint blueprint artworks for free prior to the sale starting. When the blueprint is prepared an amount can be allocated to the platform and the artist that they are allowed to mint presale.
First clone this repository and enter the directory.
Install dependencies:
$ yarn
We use Hardhat and hardhat-deploy
To run integration tests:
$ yarn test
To run coverage:
$ yarn coverage
To deploy to Rinkeby: create a secretManager.js containing the required private keys(see secretsManager.example.js) then run:
$ yarn deploy-rinkeby
To verify the contract on rinkeby
yarn verify <implementation_address>
Mainnet
- Factory: https://etherscan.io/address/0xAB98CD0e04Bb1FCd6320611fCAD6a7e534d8B302
- BlueprintV12 Beacon: https://etherscan.io/address/0x8fDA94A8DEAacA397DF8c6d3C87d458126e91212
- CreatorBlueprints Beacon: https://etherscan.io/address/0x78896B7392a6aD0D0BFA89833BA57bC572784E41
Goerli
- Factory: https://goerli.etherscan.io/address/0xcd104F999f1aC224fEBeFA054515F9C2b38cb925#code
- CreatorBlueprints Beacon: https://goerli.etherscan.io/address/0xE1a12a84691A55Ae2a13A712bf58b4A8a9AaC05B#code
- BlueprintV12 Beacon: https://goerli.etherscan.io/address/0xc3E5CE463Ccf7158cE45c08B15c7B34884DE0684#code