"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.skipRemoteNetworks = exports.onlyHardhat = exports.getSourceChainId = exports.getRiskOracle = exports.getLzV2Endpoint = exports.getLzEndpoint = exports.getOmnichainProposalSender = exports.guardian = exports.testnetNetworks = void 0;
const hardhat_1 = require("hardhat");
const bscmainnet_json_1 = __importDefault(require("../../deployments/bscmainnet.json"));
const bsctestnet_json_1 = __importDefault(require("../../deployments/bsctestnet.json"));
const constants_1 = require("./constants");
exports.testnetNetworks = [
    "sepolia",
    "opbnbtestnet",
    "arbitrumsepolia",
    "zksyncsepolia",
    "opsepolia",
    "basesepolia",
    "unichainsepolia",
    "hardhat",
];
const mainnetNetworks = [
    "ethereum",
    "opbnbmainnet",
    "arbitrumone",
    "zksyncmainnet",
    "opmainnet",
    "basemainnet",
    "unichainmainnet",
    "hardhat",
];
const guardian = (network) => __awaiter(void 0, void 0, void 0, function* () {
    const { deployer } = yield (0, hardhat_1.getNamedAccounts)();
    if (network === "hardhat") {
        return deployer;
    }
    else if (network === "sepolia") {
        return "0x94fa6078b6b8a26f0b6edffbe6501b22a10470fb";
    }
    else if (network === "ethereum") {
        return "0x285960C5B22fD66A736C7136967A3eB15e93CC67";
    }
    else if (network === "opbnbtestnet") {
        return "0xb15f6EfEbC276A3b9805df81b5FB3D50C2A62BDf";
    }
    else if (network === "opbnbmainnet") {
        return "0xC46796a21a3A9FAB6546aF3434F2eBfFd0604207";
    }
    else if (network === "arbitrumsepolia") {
        return "0x1426A5Ae009c4443188DA8793751024E358A61C2";
    }
    else if (network === "arbitrumone") {
        return "0x14e0E151b33f9802b3e75b621c1457afc44DcAA0";
    }
    else if (network === "zksyncsepolia") {
        return "0xa2f83de95E9F28eD443132C331B6a9C9B7a9F866";
    }
    else if (network === "zksyncmainnet") {
        return "0x751Aa759cfBB6CE71A43b48e40e1cCcFC66Ba4aa";
    }
    else if (network === "opsepolia") {
        return "0xd57365EE4E850e881229e2F8Aa405822f289e78d";
    }
    else if (network === "opmainnet") {
        return "0x2e94dd14E81999CdBF5deDE31938beD7308354b3";
    }
    else if (network === "basesepolia") {
        return "0xdf3b635d2b535f906BB02abb22AED71346E36a00";
    }
    else if (network === "basemainnet") {
        return "0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C";
    }
    else if (network === "unichainsepolia") {
        return "0x9831D3A641E8c7F082EEA75b8249c99be9D09a34";
    }
    else if (network === "unichainmainnet") {
        return "0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C";
    }
    return deployer;
});
exports.guardian = guardian;
const getOmnichainProposalSender = (network) => __awaiter(void 0, void 0, void 0, function* () {
    if (network === "hardhat") {
        const omnichainProposalSenderAddress = (yield hardhat_1.ethers.getContract("OmnichainProposalSender")).address;
        return omnichainProposalSenderAddress;
    }
    else if (exports.testnetNetworks.includes(network)) {
        return bsctestnet_json_1.default.contracts.OmnichainProposalSender.address;
    }
    else if (mainnetNetworks.includes(network)) {
        return bscmainnet_json_1.default.contracts.OmnichainProposalSender.address;
    }
    return "0x0000000000000000000000000000000000000001";
});
exports.getOmnichainProposalSender = getOmnichainProposalSender;
const getLzEndpoint = (networkName) => __awaiter(void 0, void 0, void 0, function* () {
    const lzEndpointMock = yield hardhat_1.ethers.getContractOrNull("LZEndpointMock");
    return {
        ethereum: "0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675",
        bscmainnet: "0x3c2269811836af69497E5F486A85D7316753cf62",
        opbnbmainnet: "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
        arbitrumone: "0x3c2269811836af69497E5F486A85D7316753cf62",
        sepolia: "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
        bsctestnet: "0x6Fcb97553D41516Cb228ac03FdC8B9a0a9df04A1",
        opbnbtestnet: "0x83c73Da98cf733B03315aFa8758834b36a195b87",
        arbitrumsepolia: "0x6098e96a28E02f27B1e6BD381f870F1C8Bd169d3",
        zksyncsepolia: "0x99b6359ce8E0eBdC27eBeDb76FE28F29303E78fF",
        zksyncmainnet: "0x9b896c0e23220469C7AE69cb4BbAE391eAa4C8da",
        opmainnet: "0x3c2269811836af69497E5F486A85D7316753cf62",
        opsepolia: "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8",
        basesepolia: "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8",
        basemainnet: "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
        unichainsepolia: "0x012f6eaE2A0Bf5916f48b5F37C62Bcfb7C1ffdA1",
        unichainmainnet: "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
        hardhat: (lzEndpointMock === null || lzEndpointMock === void 0 ? void 0 : lzEndpointMock.address) || "",
    }[networkName];
});
exports.getLzEndpoint = getLzEndpoint;
const getLzV2Endpoint = (networkName) => __awaiter(void 0, void 0, void 0, function* () {
    const lzEndpointMock = yield hardhat_1.ethers.getContractOrNull("EndpointV2Mock");
    return {
        ethereum: "0x1a44076050125825900e736c501f859c50fE728c",
        bscmainnet: "0x1a44076050125825900e736c501f859c50fE728c",
        opbnbmainnet: "0x1a44076050125825900e736c501f859c50fE728c",
        arbitrumone: "0x1a44076050125825900e736c501f859c50fE728c",
        sepolia: "0x6EDCE65403992e310A62460808c4b910D972f10f",
        bsctestnet: "0x6EDCE65403992e310A62460808c4b910D972f10f",
        opbnbtestnet: "0x6EDCE65403992e310A62460808c4b910D972f10f",
        arbitrumsepolia: "0x6EDCE65403992e310A62460808c4b910D972f10f",
        zksyncsepolia: "0xe2Ef622A13e71D9Dd2BBd12cd4b27e1516FA8a09",
        zksyncmainnet: "0xd07C30aF3Ff30D96BDc9c6044958230Eb797DDBF",
        opmainnet: "0x1a44076050125825900e736c501f859c50fE728c",
        opsepolia: "0x6EDCE65403992e310A62460808c4b910D972f10f",
        basesepolia: "0x6EDCE65403992e310A62460808c4b910D972f10f",
        basemainnet: "0x1a44076050125825900e736c501f859c50fE728c",
        unichainsepolia: "0xb8815f3f882614048CbE201a67eF9c6F10fe5035",
        unichainmainnet: "0x6F475642a6e85809B1c36Fa62763669b1b48DD5B",
        berachainbepolia: "0x6C7Ab2202C98C4227C5c46f1417D81144DA716Ff",
        hardhat: (lzEndpointMock === null || lzEndpointMock === void 0 ? void 0 : lzEndpointMock.address) || "",
    }[networkName];
});
exports.getLzV2Endpoint = getLzV2Endpoint;
const getRiskOracle = (networkName) => __awaiter(void 0, void 0, void 0, function* () {
    const mockRiskOracle = yield hardhat_1.ethers.getContractOrNull("MockRiskOracle");
    switch (networkName) {
        case constants_1.SUPPORTED_NETWORKS.BSCTESTNET:
            return "0x7BD97DD6C199532d11Cf5f55E13a120dB6dd0F4F";
        case constants_1.SUPPORTED_NETWORKS.BSCMAINNET:
            return "0x66A8cb6c4230B044378aC3676D47Ed4fE18e3cFB";
        case constants_1.SUPPORTED_NETWORKS.HARDHAT:
            return (mockRiskOracle === null || mockRiskOracle === void 0 ? void 0 : mockRiskOracle.address) || "";
        case constants_1.SUPPORTED_NETWORKS.SEPOLIA:
            return "0x7BD97DD6C199532d11Cf5f55E13a120dB6dd0F4F";
        case constants_1.SUPPORTED_NETWORKS.ETHERUEM:
            return "0x91429ddc50B38bAF3Ba9CB5eB0275507Ac65CBF4";
        case constants_1.SUPPORTED_NETWORKS.OPBNBTESTNET:
            return "0x7BD97DD6C199532d11Cf5f55E13a120dB6dd0F4F";
        case constants_1.SUPPORTED_NETWORKS.ARBITRUM_SEPOLIA:
            return "0x7BD97DD6C199532d11Cf5f55E13a120dB6dd0F4F";
        case constants_1.SUPPORTED_NETWORKS.OPSEPOLIA:
            return "0x66A8cb6c4230B044378aC3676D47Ed4fE18e3cFB";
        case constants_1.SUPPORTED_NETWORKS.BASESEPOLIA:
            return "0x7BD97DD6C199532d11Cf5f55E13a120dB6dd0F4F";
        case constants_1.SUPPORTED_NETWORKS.UNICHAINSEPOLIA:
            return "0x7BD97DD6C199532d11Cf5f55E13a120dB6dd0F4F";
        case constants_1.SUPPORTED_NETWORKS.ZKSYNC_SEPOLIA:
            return "0x1f7474B549840158464Eca63735429815867b40e";
        default:
            throw new Error(`Risk Oracle Unsupported network: ${networkName}`);
    }
});
exports.getRiskOracle = getRiskOracle;
const getSourceChainId = (network) => __awaiter(void 0, void 0, void 0, function* () {
    if (exports.testnetNetworks.includes(network)) {
        return constants_1.LZ_CHAINID.bsctestnet;
    }
    else if (mainnetNetworks.includes(network)) {
        return constants_1.LZ_CHAINID.bscmainnet;
    }
    return 1;
});
exports.getSourceChainId = getSourceChainId;
const onlyHardhat = () => (hre) => __awaiter(void 0, void 0, void 0, function* () {
    return hre.network.name !== "hardhat";
});
exports.onlyHardhat = onlyHardhat;
const skipRemoteNetworks = () => (hre) => __awaiter(void 0, void 0, void 0, function* () {
    return hre.network.name !== "bscmainnet" && hre.network.name !== "bsctestnet" && hre.network.name !== "hardhat";
});
exports.skipRemoteNetworks = skipRemoteNetworks;
exports.default = () => { };
//# sourceMappingURL=deploymentUtils.js.map