-
Move into
smart-contracts
and install dependencies:npm install
-
Define required env vars:
- Create
.env
file:cp .env.example .env
- Update env vars inside
.env
with your own values.
- Create
-
Compile smart contract:
npx hardhat compile
-
Execute tests:
npx hardhat test
-
Deploy to Mumbai network:
npx hardhat run scripts/deploy.ts --network mumbai
-
Verify your newly deployed contract. Once the previous command finishes the deployment process, you should be able to see the address for your contract in Mumbai network, verify your contract:
- Parameters:
- '60': This is the interval to automatically fetch latest BTC price feed and determine the current price trend (Bull/Bear). You can change it for any value you want.
- '0x007A22900a3B98143368Bd5906f8E17e9867581b': This is the BTC/USD price data feed address. If you change this value, make sure to change it in
smart-contracts/scripts/deploy.ts
as well. - '0x7a1BaC17Ccc5b313516C5E16fb24f7659aA5ebed': VRF Coordinator address (Mumbai).
- Command:
npx hardhat verify --network mumbai <your-contract-addr> '60' '0x007A22900a3B98143368Bd5906f8E17e9867581b' '0x7a1BaC17Ccc5b313516C5E16fb24f7659aA5ebed'
- Parameters:
-
Mint a new token. With the account you used to deploy the contract mint a new token directly from Mumbai Polygon Scan web app.
-
Configure Chainlink Keepers
-
Based on the interval you defined and the BTC price, you should be able to see how the metadata for your minted NFT changes automagically over time.
NOTE: It might be possible that the interval you defined is significantly high or that the price fluctuation of BTC is not does not change the trend (it keeps bull or it keeps bear).
-
(Optional) Randomness. By default, NFTS are generated semi-randomly. Since the VRF coordinator is configured at deployment time, the only think you have to do is to set the
subscriptionId
.- Create your subscription in Chainlink VRF
- From the contract, call
setVRFSubscriptionId(<your-sub-id>)
- Every time price trend changes, you will ge truly random numbers in your NFTs.
dynamic-nft-chainlink-keepers-vrf-road2web3's Introduction
dynamic-nft-chainlink-keepers-vrf-road2web3's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.