"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPreConfiguredAddresses = exports.bridgeConfig = exports.xvsTokenPermissions = exports.XVSTokenDestMethods = exports.XVSBridgeAdminMethods = exports.xvsBridgeMethodsDest = exports.xvsBridgeMethodsSrc = exports.preconfiguredAddresses = void 0;
const utils_1 = require("ethers/lib/utils");
const SEPOLIA_MULTISIG = "0x94fa6078b6b8a26f0b6edffbe6501b22a10470fb";
const OPBNB_TESTNET_MULTISIG = "0xb15f6EfEbC276A3b9805df81b5FB3D50C2A62BDf";
const OPBNB_MAINNET_MULTISIG = "0xC46796a21a3A9FAB6546aF3434F2eBfFd0604207";
const ETHEREUM_MULTISIG = "0x285960C5B22fD66A736C7136967A3eB15e93CC67";
const ARBITRUM_SEPOLIA_MULTISIG = "0x1426A5Ae009c4443188DA8793751024E358A61C2";
const ARBITRUM_ONE_MULTISIG = "0x14e0E151b33f9802b3e75b621c1457afc44DcAA0";
const ZKSYNC_SEPOLIA_MULTISIG = "0xa2f83de95E9F28eD443132C331B6a9C9B7a9F866";
const OP_SEPOLIA_MULTISIG = "0xd57365EE4E850e881229e2F8Aa405822f289e78d";
const ZKSYNC_MAINNET_MULTISIG = "0x751Aa759cfBB6CE71A43b48e40e1cCcFC66Ba4aa";
const OP_MAINNET_MULTISIG = "0x2e94dd14E81999CdBF5deDE31938beD7308354b3";
const BASE_SEPOLIA_MULTISIG = "0xdf3b635d2b535f906BB02abb22AED71346E36a00";
const BASE_MAINNET_MULTISIG = "0x1803Cf1D3495b43cC628aa1d8638A981F8CD341C";
exports.preconfiguredAddresses = {
    bsctestnet: {
        LzEndpoint: "0x6Fcb97553D41516Cb228ac03FdC8B9a0a9df04A1",
        LzVirtualChainId: "10102",
    },
    bscmainnet: {
        LzEndpoint: "0x3c2269811836af69497E5F486A85D7316753cf62",
        LzVirtualChainId: "102",
    },
    sepolia: {
        NormalTimelock: SEPOLIA_MULTISIG,
        FastTrackTimelock: SEPOLIA_MULTISIG,
        CriticalTimelock: SEPOLIA_MULTISIG,
        LzEndpoint: "0xae92d5aD7583AD66E49A0c67BAd18F6ba52dDDc1",
        LzVirtualChainId: "10161",
    },
    ethereum: {
        NormalTimelock: ETHEREUM_MULTISIG,
        FastTrackTimelock: ETHEREUM_MULTISIG,
        CriticalTimelock: ETHEREUM_MULTISIG,
        LzEndpoint: "0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675",
        LzVirtualChainId: "101",
    },
    opbnbtestnet: {
        LzEndpoint: "0x83c73Da98cf733B03315aFa8758834b36a195b87",
        LzVirtualChainId: "10202",
        NormalTimelock: OPBNB_TESTNET_MULTISIG,
    },
    opbnbmainnet: {
        NormalTimelock: OPBNB_MAINNET_MULTISIG,
        FastTrackTimelock: OPBNB_MAINNET_MULTISIG,
        CriticalTimelock: OPBNB_MAINNET_MULTISIG,
        LzEndpoint: "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
        LzVirtualChainId: "202",
    },
    arbitrumsepolia: {
        NormalTimelock: ARBITRUM_SEPOLIA_MULTISIG,
        FastTrackTimelock: ARBITRUM_SEPOLIA_MULTISIG,
        CriticalTimelock: ARBITRUM_SEPOLIA_MULTISIG,
        LzEndpoint: "0x6098e96a28E02f27B1e6BD381f870F1C8Bd169d3",
        LzVirtualChainId: "10231",
    },
    arbitrumone: {
        NormalTimelock: ARBITRUM_ONE_MULTISIG,
        FastTrackTimelock: ARBITRUM_ONE_MULTISIG,
        CriticalTimelock: ARBITRUM_ONE_MULTISIG,
        LzEndpoint: "0x3c2269811836af69497E5F486A85D7316753cf62",
        LzVirtualChainId: "110",
    },
    zksyncsepolia: {
        NormalTimelock: ZKSYNC_SEPOLIA_MULTISIG,
        FastTrackTimelock: ZKSYNC_SEPOLIA_MULTISIG,
        CriticalTimelock: ZKSYNC_SEPOLIA_MULTISIG,
        LzEndpoint: "0x99b6359ce8E0eBdC27eBeDb76FE28F29303E78fF",
        LzVirtualChainId: "10248",
    },
    opsepolia: {
        NormalTimelock: OP_SEPOLIA_MULTISIG,
        FastTrackTimelock: OP_SEPOLIA_MULTISIG,
        CriticalTimelock: OP_SEPOLIA_MULTISIG,
        LzEndpoint: "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8",
        LzVirtualChainId: "10232",
    },
    zksyncmainnet: {
        NormalTimelock: ZKSYNC_MAINNET_MULTISIG,
        FastTrackTimelock: ZKSYNC_MAINNET_MULTISIG,
        CriticalTimelock: ZKSYNC_MAINNET_MULTISIG,
        LzEndpoint: "0x9b896c0e23220469C7AE69cb4BbAE391eAa4C8da",
        LzVirtualChainId: "165",
    },
    opmainnet: {
        NormalTimelock: OP_MAINNET_MULTISIG,
        FastTrackTimelock: OP_MAINNET_MULTISIG,
        CriticalTimelock: OP_MAINNET_MULTISIG,
        LzEndpoint: "0x3c2269811836af69497E5F486A85D7316753cf62",
        LzVirtualChainId: "111",
    },
    basesepolia: {
        NormalTimelock: BASE_SEPOLIA_MULTISIG,
        FastTrackTimelock: BASE_SEPOLIA_MULTISIG,
        CriticalTimelock: BASE_SEPOLIA_MULTISIG,
        LzEndpoint: "0x55370E0fBB5f5b8dAeD978BA1c075a499eB107B8",
        LzVirtualChainId: "10245",
    },
    basemainnet: {
        NormalTimelock: BASE_MAINNET_MULTISIG,
        FastTrackTimelock: BASE_MAINNET_MULTISIG,
        CriticalTimelock: BASE_MAINNET_MULTISIG,
        LzEndpoint: "0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7",
        LzVirtualChainId: "184",
    },
};
exports.xvsBridgeMethodsSrc = [
    "setSendVersion(uint16)",
    "setReceiveVersion(uint16)",
    "forceResumeReceive(uint16,bytes)",
    "setOracle(address)",
    "setMaxSingleTransactionLimit(uint16,uint256)",
    "setMaxDailyLimit(uint16,uint256)",
    "setMaxSingleReceiveTransactionLimit(uint16,uint256)",
    "setMaxDailyReceiveLimit(uint16,uint256)",
    "pause()",
    "unpause()",
    "removeTrustedRemote(uint16)",
    "dropFailedMessage(uint16,bytes,uint64)",
    "fallbackWithdraw(address,uint256)",
    "fallbackDeposit(address,uint256)",
    "setPrecrime(address)",
    "setMinDstGas(uint16,uint16,uint256)",
    "setPayloadSizeLimit(uint16,uint256)",
    "setWhitelist(address,bool)",
    "setConfig(uint16,uint16,uint256,bytes)",
    "sweepToken(address,address,uint256)",
    "updateSendAndCallEnabled(bool)",
];
exports.xvsBridgeMethodsDest = [
    "setSendVersion(uint16)",
    "setReceiveVersion(uint16)",
    "forceResumeReceive(uint16,bytes)",
    "setOracle(address)",
    "setMaxSingleTransactionLimit(uint16,uint256)",
    "setMaxDailyLimit(uint16,uint256)",
    "setMaxSingleReceiveTransactionLimit(uint16,uint256)",
    "setMaxDailyReceiveLimit(uint16,uint256)",
    "pause()",
    "unpause()",
    "removeTrustedRemote(uint16)",
    "dropFailedMessage(uint16,bytes,uint64)",
    "setPrecrime(address)",
    "setMinDstGas(uint16,uint16,uint256)",
    "setPayloadSizeLimit(uint16,uint256)",
    "setWhitelist(address,bool)",
    "setConfig(uint16,uint16,uint256,bytes)",
    "sweepToken(address,address,uint256)",
    "updateSendAndCallEnabled(bool)",
];
exports.XVSBridgeAdminMethods = ["setTrustedRemoteAddress(uint16,bytes)", "transferBridgeOwnership(address)"];
exports.XVSTokenDestMethods = [
    "migrateMinterTokens(address,address)",
    "setMintCap(address,uint256)",
    "updateBlacklist(address,bool)",
    "pause()",
    "unpause()",
];
exports.xvsTokenPermissions = ["mint(address,uint256)", "burn(address,uint256)"];
exports.bridgeConfig = {
    bsctestnet: {
        methods: [
            ...createMethodEntries(10161),
            ...createMethodEntries(10202),
            ...createMethodEntries(10231),
            ...createMethodEntries(10248),
            ...createMethodEntries(10232),
            ...createMethodEntries(10245),
        ],
    },
    bscmainnet: {
        methods: [
            ...createMethodEntries(101),
            ...createMethodEntries(202),
            ...createMethodEntries(110, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(165),
            ...createMethodEntries(111, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(184),
        ],
    },
    sepolia: {
        methods: [
            ...createMethodEntries(10102),
            ...createMethodEntries(10202),
            ...createMethodEntries(10231),
            ...createMethodEntries(10248),
            ...createMethodEntries(10232),
            ...createMethodEntries(10245),
        ],
    },
    ethereum: {
        methods: [
            ...createMethodEntries(102),
            ...createMethodEntries(202),
            ...createMethodEntries(110, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(165),
            ...createMethodEntries(111, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(184),
        ],
    },
    opbnbtestnet: {
        methods: [
            ...createMethodEntries(10102),
            ...createMethodEntries(10161),
            ...createMethodEntries(10231),
            ...createMethodEntries(10248),
            ...createMethodEntries(10232),
            ...createMethodEntries(10245),
        ],
    },
    opbnbmainnet: {
        methods: [
            ...createMethodEntries(102),
            ...createMethodEntries(101),
            ...createMethodEntries(110, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(165),
            ...createMethodEntries(111, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(184),
        ],
    },
    arbitrumsepolia: {
        methods: [
            ...createMethodEntries(10102),
            ...createMethodEntries(10202),
            ...createMethodEntries(10161),
            ...createMethodEntries(10248),
            ...createMethodEntries(10232),
            ...createMethodEntries(10245),
        ],
    },
    arbitrumone: {
        methods: [
            ...createMethodEntries(102, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(101, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(202, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(165),
            ...createMethodEntries(111, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(184),
        ],
    },
    zksyncsepolia: {
        methods: [
            ...createMethodEntries(10102),
            ...createMethodEntries(10202),
            ...createMethodEntries(10161),
            ...createMethodEntries(10231),
            ...createMethodEntries(10232),
            ...createMethodEntries(10245),
        ],
    },
    opsepolia: {
        methods: [
            ...createMethodEntries(10102),
            ...createMethodEntries(10202),
            ...createMethodEntries(10161),
            ...createMethodEntries(10231),
            ...createMethodEntries(10248),
            ...createMethodEntries(10245),
        ],
    },
    zksyncmainnet: {
        methods: [
            ...createMethodEntries(102),
            ...createMethodEntries(101),
            ...createMethodEntries(202),
            ...createMethodEntries(110),
            ...createMethodEntries(111, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(184),
        ],
    },
    opmainnet: {
        methods: [
            ...createMethodEntries(102, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(101, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(202, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(110, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(165, 300000, (0, utils_1.parseUnits)("100000", 18), (0, utils_1.parseUnits)("20000", 18), (0, utils_1.parseUnits)("102000", 18), (0, utils_1.parseUnits)("20400", 18)),
            ...createMethodEntries(184),
        ],
    },
    basesepolia: {
        methods: [
            ...createMethodEntries(10102),
            ...createMethodEntries(10202),
            ...createMethodEntries(10161),
            ...createMethodEntries(10248),
            ...createMethodEntries(10232),
            ...createMethodEntries(10231),
        ],
    },
    basemainnet: {
        methods: [
            ...createMethodEntries(102),
            ...createMethodEntries(101),
            ...createMethodEntries(202),
            ...createMethodEntries(165),
            ...createMethodEntries(111),
            ...createMethodEntries(110),
        ],
    },
};
async function getPreConfiguredAddresses(networkName) {
    switch (networkName) {
        case "bsctestnet":
            return exports.preconfiguredAddresses.bsctestnet;
        case "bscmainnet":
            return exports.preconfiguredAddresses.bscmainnet;
        case "sepolia":
            return exports.preconfiguredAddresses.sepolia;
        case "ethereum":
            return exports.preconfiguredAddresses.ethereum;
        case "opbnbtestnet":
            return exports.preconfiguredAddresses.opbnbtestnet;
        case "opbnbmainnet":
            return exports.preconfiguredAddresses.opbnbmainnet;
        case "arbitrumsepolia":
            return exports.preconfiguredAddresses.arbitrumsepolia;
        case "arbitrumone":
            return exports.preconfiguredAddresses.arbitrumone;
        case "zksyncsepolia":
            return exports.preconfiguredAddresses.zksyncsepolia;
        case "opsepolia":
            return exports.preconfiguredAddresses.opsepolia;
        case "zksyncmainnet":
            return exports.preconfiguredAddresses.zksyncmainnet;
        case "opmainnet":
            return exports.preconfiguredAddresses.opmainnet;
        case "basesepolia":
            return exports.preconfiguredAddresses.basesepolia;
        case "basemainnet":
            return exports.preconfiguredAddresses.basemainnet;
        default:
            throw new Error(`config for network ${networkName} is not available.`);
    }
}
exports.getPreConfiguredAddresses = getPreConfiguredAddresses;
function createMethodEntries(chainId, minDstGas = 300000, maxDailyLimit = (0, utils_1.parseUnits)("100000", 18), maxSingleTransactionLimit = (0, utils_1.parseUnits)("20000", 18), maxDailyReceiveLimit = (0, utils_1.parseUnits)("102000", 18), maxSingleReceiveTransactionLimit = (0, utils_1.parseUnits)("20400", 18)) {
    return [
        { method: "setMinDstGas(uint16,uint16,uint256)", args: [chainId, 0, minDstGas] },
        { method: "setMaxDailyLimit(uint16,uint256)", args: [chainId, maxDailyLimit] },
        { method: "setMaxSingleTransactionLimit(uint16,uint256)", args: [chainId, maxSingleTransactionLimit] },
        { method: "setMaxDailyReceiveLimit(uint16,uint256)", args: [chainId, maxDailyReceiveLimit] },
        {
            method: "setMaxSingleReceiveTransactionLimit(uint16,uint256)",
            args: [chainId, maxSingleReceiveTransactionLimit],
        },
    ];
}
