Search code examples
chainlink

How are chainlink requests processed when forking mainnet in Brownie?


From the brownie chainlink-mix, why does the PriceFeed works fine on mainnet-fork while the ApiConsumer does not fulfill the request on the same network? Are prices cached on the Aggregator?


Solution

  • When you fork the mainnet, it literally forks the blockchchain state at that point in time. So when you query the Price Feed Aggregator contract, you get the price at the time of forking.

    However because there are no Chainlink oracles connected to your forked chain, there's no way to do a real API or VRF request...and the latest price data in Price Feed contracts won't update either.

    Check out the tests to see how mocks are used for local environments where there is no connectivity to Chainlink nodes