"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const hardhat_1 = require("hardhat");
const deploymentConfig_1 = require("../helpers/deploymentConfig");
const func = async ({ getNamedAccounts, deployments, network, artifacts, }) => {
    const { deploy } = deployments;
    const { deployer } = await getNamedAccounts();
    const resilientOracle = await hardhat_1.ethers.getContract("ResilientOracle");
    const chainlinkOracle = await hardhat_1.ethers.getContract("ChainlinkOracle");
    const proxyOwnerAddress = network.live ? deploymentConfig_1.ADDRESSES[network.name].timelock : deployer;
    const defaultProxyAdmin = await artifacts.readArtifact("hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin");
    let { EtherFiLiquidityPool } = deploymentConfig_1.ADDRESSES[network.name];
    const { weETH, eETH, WETH } = deploymentConfig_1.ADDRESSES[network.name];
    EtherFiLiquidityPool = EtherFiLiquidityPool || (await hardhat_1.ethers.getContract("MockEtherFiLiquidityPool")).address;
    if (network.name === "sepolia") {
        await deploy("WeETHOracle", {
            from: deployer,
            log: true,
            deterministicDeployment: false,
            args: [EtherFiLiquidityPool, weETH, eETH, resilientOracle.address],
            proxy: {
                owner: proxyOwnerAddress,
                proxyContract: "OptimizedTransparentUpgradeableProxy",
                viaAdminContract: {
                    name: "DefaultProxyAdmin",
                    artifact: defaultProxyAdmin,
                },
            },
            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: "OptimizedTransparentUpgradeableProxy",
                viaAdminContract: {
                    name: "DefaultProxyAdmin",
                    artifact: defaultProxyAdmin,
                },
            },
            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: "OptimizedTransparentUpgradeableProxy",
                viaAdminContract: {
                    name: "DefaultProxyAdmin",
                    artifact: defaultProxyAdmin,
                },
            },
            skipIfAlreadyDeployed: true,
        });
    }
};
exports.default = func;
func.tags = ["weETH"];
func.skip = async (hre) => hre.network.name !== "ethereum" && hre.network.name !== "sepolia";
//# sourceMappingURL=8-deploy-weETH-oracle.js.map