Skip to content

iyk-inc/artblocks-contracts

 
 

Repository files navigation

Art Blocks Smart Contracts

CircleCI

License

The Art Blocks artblocks-contracts repo is open source software licensed under the GNU Lesser General Public License v3.0. For full license text, please see our LICENSE declaration file.

Initial Setup

install packages

yarn

set up your environment

Create a .env file by duplicating .env.example and populating all variables.

compile

yarn compile

generate typescript contract bindings

yarn generate:typechain

run the tests

yarn test

generate coverage report

yarn coverage

generate docs

yarn docgen

(docs for main are served at https://artblocks.github.io/artblocks-contracts/#/)

format your source code

yarn format

Deployments

Deployment script templates are located in the ./scripts directory. To run a deployment script deploy.ts:

IMPORTANT - many scripts rely on typechain-generated factories, so ensure you have run yarn generate:typechain before running any deployment scripts.

yarn hardhat run --network <your-network> scripts/deploy.ts

where <your network> is any network configured in hardhat.config.js. For additional deployment details, see hardhat docs: https://hardhat.org/guides/deploying.html

Deployed Contract Details

Core Contract Versions

This is the Smart contract that controls the artwork created by the artist. No financial transactions occur on this Smart contract.

Core contracts use the versioning schema below:

Description Version Project Range Mainnet Address
AB Core V0 V0 0-2 0x059EDD72Cd353dF5106D2B9cC5ab83a52287aC3a
AB Core V1 V1 3-373 0xa7d8d9ef8D8Ce8992Df33D8b8CF4Aebabd5bD270
PBAB Cores V2_PBAB All PBAB Various - see PBAB+Collabs directory DEPLOYMENTS.md files
PRTNR Cores V2_PRTNR All PRTNR Various - see PBAB+Collabs directory DEPLOYMENTS.md files
AB Core V3 (current) V3 374+ 0x99a9B7c1116f9ceEB1652de04d5969CcE509B069

AB Core V3 changelog here, and performance metrics here.

MinterFilter Suite Compatibility Chart

The following table shows which Minters and MinterFilters are compatible with which Core contracts.

  • Note: while the whole end-to-end MinterFilter+FilteredMinter architecture is likely not the ideal fit for PBAB partners due to the infrastructure complexity required for partners integrating with it, any of the individual minters from within the minter suite can readily be adapted to work with PBAB core contracts–if you are a PBAB partner and there is a minter in the suite that this would be appealing for, please contact your account manager!
Core Contract Version(s) Minter Filter Recommended Minters Deprecated Minters
V0 - (legacy minter) -
V1, V1_PRTNR MinterFilterV0 MinterSetPriceV1
MinterSetPriceERC20V1
MinterDAExpV1
MinterDALinV1
MinterMerkleV0
MinterHolderV0
MinterSetPriceV0
MinterSetPriceERC20V0
MinterDAExpV0
MinterDALinV0
V2 (PBAB) - (various PBAB minters) -
V3, V3_Explorations MinterFilterV1 MinterSetPriceV2
MinterSetPriceERC20V2
MinterDAExpV2
MinterDALinV2
MinterMerkleV2
MinterMerkleV3
MinterHolderV1
MinterHolderV2
-

Active Minting Contract(s)

These are the smart contracts that receive funds, and split them between the artist(s) and the platform. Artists receive funds directly from these contracts.

MinterSetPrice (Set Price)

MinterSetPriceERC20 (Set Price with ERC20)

MinterDALin (Linear Dutch Auction)

MinterDAExp (Exponential Decay Dutch Auction)

MinterMerkle (Address Allowlist)

Minter Holder (Token Holder)

Other Minter Contracts

MinterFilterV0 for flagship V1 core: 0x4aafCE293b9B0faD169c78049A81e400f518E199.

MinterFilterV1 for flagship V3 core: 0x092B8F64e713d66b38522978BCf4649db14b931E.

Legacy minting contract for flagship V0 core: 0x47e312d99c09ce61a866c83cbbbbed5a4b9d33e7.

For deployed Engine/Partner/Explorations minting contracts, see PBAB directory DEPLOYMENTS.md files.

Shared Randomizers

Testnet Contracts

The following represent the current set of flagship core contracts deployed on the Goerli testnet, and their active Minter Filters:

For deployed PBAB/PRTNR core contracts, see PBAB+Collabs directory DEPLOYMENTS.md files.

Contract Documentation

Documentation for contracts us deployed via GitHub pages at: https://artblocks.github.io/artblocks-contracts/

Documentation for contracts may also be generated via yarn docgen. Most Art Blocks contracts use NatSpec comments to automatically enrich generated documentation. Some contracts use dynamic expressions to improve user experience.

Royalty Registry

Art Blocks supports lookups of all mainnet flagship, partnership, and PBAB tokens on Manifold's Royalty Registry. This enables on-chain royalty lookups for all Art Blocks NFTs, and allows for the creation of royalty streams for artists and other creators.

For core contracts V3+, Art Blocks core contracts are designed to integrate directly with Manifold's Royalty Registry. Aside from an artist and the platform defining royalty percentages/basis-points and addresses on the V3+ core contracts, no additional steps are required to register a token with the Royalty Registry.

Prior to the V3 core contract, royalty registry override contracts are needed to properly integrate with the Royalty Registry. These contracts delegate all permissions to the core contracts. The following Royalty Registry override contracts are deployed at:

Configuring PBAB Royalty Override (REQUIRED)

Upon deploying a PBAB contract, the following steps must be taken:

Tasks denoted by (scripted) are included in scripts/1_reference_pbab_suite_deployer.ts, and scripted for newly deployed PBAB projects as of 03/2022.

  • (scripted), REQUIRED Set the royalty lookup address on the royalty registry for the newly deployed contract
    • Go to the Royalty Registry and call the following function on the Royalty Registry smart contract:
      • setRoyaltyLookupAddress(<new_PBAB_coreAddr>, <PBAB_royaltyOverrideContract>)
  • (scripted), REQUIRED Set Platform royalty payment address for the new core contract in PBAB royalty override contract

    note: This step is optional in the PBAB deployer script in case platform royalty payment address is not known at time of deployment, but must be completed before royalty lookups will work

    • admin of the PBAB core contract must call the following function on the PBAB royalty override contract:
      • updatePlatformRoyaltyAddressForContract(<new_PBAB_coreAddr>, <platformRoyaltyPaymentAddress>)

Additionally, the following settings may be configured/changed by a PBAB core contract's admin at any time:

  • Change Royalty Percentages
    • renderProvider or platform Royalty BPS may be changed from default values of 2.5% to any value. This can be configured by a PBAB core contract's admin via the PBAB override contract's functions updateRenderProviderBpsForContract and updatePlatformBpsForContract.
  • Change Platform Royalty Payment Address
    • The address to receive platform royalty payments may be updated by a PBAB core contract's admin via the PBAB override contract's function updatePlatformRoyaltyAddressForContract.
  • Change Render Provider Royalty Payment Address
    • The address to receive render provider royalty payments is delegated to the token core contract, and defined as the public variable renderProviderAddress.

Configuring Art Blocks Flagship OR Partner (PRTNR) Royalty Override (REQUIRED)

Upon deploying a new Art Blocks flagship core contract or Partner (PRTNR) core contract, the following steps must be taken (NOT scripted):

  • REQUIRED Set the royalty lookup address on the royalty registry for the newly deployed contract
    • Go to the Royalty Registry to call the following function on the Royalty Registry smart contract:
      • setRoyaltyLookupAddress(<new_coreAddr>, <ArtBlocks_royaltyOverrideContract>)
  • REQUIRED Set Art Blocks royalty payment address for the new core contract in the royalty override contract
    • admin of core contract must call:
      • updateArtblocksRoyaltyAddressForContract(<new_coreAddr>, <ArtBlocksRoyaltyPaymentAddress>)

Additionally, the following settings may be configured/changed by a core contract's admin at any time:

  • Change Art Blocks Royalty Percentage
    • Royalty BPS may be changed from default values of 2.5% to any value less than or equal to the default (cannot be increased above default). This can be configured by a core contract's admin via the override contract's function updateArtblocksBpsForContract.
  • Change Art Blocks Royalty Payment Address
    • The address to receive Art Blocks royalty payments may be updated by a core contract's admin via the royalty override contract's function updateArtblocksRoyaltyAddressForContract.

Running Gas Reports for Solidity Methods & Deployments

Your .env file should contain a COINMARKETCAP_API_KEY param in order to calculate ethereum gas costs. The key value can be found in the Engineering team's shared 1Password acccount. Additionally, you'll need to add the following object within the module.exports key in hardhat.config.ts:

  gasReporter: {
    currency: "USD",
    gasPrice: 100,
    enabled: true,
    coinmarketcap: process.env.COINMARKETCAP_API_KEY
  }

After this config is finished, you'll notice a usd (avg) column in the auto-generated table that's printed when you run unit tests with yarn test. (note: gasPrice is a variable param that reflects the gwei/gas cost of a tx)

Old contracts/addresses:

Contributing

All code must pass all tests and be formatted with prettier before being merged into the main branch. To run the tests, run yarn test. To format the code, run yarn format. For additional information about our testing philosophy at Art Blocks, please see our Testing Philosophy document.

Useful References

evm.codes - An interactive guide to EVM op-code costs.

About

Smart contracts that power Art Blocks.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Solidity 60.0%
  • TypeScript 39.6%
  • Other 0.4%