This project combined a framework for interactive with smart-contracts and a server that receives requests for NFT metadata updating. Main goal - build INDEX NFT with automate updating
List of things you need for the app to work:
- NFT with method
setTokenURI
that you can call and set - wrapped NFT with your original NFT from step 1 with, and some collateral assets in it (mean assets that you put in wNFT when wrapping). Check https://envelop.is/ for more information
To set up the project, follow these steps:
-
Clone this repository.
git clone https://github.com/DynamicNFTHub/FastBrownieAPI
-
Setup all ENV's from .env file and export it:
source .env
-
Build and deploy docker image.
bash build-and-deploy.sh
-
Send GET request to http://127.0.0.1:8000/.
If everything okey you will see next response json:
{"message":"Welcome to FastAPI with Brownie Integration!"}
-
Send POST request to http://127.0.0.1:8000/update_meta
This request send command to brownie framework do all magic 💫
brownie run scripts/dindex_update --network polygon-main
-
All generated images from OpenAI and metada.json stored in
/server_app/src/
directory
Explanation what app do:
- Pulling price for each token that you define as collateral assets config from Coinmarketcap
- Calculate total sum of all collateral assets depends on current token price
- Provided prompt for image used in OpenAPI, result stored localy
- Index price calculated on second step used for overlaying it to image from OpenAI
- Index image saved to IPFS
- Building metadata.json with information about NFT and IPFS link to image
- Store metadata.json to IPFS
- call
setTokenURI
and store in it new version of metadata.json