Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[VEN-2676] ezETH Oracle Deployment #208

Merged
merged 5 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions deploy/11-deploy-rsETH-oracles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@ import { ADDRESSES } from "../helpers/deploymentConfig";
const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;
let WETH;
let rsETH;
if (network.name === "sepolia" || network.name === "ethereum") {
({ WETH } = ADDRESSES[network.name]);
rsETH =
network.name === "sepolia"
? "0xfA0614E5C803E15070d31f7C38d2d430EBe68E47"
: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7";
}
const proxyOwnerAddress = ADDRESSES[network.name].timelock;
const { WETH, rsETH } = ADDRESSES[network.name];

const redStoneOracle = await hre.ethers.getContract("RedStoneOracle");
const resilientOracle = await hre.ethers.getContract("ResilientOracle");
Expand Down
46 changes: 46 additions & 0 deletions deploy/13-deploy-ezETH-oracles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { ADDRESSES } from "../helpers/deploymentConfig";

const func: DeployFunction = async function ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const proxyOwnerAddress = ADDRESSES[network.name].timelock;
const { ezETH, WETH } = ADDRESSES[network.name];

const redStoneOracle = await hre.ethers.getContract("RedStoneOracle");
const resilientOracle = await hre.ethers.getContract("ResilientOracle");
const chainlinkOracle = await hre.ethers.getContract("ChainlinkOracle");

await deploy("ezETHOneJumpRedStoneOracle", {
contract: "OneJumpOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [ezETH, WETH, resilientOracle.address, redStoneOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});

await deploy("ezETHOneJumpChainlinkOracle", {
contract: "OneJumpOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [ezETH, WETH, resilientOracle.address, chainlinkOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});
};

func.skip = async () => hre.network.name !== "ethereum" && hre.network.name !== "sepolia";
func.tags = ["ezETHOneJumpOracles"];
export default func;
30 changes: 30 additions & 0 deletions deploy/8-deploy-mocks-weETH-oracle.ts
chechu marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { ADDRESSES } from "../helpers/deploymentConfig";

const func: DeployFunction = async ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;

await deploy("MockEtherFiLiquidityPool", {
from: deployer,
contract: "MockEtherFiLiquidityPool",
args: [],
log: true,
autoMine: true, // speed up deployment on local network (ganache, hardhat), no effect on live networks
skipIfAlreadyDeployed: true,
});

const mockEtherFiLiquidityPool = await ethers.getContract("MockEtherFiLiquidityPool");
if ((await mockEtherFiLiquidityPool.owner()) !== deployer) {
await mockEtherFiLiquidityPool.transferOwnership(proxyOwnerAddress);
}
};

export default func;
func.tags = ["weETH"];
func.skip = async (hre: HardhatRuntimeEnvironment) => hre.network.name !== "hardhat" && hre.network.name !== "sepolia";
67 changes: 67 additions & 0 deletions deploy/8-deploy-weETH-oracle.ts
chechu marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { ADDRESSES } from "../helpers/deploymentConfig";

const func: DeployFunction = async ({ getNamedAccounts, deployments, network }: HardhatRuntimeEnvironment) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

const resilientOracle = await ethers.getContract("ResilientOracle");
const chainlinkOracle = await ethers.getContract("ChainlinkOracle");
const proxyOwnerAddress = network.live ? ADDRESSES[network.name].timelock : deployer;

let { EtherFiLiquidityPool } = ADDRESSES[network.name];
const { weETH, eETH, WETH } = ADDRESSES[network.name];

if (!EtherFiLiquidityPool) {
const mockEtherFiLiquidityPool = await ethers.getContract("MockEtherFiLiquidityPool");
EtherFiLiquidityPool = mockEtherFiLiquidityPool.address;
}

if (network.name !== "ethereum") {
await deploy("WeETHOracle", {
from: deployer,
log: true,
deterministicDeployment: false,
args: [EtherFiLiquidityPool, weETH, eETH, resilientOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});
} else {
await deploy("WeETHOracle_Equivalence", {
contract: "WeETHOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [EtherFiLiquidityPool, weETH, WETH, resilientOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});

await deploy("WeETHOracle_NonEquivalence", {
contract: "OneJumpOracle",
from: deployer,
log: true,
deterministicDeployment: false,
args: [weETH, WETH, resilientOracle.address, chainlinkOracle.address],
proxy: {
owner: proxyOwnerAddress,
proxyContract: "OptimizedTransparentProxy",
},
skipIfAlreadyDeployed: true,
});
}
};

export default func;
func.tags = ["weETH"];
func.skip = async ({ network }: HardhatRuntimeEnvironment) =>
!["hardhat", "sepolia", "ethereum"].includes(network.name);
Loading