Skip to content

Smart contracts and test suite for the intrinsic.art generative art NFT platform

License

Notifications You must be signed in to change notification settings

intrinsic-art/intrinsic-art-contracts

Repository files navigation

mypic

Smart Contracts Overview

The intrinsic.art NFT platform enables artists to define generative traits as fungible tokens (ERC-1155), and collectors to combine their favorite traits to purchase a unique, customized artwork (ERC-721). The smart contracts consist of three primary contracts which are outlined below.

Artwork.sol

The Artwork contract implements the ERC-721 standard for representing the Artwork NFTs, and an instance is deployed per art project. These artwork tokens contain the underlying trait tokens which define the appearance of the generative art output. This contract stores the javascript generative art scripts that render the artwork in a web browser. This contract includes functions for creating these artwork tokens using trait tokens, and for decomposing the artwork into its corresponding traits.

Traits.sol

The Traits contract implements the ERC-1155 standard for representing the Trait NFTs, and an instance is deployed per art project. These trait tokens contain a human readable name string that describes the trait, and also a value string that is injected into the generative art javascript code as an input to define the appearance of the artwork. This contract also includes functionality for a Dutch Auction, which is the mechanism used for the primary sales of the trait tokens.

ProjectRegistry.sol

The Project Registry contract records the Artwork and Trait contract addresses that have been deployed for each new art project.

Local Setup & Testing

Clone the repository:

git clone ...

Lookup the recommended Node version to use in the .nvmrc file and install and use the correct version:

nvm install 
nvm use

Install necessary dependencies:

npm install

Compile contracts to create typechain files:

npm run compile

Run the tests

npm run test

Deploy System

npx hardhat node

Example Deployment & Project Creation Scripts

Deploy the contracts

npx hardhat deploy --network baseSepolia

Deploy project contracts, verify on Etherscan, and register project on registry

npx hardhat DeployMetta --network baseSepolia
npx hardhat DeployTackLineTorn --network baseSepolia
npx hardhat DeployOneRing --network baseSepolia

Escapify Project Scripts & Descriptions

Project scripts and descriptions are stored in the bytecode of string storage smart contracts to save on deployment gas. The escapify script can be used to escape quotes, newlines, and backslashes:

npm run EscapifyJSON -- projectConfigs/metta/description
npm run EscapifySolidity -- projectConfigs/metta/metadata.json
npm run EscapifySolidity -- projectConfigs/metta/script

Test Coverage

npx hardhat coverage

About

Smart contracts and test suite for the intrinsic.art generative art NFT platform

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published