Deploying, maintaining, and verifying the price oracle
In this section, we will discuss how to deploy, maintain, and verify the price oracle. You will learn how to bring the price oracle alive in your project and see the robustness of the price oracle when the token price is heavily manipulated by attackers.
Deploying the PriceOracleV2 smart contract
Similar to the smart contracts we deployed in previous chapters, we need to follow the constructor definition for deploying the smart contract. Let’s review the following code of the constructor of the PriceOracleV2
smart contract before writing the deployment script:
constructor( address _factory, address _WETH, uint256 _windowSize, uint8 _granularity // Number of periods in a window ) { ... }
We can replace the code for creating the old price oracle instance in scripts/deploy.js
with the code for the new version of the price oracle:
await contractFactory.deploy( ...