"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();
    console.log(`Deployer ${deployer}`);
    const proxyOwnerAddress = network.live ? deploymentConfig_1.ADDRESSES[network.name].timelock : deployer;
    const { stETHAddress, wstETHAddress } = deploymentConfig_1.ADDRESSES[network.name];
    const WETHAsset = deploymentConfig_1.assets[network.name].find(asset => asset.token === "WETH");
    const WETHAddress = WETHAsset?.address ?? deploymentConfig_1.addr0000;
    const defaultProxyAdmin = await artifacts.readArtifact("hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin");
    const oracle = await hardhat_1.ethers.getContract("ResilientOracle");
    await deploy("WstETHOracle_Equivalence", {
        contract: "WstETHOracle",
        from: deployer,
        log: true,
        deterministicDeployment: false,
        args: [wstETHAddress, WETHAddress, stETHAddress, oracle.address, true],
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
    });
    await deploy("WstETHOracle_NonEquivalence", {
        contract: "WstETHOracle",
        from: deployer,
        log: true,
        deterministicDeployment: false,
        args: [wstETHAddress, WETHAddress, stETHAddress, oracle.address, false],
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
    });
};
exports.default = func;
func.tags = ["wsteth"];
func.skip = async (hre) => hre.network.name !== "ethereum" && hre.network.name !== "sepolia";
//# sourceMappingURL=6-deploy-wstETH-oracle.js.map