Skip to content

Commit

Permalink
fix: deployed oracles in testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
web3rover committed Jul 23, 2024
1 parent b5ff1d7 commit 8bb07f1
Show file tree
Hide file tree
Showing 12 changed files with 1,603 additions and 11 deletions.
13 changes: 3 additions & 10 deletions deploy/11-deploy-rsETH-oracles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ 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 = ADDRESSES[network.name].WETH;
const rsETH = ADDRESSES[network.name].rsETH;

const redStoneOracle = await hre.ethers.getContract("RedStoneOracle");
const resilientOracle = await hre.ethers.getContract("ResilientOracle");
Expand Down
47 changes: 47 additions & 0 deletions deploy/13-deploy-ezETH-oracles.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
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 WETH = ADDRESSES[network.name].WETH;
const ezETH = ADDRESSES[network.name].ezETH;

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
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
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

0 comments on commit 8bb07f1

Please sign in to comment.