Infinite Tiles v2 (https://Tiles.wtf)
Inspired by both Neoplastics and Infinite Tiles v1 algorithm, this repo reversed-engineered the TilesDAO's minified api-server at Tiles-API to derive the Tile generation algorithm to implement it in Solidity. Infinite Tiles generates a Tile for each Ethereum address. The repository uses Typescript and Solidity.
The Smart Contracts for Infinite Tiles uses an (on-chain) content provider and a pricing resolver. The front-end gallery, minting manager, and Juicebox treasury were written with Svelte and Typescript.
The Tiles minting front-end as well as an operational Juicebox Treasury together make Tiles-wtf-gallery a helpful reference source for anyone interested in a full-featured decentralized application or DAPP.
There are three different minting options in the contract.
mint()
The first allows the caller to mint a tile with their own address;grab(address)
The second allows the caller to mint a tile with an arbitraty address; andseize()
The last function allows the caller to seize the tile for their address from the current owner.
Prices depend on the current amount of Tiles already minted, the price starts at 0.0001 Ether
and doubles every 512 mints
. These two numbers are configuration parameters. Holders of the original Tiles NFTs at 0x64931F06d3266049Bf0195346973762E6996D764 can mint their Tiles on this contract for free.
The contract itself also has a merkleMint()
function, but that is not used in the current deployment.
This function exists to always give access to the owner of the private key to their unique Tile. This functionality has some implications. If a user decides the squat tiles for addresses of well-know people, these tiles will simply be taken away from them through the seize function. There is still a price to pay for calling seize which is the current mint price. The current mint price may be higher than what the squatter paid and this amount will be sent to the current holder in exchange for the NFT.
This mechanic also discourages sales of owned address Tiles since they can always be seized back even if they were sold on a 3rd party market.
This is a Nodejs project written in Typescript. Bootstrap it with yarn
. After that use the usual hardhat commands. npx hardhat compile
, npx hardhat test
and npx hardhat coverage
build, test and calculate code coverage respectively. There are several scripts available as well.
yarn
npx hardhat compile
npx hardhat test
npx hardhat coverage
There is a hot-reload script you can run as source ./scripts/dev.sh
which deploys the contracts to a local testnet and spins up an http display service at https://localhost:3000.
yarn
source ./scripts/dev.sh
Deployment requires configuration which is loaded from a .env
file. The following keys are necessary:
- PRIVATE_KEY=
- ALCHEMY_RINKEBY_URL=
- ALCHEMY_RINKEBY_KEY=
- ALCHEMY_MAINNET_URL=
- ALCHEMY_MAINNET_KEY=
- ETHERSCAN_API_KEY=
- COINMARKETCAP_KEY=
- REPORT_GAS=
Put these contracts on chain with npx hardhat run scripts/deploy.ts --network rinkeby
. Most recent test deployment is at 0xe9595c465Bf76F72279D67d09f7425969f11bC46. You can see how it's rendered on looksrare.
npx hardhat run scripts/deploy.ts --network rinkeby
The scripts/deploy.ts
uses configuration parameters sourced from scripts/config.json
. The config file is up-to-date with the latest rinkeby and mainnet deployments. The log/deploy.log
contains the relevant output describing the deployment and configuration steps
Tiles v2 is a collection of contracts hidden behind InfiniteTiles.sol. This contract is an implementation of ERC721 based on the version from rari capital. It includes several features from ERC721Enumerable from openzeppelin. On top of this are modules to provide pricing and content creation features.
This NFT is fully on-chain. The NFT content, starting with the metadata, is generated by a smart contract function. This includes the basic description, dynamic trait collection and the svg image content.
This collection feeds into a Juicebox Project for mint payments and royalty distribution.
In its currently-deployed configuration InfiniteTiles.sol relies on TileContentProvider.sol to generate metadata and image content. The image content is populated directly into the metadata json as base64-encoded svg. It comes in three flavors for broad market support: image
, image_data
, and animation_url
. The latter relies on an ipfs-deployed html page which adds some animation features to the image. Finally, minting is controlled by LegacyOwnershipPriceResolver.sol which allows for free mints to the holders of the original tiles contract at 0x64931F06d3266049Bf0195346973762E6996D764.
It's possible to use this contract set to create your own dynamic on-chain art collection. You'll need to implement a contract similar to TileContentProvider.sol which uses AbstractTileNFTContent.sol for the image algorithm.
For controlling the minting process, in addition to LegacyOwnershipPriceResolver.sol, there is also MerkleRootPriceResolver.sol which allows setting of different prices for the general sale vs listed sale. There is also a more basic pricer implementation in SupplyPriceResolver.sol.
There are a few places where you can observe the contract on rinkeby:
You can also preview the animation_url via ipfs.