"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OpenleverageFactory__factory = void 0;
const ethers_1 = require("ethers");
const _abi = [
    {
        inputs: [],
        stateMutability: "nonpayable",
        type: "constructor",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "address[]",
                name: "token",
                type: "address[]",
            },
            {
                indexed: false,
                internalType: "bool",
                name: "allowed",
                type: "bool",
            },
        ],
        name: "ChangeAllowedDepositTokens",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "address",
                name: "owner",
                type: "address",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "bool",
                name: "longToken",
                type: "bool",
            },
            {
                indexed: false,
                internalType: "bool",
                name: "depositToken",
                type: "bool",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "liquidationAmount",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "outstandingAmount",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "address",
                name: "liquidator",
                type: "address",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "depositDecrease",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "depositReturn",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "fees",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "token0Price",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "penalty",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint32",
                name: "dex",
                type: "uint32",
            },
        ],
        name: "Liquidation",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "address",
                name: "trader",
                type: "address",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "bool",
                name: "longToken",
                type: "bool",
            },
            {
                indexed: false,
                internalType: "bool",
                name: "depositToken",
                type: "bool",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "deposited",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "borrowed",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "held",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "fees",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "token0Price",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint32",
                name: "dex",
                type: "uint32",
            },
        ],
        name: "MarginTrade",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "address",
                name: "controller",
                type: "address",
            },
            {
                indexed: false,
                internalType: "address",
                name: "dexAggregator",
                type: "address",
            },
        ],
        name: "NewAddressConfig",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "address",
                name: "oldAdmin",
                type: "address",
            },
            {
                indexed: false,
                internalType: "address",
                name: "newAdmin",
                type: "address",
            },
        ],
        name: "NewAdmin",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "uint16",
                name: "defaultFeesRate",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint8",
                name: "insuranceRatio",
                type: "uint8",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "defaultMarginLimit",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "priceDiffientRatio",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "updatePriceDiscount",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "feesDiscount",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint128",
                name: "feesDiscountThreshold",
                type: "uint128",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "penaltyRatio",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint8",
                name: "maxLiquidationPriceDiffientRatio",
                type: "uint8",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "twapDuration",
                type: "uint16",
            },
        ],
        name: "NewCalculateConfig",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "feesRate",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint32",
                name: "marginLimit",
                type: "uint32",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "priceDiffientRatio",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "uint32[]",
                name: "dexs",
                type: "uint32[]",
            },
        ],
        name: "NewMarketConfig",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "address",
                name: "oldPendingAdmin",
                type: "address",
            },
            {
                indexed: false,
                internalType: "address",
                name: "newPendingAdmin",
                type: "address",
            },
        ],
        name: "NewPendingAdmin",
        type: "event",
    },
    {
        anonymous: false,
        inputs: [
            {
                indexed: false,
                internalType: "address",
                name: "owner",
                type: "address",
            },
            {
                indexed: false,
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                indexed: false,
                internalType: "bool",
                name: "longToken",
                type: "bool",
            },
            {
                indexed: false,
                internalType: "bool",
                name: "depositToken",
                type: "bool",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "closeAmount",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "depositDecrease",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "depositReturn",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "fees",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint256",
                name: "token0Price",
                type: "uint256",
            },
            {
                indexed: false,
                internalType: "uint32",
                name: "dex",
                type: "uint32",
            },
        ],
        name: "TradeClosed",
        type: "event",
    },
    {
        inputs: [],
        name: "acceptAdmin",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address",
                name: "",
                type: "address",
            },
            {
                internalType: "uint16",
                name: "",
                type: "uint16",
            },
            {
                internalType: "bool",
                name: "",
                type: "bool",
            },
        ],
        name: "activeTrades",
        outputs: [
            {
                internalType: "uint256",
                name: "deposited",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "held",
                type: "uint256",
            },
            {
                internalType: "bool",
                name: "depositToken",
                type: "bool",
            },
            {
                internalType: "uint128",
                name: "lastBlockNum",
                type: "uint128",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "addressConfig",
        outputs: [
            {
                internalType: "contract DexAggregatorInterface",
                name: "dexAggregator",
                type: "address",
            },
            {
                internalType: "address",
                name: "controller",
                type: "address",
            },
            {
                internalType: "address",
                name: "wETH",
                type: "address",
            },
            {
                internalType: "address",
                name: "xOLE",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "admin",
        outputs: [
            {
                internalType: "address payable",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address",
                name: "",
                type: "address",
            },
        ],
        name: "allowedDepositTokens",
        outputs: [
            {
                internalType: "bool",
                name: "",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "calculateConfig",
        outputs: [
            {
                internalType: "uint16",
                name: "defaultFeesRate",
                type: "uint16",
            },
            {
                internalType: "uint8",
                name: "insuranceRatio",
                type: "uint8",
            },
            {
                internalType: "uint16",
                name: "defaultMarginLimit",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "priceDiffientRatio",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "updatePriceDiscount",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "feesDiscount",
                type: "uint16",
            },
            {
                internalType: "uint128",
                name: "feesDiscountThreshold",
                type: "uint128",
            },
            {
                internalType: "uint16",
                name: "penaltyRatio",
                type: "uint16",
            },
            {
                internalType: "uint8",
                name: "maxLiquidationPriceDiffientRatio",
                type: "uint8",
            },
            {
                internalType: "uint16",
                name: "twapDuration",
                type: "uint16",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "developer",
        outputs: [
            {
                internalType: "address payable",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "implementation",
        outputs: [
            {
                internalType: "address",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "",
                type: "uint16",
            },
        ],
        name: "markets",
        outputs: [
            {
                internalType: "contract LPoolInterface",
                name: "pool0",
                type: "address",
            },
            {
                internalType: "contract LPoolInterface",
                name: "pool1",
                type: "address",
            },
            {
                internalType: "address",
                name: "token0",
                type: "address",
            },
            {
                internalType: "address",
                name: "token1",
                type: "address",
            },
            {
                internalType: "uint16",
                name: "marginLimit",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "feesRate",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "priceDiffientRatio",
                type: "uint16",
            },
            {
                internalType: "address",
                name: "priceUpdater",
                type: "address",
            },
            {
                internalType: "uint256",
                name: "pool0Insurance",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "pool1Insurance",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "numPairs",
        outputs: [
            {
                internalType: "uint16",
                name: "",
                type: "uint16",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [],
        name: "pendingAdmin",
        outputs: [
            {
                internalType: "address payable",
                name: "",
                type: "address",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address payable",
                name: "newPendingAdmin",
                type: "address",
            },
        ],
        name: "setPendingAdmin",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint8",
                name: "",
                type: "uint8",
            },
        ],
        name: "supportDexs",
        outputs: [
            {
                internalType: "bool",
                name: "",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "",
                type: "uint16",
            },
            {
                internalType: "address",
                name: "",
                type: "address",
            },
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        name: "taxes",
        outputs: [
            {
                internalType: "uint24",
                name: "",
                type: "uint24",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address",
                name: "",
                type: "address",
            },
        ],
        name: "totalHelds",
        outputs: [
            {
                internalType: "uint256",
                name: "",
                type: "uint256",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address",
                name: "_controller",
                type: "address",
            },
            {
                internalType: "contract DexAggregatorInterface",
                name: "_dexAggregator",
                type: "address",
            },
            {
                internalType: "address[]",
                name: "depositTokens",
                type: "address[]",
            },
            {
                internalType: "address",
                name: "_wETH",
                type: "address",
            },
            {
                internalType: "address",
                name: "_xOLE",
                type: "address",
            },
            {
                internalType: "uint8[]",
                name: "_supportDexs",
                type: "uint8[]",
            },
        ],
        name: "initialize",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "contract LPoolInterface",
                name: "pool0",
                type: "address",
            },
            {
                internalType: "contract LPoolInterface",
                name: "pool1",
                type: "address",
            },
            {
                internalType: "uint16",
                name: "marginLimit",
                type: "uint16",
            },
            {
                internalType: "bytes",
                name: "dexData",
                type: "bytes",
            },
        ],
        name: "addMarket",
        outputs: [
            {
                internalType: "uint16",
                name: "",
                type: "uint16",
            },
        ],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "bool",
                name: "longToken",
                type: "bool",
            },
            {
                internalType: "bool",
                name: "depositToken",
                type: "bool",
            },
            {
                internalType: "uint256",
                name: "deposit",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "borrow",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "minBuyAmount",
                type: "uint256",
            },
            {
                internalType: "bytes",
                name: "dexData",
                type: "bytes",
            },
        ],
        name: "marginTrade",
        outputs: [],
        stateMutability: "payable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "bool",
                name: "longToken",
                type: "bool",
            },
            {
                internalType: "uint256",
                name: "closeHeld",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "minOrMaxAmount",
                type: "uint256",
            },
            {
                internalType: "bytes",
                name: "dexData",
                type: "bytes",
            },
        ],
        name: "closeTrade",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address",
                name: "owner",
                type: "address",
            },
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "bool",
                name: "longToken",
                type: "bool",
            },
            {
                internalType: "uint256",
                name: "minBuy",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "maxSell",
                type: "uint256",
            },
            {
                internalType: "bytes",
                name: "dexData",
                type: "bytes",
            },
        ],
        name: "liquidate",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address",
                name: "owner",
                type: "address",
            },
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "bool",
                name: "longToken",
                type: "bool",
            },
            {
                internalType: "bytes",
                name: "dexData",
                type: "bytes",
            },
        ],
        name: "marginRatio",
        outputs: [
            {
                internalType: "uint256",
                name: "current",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "cAvg",
                type: "uint256",
            },
            {
                internalType: "uint256",
                name: "hAvg",
                type: "uint256",
            },
            {
                internalType: "uint32",
                name: "limit",
                type: "uint32",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "bytes",
                name: "dexData",
                type: "bytes",
            },
        ],
        name: "shouldUpdatePrice",
        outputs: [
            {
                internalType: "bool",
                name: "",
                type: "bool",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "bytes",
                name: "dexData",
                type: "bytes",
            },
        ],
        name: "updatePrice",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
        ],
        name: "getMarketSupportDexs",
        outputs: [
            {
                internalType: "uint32[]",
                name: "",
                type: "uint32[]",
            },
        ],
        stateMutability: "view",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "defaultFeesRate",
                type: "uint16",
            },
            {
                internalType: "uint8",
                name: "insuranceRatio",
                type: "uint8",
            },
            {
                internalType: "uint16",
                name: "defaultMarginLimit",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "priceDiffientRatio",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "updatePriceDiscount",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "feesDiscount",
                type: "uint16",
            },
            {
                internalType: "uint128",
                name: "feesDiscountThreshold",
                type: "uint128",
            },
            {
                internalType: "uint16",
                name: "penaltyRatio",
                type: "uint16",
            },
            {
                internalType: "uint8",
                name: "maxLiquidationPriceDiffientRatio",
                type: "uint8",
            },
            {
                internalType: "uint16",
                name: "twapDuration",
                type: "uint16",
            },
        ],
        name: "setCalculateConfig",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "address",
                name: "controller",
                type: "address",
            },
            {
                internalType: "contract DexAggregatorInterface",
                name: "dexAggregator",
                type: "address",
            },
        ],
        name: "setAddressConfig",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "feesRate",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "marginLimit",
                type: "uint16",
            },
            {
                internalType: "uint16",
                name: "priceDiffientRatio",
                type: "uint16",
            },
            {
                internalType: "uint32[]",
                name: "dexs",
                type: "uint32[]",
            },
        ],
        name: "setMarketConfig",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "uint8",
                name: "poolIndex",
                type: "uint8",
            },
            {
                internalType: "address",
                name: "to",
                type: "address",
            },
            {
                internalType: "uint256",
                name: "amount",
                type: "uint256",
            },
        ],
        name: "moveInsurance",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint8",
                name: "dex",
                type: "uint8",
            },
            {
                internalType: "bool",
                name: "support",
                type: "bool",
            },
        ],
        name: "setSupportDex",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
    {
        inputs: [
            {
                internalType: "uint16",
                name: "marketId",
                type: "uint16",
            },
            {
                internalType: "address",
                name: "token",
                type: "address",
            },
            {
                internalType: "uint256",
                name: "index",
                type: "uint256",
            },
            {
                internalType: "uint24",
                name: "tax",
                type: "uint24",
            },
        ],
        name: "setTaxRate",
        outputs: [],
        stateMutability: "nonpayable",
        type: "function",
    },
];
class OpenleverageFactory__factory {
    static createInterface() {
        return new ethers_1.utils.Interface(_abi);
    }
    static connect(address, signerOrProvider) {
        return new ethers_1.Contract(address, _abi, signerOrProvider);
    }
}
exports.OpenleverageFactory__factory = OpenleverageFactory__factory;
OpenleverageFactory__factory.abi = _abi;
//# sourceMappingURL=OpenleverageFactory__factory.js.map