Skip to content

ryley-o/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

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
Original AB Core V0 0-2 0x059EDD72Cd353dF5106D2B9cC5ab83a52287aC3a
Revised AB Core V1 3+ 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
Current Draft AB Core V3 (TBR) -

The current draft AB Core is a work in progress, ongoing changelog here.

MinterFilter Suite Compatibility Chart

  • We like new minters
  • Minters have to iteract with (at least one) core contract
  • 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) Recommended Minters Depreciated Minters
V0 (legacy minter) -
V1, V1_PRTNR MinterSetPriceV1
MinterSetPriceERC20V1
MinterDAExpV1
MinterDALinV1
MinterMerkleV0
MinterHolderV0
MinterSetPriceV0
MinterSetPriceERC20V0
MinterDAExpV0
MinterDALinV0
V2 (PBAB) (various PBAB minters) -
V3 MinterSetPriceV2
MinterSetPriceERC20V2
MinterDAExpV2
MinterDALinV2
MinterMerkleV1
MinterHolderV1
-

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

MinterSetPriceERC20

MinterDALin

MinterDAExp

Other Minter Contracts

MinterFilterV0: 0x4aafCE293b9B0faD169c78049A81e400f518E199.

Legacy minting contract: 0x47e312d99c09ce61a866c83cbbbbed5a4b9d33e7.

For deployed PBAB/PRTNR 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 may be generated via yarn docgen. Some Art Blocks contracts use NatSpec comments to automatically enrich generated documentation. Some contracts use dynamic expressions to improve user experience.

Old contracts/addresses:

Royalty Registry Overrides

Art Blocks supports lookups of all mainnet flagship, partnership, and PBAB tokens on Manifold's Royalty Registry.

Prior to the V3 core contract, royalty registry override contracts are required to 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)

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.3%
  • Other 0.7%