"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const hardhat_1 = __importDefault(require("hardhat"));
const deploymentConfig_1 = require("../helpers/deploymentConfig");
const func = async function ({ getNamedAccounts, deployments, network, artifacts, }) {
    const { deploy } = deployments;
    const { deployer } = await getNamedAccounts();
    const proxyOwnerAddress = deploymentConfig_1.ADDRESSES[network.name].timelock;
    const { WETH, wstETH, weETH } = deploymentConfig_1.ADDRESSES[network.name];
    const resilientOracle = await hardhat_1.default.ethers.getContract("ResilientOracle");
    let chainlinkOracle;
    if (hardhat_1.default.network.name === "arbitrumone") {
        chainlinkOracle = await hardhat_1.default.ethers.getContract("SequencerChainlinkOracle");
    }
    else {
        chainlinkOracle = await hardhat_1.default.ethers.getContract("ChainlinkOracle");
    }
    const defaultProxyAdmin = await artifacts.readArtifact("hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin");
    const commonParams = {
        from: deployer,
        log: true,
        deterministicDeployment: false,
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
        skipIfAlreadyDeployed: true,
        waitConfirmations: 1,
    };
    await deploy("wstETHOneJumpChainlinkOracle", {
        contract: "OneJumpOracle",
        args: [wstETH, WETH, resilientOracle.address, chainlinkOracle.address],
        ...commonParams,
    });
    await deploy("weETHOneJumpChainlinkOracle", {
        contract: "OneJumpOracle",
        args: [weETH, WETH, resilientOracle.address, chainlinkOracle.address],
        ...commonParams,
    });
    if (["bscmainnet", "bsctestnet"].includes(hardhat_1.default.network.name)) {
        const redstoneOracle = await hardhat_1.default.ethers.getContract("RedStoneOracle");
        await deploy("wstETHOneJumpRedstoneOracle", {
            contract: "OneJumpOracle",
            args: [wstETH, WETH, resilientOracle.address, redstoneOracle.address],
            ...commonParams,
        });
        await deploy("weETHOneJumpRedstoneOracle", {
            contract: "OneJumpOracle",
            args: [weETH, WETH, resilientOracle.address, redstoneOracle.address],
            ...commonParams,
        });
    }
};
func.skip = async () => !["bscmainnet", "bsctestnet", "arbitrumone", "arbitrumsepolia"].includes(hardhat_1.default.network.name);
func.tags = ["wstETH_weETH_OneJumpOracles"];
exports.default = func;
//# sourceMappingURL=13-deploy-wstETH-weETH-oracles.js.map