Dynamic NFT Application, that allows users to convert pieces of art into dynamic tokens stored on chain
Please install or have installed the following:
- Install Brownie, if you haven't already. Here is a simple way to install brownie.
pip install eth-brownie
npm install -g ganache-cli
- Set your
WEB3_INFURA_PROJECT_ID
, andPRIVATE_KEY
environment variables. You can get this by getting a free trial of Infura. At the moment, it does need to be infura. You can find yourPRIVATE_KEY
from your ethereum wallet like metamask.
Otherwise, you can build, test, and deploy on your local environment.
brownie run scripts/deploy-spirited_contract.py --network rinkeby
The project stores available hashes of the art-works deployed to ipfs in a directory token_uri_hashes
For example, this is an url indicating a picture from ipfs: "https://ipfs.io/ipfs/QmaSED9ZSbdGts5UZqueFJjrJ4oHH3GnmGJdSDrkzpYqRS".
The last part after "/" is the hash which needs to be stored on the contract. Right now contract supports dynamic changes
of pictures based on btc price in the following order:
btcPrice < 50_000 = 1 hash
btcPrice >= 50_000 && btcPrice < 60_000 = 2 hash
btcPrice >= 60_000 && btcPrice < 70_000 = 3 hash
btcPrice >= 70_000 && btcPrice < 80_000 = 4 hash
btcPrice >= 80_000 && btcPrice < 90_000 = 5 hash
btcPrice >= 90_000 && btcPrice < 100_000 = 6 hash
btcPrice >= 100_000 = 7 hash
Therefore each file in token_uri_hashes
directory should contain 7 hashes.
In order to upload tokenURI hashes you can use script:
brownie run scripts/upload_token_uri_hashes.py --network rinkeby
Script contains two variables which you may want to change:
token_id
- identifier of a token, which will be linked with provided tokenURIs
token_uri_hashes_filename
- file containing hashes
brownie run scripts/mint_token.py --network rinkeby
After minting token is linked to the first tokenURI hash, no matter what the Bitcoin is.
brownie run scripts/change_token_uri.py --network rinkeby
script variable:
token_id
- identifier of a token which tokenURI will be changed depend on a Bitcoin price at the moment
This project is licensed under the MIT license.