"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 oracle = await hardhat_1.ethers.getContract("ResilientOracle");
    const proxyOwnerAddress = network.live ? deploymentConfig_1.ADDRESSES[network.name].timelock : deployer;
    const { ankrBNB, stkBNB, BNBx, BNBxStakeManager, slisBNBStakeManager, stkBNBStakePool, slisBNB, wBETH } = deploymentConfig_1.ADDRESSES[network.name];
    const ETH = deploymentConfig_1.assets[network.name].find(asset => asset.token === "ETH");
    const defaultProxyAdmin = await artifacts.readArtifact("hardhat-deploy/solc_0.8/openzeppelin/proxy/transparent/ProxyAdmin.sol:ProxyAdmin");
    await deploy("BNBxOracle", {
        from: deployer,
        log: true,
        deterministicDeployment: false,
        args: [BNBxStakeManager, BNBx, oracle.address],
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
        skipIfAlreadyDeployed: true,
    });
    await deploy("SlisBNBOracle", {
        from: deployer,
        log: true,
        deterministicDeployment: false,
        args: [slisBNBStakeManager, slisBNB, oracle.address],
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
        skipIfAlreadyDeployed: true,
    });
    await deploy("StkBNBOracle", {
        from: deployer,
        log: true,
        deterministicDeployment: false,
        args: [stkBNBStakePool, stkBNB, oracle.address],
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
        skipIfAlreadyDeployed: true,
    });
    const ankrBNBAddress = ankrBNB || (await hardhat_1.ethers.getContract("MockAnkrBNB")).address;
    await deploy("AnkrBNBOracle", {
        from: deployer,
        log: true,
        deterministicDeployment: false,
        args: [ankrBNBAddress, oracle.address],
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
        skipIfAlreadyDeployed: true,
    });
    const wBETHAddress = wBETH || (await hardhat_1.ethers.getContract("MockWBETH")).address;
    await deploy("WBETHOracle", {
        from: deployer,
        log: true,
        deterministicDeployment: false,
        args: [wBETHAddress, ETH?.address, oracle.address],
        proxy: {
            owner: proxyOwnerAddress,
            proxyContract: "OptimizedTransparentUpgradeableProxy",
            viaAdminContract: {
                name: "DefaultProxyAdmin",
                artifact: defaultProxyAdmin,
            },
        },
        skipIfAlreadyDeployed: true,
    });
};
exports.default = func;
func.tags = ["bnb_lst"];
func.skip = async (hre) => hre.network.name !== "bscmainnet" && hre.network.name !== "bsctestnet";
//# sourceMappingURL=5-deploy-bnb-lst-oracles.js.map