price-feeds
branch adds the Chainlink Keepers implementation and connects to the Chainlink Asset price data that we'll use to track a specific asset’s price.randomness
branch contains the logic to add randomness so that our Dynamic NFT is chosen randomly from the NFT metadata URIs we have in our smart contract. mintToken()
logic!Bull&Bear.sol
.safeMint()
method to set an initial token URI as a starting point.bullUrisIpfs
and bearUrisIpfs
to point to the files hosted on your IPFS browser node.safeMint
field to mint a tokentokenURI
with the argument “0” KeeperCompatibleInterface
checkUpkeep
and performUpkeep
functions in the NFT smart contract so that we satisfy the interface checkUpkeep()
function every time a new block is added to the blockchain and simulate the execution of our function off-chain! interval
we set has passed, and an upkeep action is dueperformUpkeep()
function automatically, and run logic on-chain.checkUpkeep
will be straightforward because we just want to check if the interval
has expired and return that boolean, but our performUpkeep
needs to check a price feed. AggregatorV3Interface
. price-feeds
branch, the constructor accepts the address of the aggregator oracle as a parameter in the constructor. Accepting a parameter at deploy time is super useful as it makes it configurable when we develop locally. MockPriceFeed
3034715771688
latestRoundData
to see the latest price from the mock price feed, and other data that conforms to the Chainlink Price Feed API.updateAnswer
and passing in a higher or lower value (to simulate the rise and fall of prices). 2534715771688
or rise by passing in 4534715771688
. price feed
as a public state variable so we can change it, using the setPriceFeed()
helper method, and we also added the key dynamic NFT logic to performUpkeep()
. 8,3034715771688
to start with, and copy its address. Bull&Bear
smart token contracttokenURI
after passing 0, 1, or whatever the minted token ID you have is. gamer_bull.json
.getLatestPrice()
and that in turn updates the currentPrice
state variable. currentPrice
button - the result should match the price you set in your Mock Price Feed. checkUpkeep
and pass in an empty array ([]
) as the argument. It should return a boolean of true because we passed in 10 seconds as the interval
duration and 10 seconds would have passed from when you deployed Bull&Bear
.performUpkeep()
. currentPrice
field. performUpkeep
after passing it an empty array. This is how you simulate your contract being called by the Chainlink Keepers Network on Rinkeby. performUpkeep
ourselves. performUpkeep
should check the latest price and update all token URIs. currentPrice
and check the tokenURI
currentPrice
you should see the price based on the updated Mock Price Feed. tokenURI
again, and you should see that your token URI has changed. requestRandomWords
and fulfillRandomWords
performUpkeep
from Remix, you can keep the interval short for the first test run.setInterval
otherwise the Keepers network will run your performUpkeep
far more often than the Price Feed will show new data.setPriceFeed
and passing in the address you want it to point to. performUpkeep
finds that there is no change in price, the token URIs will not update!.gamer_bull.json
. Check on OpenSea if you like! tokenURI
. vrfCoordinator
in the NFT contract by calling their setter functions. setVrfCoordinator()
so you’re no longer using your VRF Mock on Rinkeby. tokenURI
and see the updated metadata. force_update
param but it may not update the images in time. The name of the NFT should be updated at the least.