/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */

import {
  ethers,
  EventFilter,
  Signer,
  BigNumber,
  BigNumberish,
  PopulatedTransaction,
  BaseContract,
  ContractTransaction,
  Overrides,
  CallOverrides,
} from "ethers";
import { BytesLike } from "@ethersproject/bytes";
import { Listener, Provider } from "@ethersproject/providers";
import { FunctionFragment, EventFragment, Result } from "@ethersproject/abi";
import type { TypedEventFilter, TypedEvent, TypedListener } from "./common";

interface IFutureInterface extends ethers.utils.Interface {
  functions: {
    "calcNewPosition(address,address,address,bool,uint256,uint256,bool)": FunctionFragment;
    "collateralInsuranceFunds(address)": FunctionFragment;
    "cumulativeLongFundingRates(bytes32)": FunctionFragment;
    "cumulativeShortFundingRates(bytes32)": FunctionFragment;
    "decreaseMargin(address,address,address,bool,uint256,address)": FunctionFragment;
    "decreasePositionByRatio(address,address,address,bool,uint256,address)": FunctionFragment;
    "getMaintanenceMarginRatio(address,address,address,bool)": FunctionFragment;
    "getPairKey(address,address)": FunctionFragment;
    "getPairStatus(address,address)": FunctionFragment;
    "getPosition(address,address,address,bool)": FunctionFragment;
    "getPrice(address)": FunctionFragment;
    "getUtilisationRatio(address,address,int256,int256)": FunctionFragment;
    "increaseInsuranceFund(address,uint256)": FunctionFragment;
    "increaseMargin(address,address,address,uint256,bool)": FunctionFragment;
    "increasePosition(address,address,address,bool,uint256,uint256)": FunctionFragment;
    "increasePositionExecFees(bytes32)": FunctionFragment;
    "lastFundingTimestamps(bytes32)": FunctionFragment;
    "liquidatePosition(address,address,address,bool)": FunctionFragment;
    "longFundingRates(bytes32)": FunctionFragment;
    "maxDecreasePositionTradingFeeRates(bytes32)": FunctionFragment;
    "maxLeverages(bytes32)": FunctionFragment;
    "maxMaintanenceMarginRatios(bytes32)": FunctionFragment;
    "maxPositionUsdWithMaxLeverages(bytes32)": FunctionFragment;
    "maxTotalLongSizes(bytes32)": FunctionFragment;
    "maxTotalShortSizes(bytes32)": FunctionFragment;
    "minMaintanenceMarginRatios(bytes32)": FunctionFragment;
    "protocolUnrealizedFees(bytes32)": FunctionFragment;
    "shortFundingRates(bytes32)": FunctionFragment;
    "token1ToToken2(address,int256,address)": FunctionFragment;
    "tokenDecimals(address)": FunctionFragment;
    "totalLongOpenNotionals(bytes32)": FunctionFragment;
    "totalLongSizes(bytes32)": FunctionFragment;
    "totalShortOpenNotionals(bytes32)": FunctionFragment;
    "totalShortSizes(bytes32)": FunctionFragment;
    "tradingFeeRates(bytes32)": FunctionFragment;
    "validateLiquidate(address,address,address,bool,bool)": FunctionFragment;
  };

  encodeFunctionData(
    functionFragment: "calcNewPosition",
    values: [
      string,
      string,
      string,
      boolean,
      BigNumberish,
      BigNumberish,
      boolean
    ]
  ): string;
  encodeFunctionData(
    functionFragment: "collateralInsuranceFunds",
    values: [string]
  ): string;
  encodeFunctionData(
    functionFragment: "cumulativeLongFundingRates",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "cumulativeShortFundingRates",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "decreaseMargin",
    values: [string, string, string, boolean, BigNumberish, string]
  ): string;
  encodeFunctionData(
    functionFragment: "decreasePositionByRatio",
    values: [string, string, string, boolean, BigNumberish, string]
  ): string;
  encodeFunctionData(
    functionFragment: "getMaintanenceMarginRatio",
    values: [string, string, string, boolean]
  ): string;
  encodeFunctionData(
    functionFragment: "getPairKey",
    values: [string, string]
  ): string;
  encodeFunctionData(
    functionFragment: "getPairStatus",
    values: [string, string]
  ): string;
  encodeFunctionData(
    functionFragment: "getPosition",
    values: [string, string, string, boolean]
  ): string;
  encodeFunctionData(functionFragment: "getPrice", values: [string]): string;
  encodeFunctionData(
    functionFragment: "getUtilisationRatio",
    values: [string, string, BigNumberish, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "increaseInsuranceFund",
    values: [string, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "increaseMargin",
    values: [string, string, string, BigNumberish, boolean]
  ): string;
  encodeFunctionData(
    functionFragment: "increasePosition",
    values: [string, string, string, boolean, BigNumberish, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "increasePositionExecFees",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "lastFundingTimestamps",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "liquidatePosition",
    values: [string, string, string, boolean]
  ): string;
  encodeFunctionData(
    functionFragment: "longFundingRates",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "maxDecreasePositionTradingFeeRates",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "maxLeverages",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "maxMaintanenceMarginRatios",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "maxPositionUsdWithMaxLeverages",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "maxTotalLongSizes",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "maxTotalShortSizes",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "minMaintanenceMarginRatios",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "protocolUnrealizedFees",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "shortFundingRates",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "token1ToToken2",
    values: [string, BigNumberish, string]
  ): string;
  encodeFunctionData(
    functionFragment: "tokenDecimals",
    values: [string]
  ): string;
  encodeFunctionData(
    functionFragment: "totalLongOpenNotionals",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "totalLongSizes",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "totalShortOpenNotionals",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "totalShortSizes",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "tradingFeeRates",
    values: [BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "validateLiquidate",
    values: [string, string, string, boolean, boolean]
  ): string;

  decodeFunctionResult(
    functionFragment: "calcNewPosition",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "collateralInsuranceFunds",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "cumulativeLongFundingRates",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "cumulativeShortFundingRates",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "decreaseMargin",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "decreasePositionByRatio",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getMaintanenceMarginRatio",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "getPairKey", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "getPairStatus",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getPosition",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "getPrice", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "getUtilisationRatio",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "increaseInsuranceFund",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "increaseMargin",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "increasePosition",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "increasePositionExecFees",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "lastFundingTimestamps",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "liquidatePosition",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "longFundingRates",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "maxDecreasePositionTradingFeeRates",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "maxLeverages",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "maxMaintanenceMarginRatios",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "maxPositionUsdWithMaxLeverages",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "maxTotalLongSizes",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "maxTotalShortSizes",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "minMaintanenceMarginRatios",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "protocolUnrealizedFees",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "shortFundingRates",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "token1ToToken2",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "tokenDecimals",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "totalLongOpenNotionals",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "totalLongSizes",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "totalShortOpenNotionals",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "totalShortSizes",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "tradingFeeRates",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "validateLiquidate",
    data: BytesLike
  ): Result;

  events: {};
}

export class IFuture extends BaseContract {
  connect(signerOrProvider: Signer | Provider | string): this;
  attach(addressOrName: string): this;
  deployed(): Promise<this>;

  listeners<EventArgsArray extends Array<any>, EventArgsObject>(
    eventFilter?: TypedEventFilter<EventArgsArray, EventArgsObject>
  ): Array<TypedListener<EventArgsArray, EventArgsObject>>;
  off<EventArgsArray extends Array<any>, EventArgsObject>(
    eventFilter: TypedEventFilter<EventArgsArray, EventArgsObject>,
    listener: TypedListener<EventArgsArray, EventArgsObject>
  ): this;
  on<EventArgsArray extends Array<any>, EventArgsObject>(
    eventFilter: TypedEventFilter<EventArgsArray, EventArgsObject>,
    listener: TypedListener<EventArgsArray, EventArgsObject>
  ): this;
  once<EventArgsArray extends Array<any>, EventArgsObject>(
    eventFilter: TypedEventFilter<EventArgsArray, EventArgsObject>,
    listener: TypedListener<EventArgsArray, EventArgsObject>
  ): this;
  removeListener<EventArgsArray extends Array<any>, EventArgsObject>(
    eventFilter: TypedEventFilter<EventArgsArray, EventArgsObject>,
    listener: TypedListener<EventArgsArray, EventArgsObject>
  ): this;
  removeAllListeners<EventArgsArray extends Array<any>, EventArgsObject>(
    eventFilter: TypedEventFilter<EventArgsArray, EventArgsObject>
  ): this;

  listeners(eventName?: string): Array<Listener>;
  off(eventName: string, listener: Listener): this;
  on(eventName: string, listener: Listener): this;
  once(eventName: string, listener: Listener): this;
  removeListener(eventName: string, listener: Listener): this;
  removeAllListeners(eventName?: string): this;

  queryFilter<EventArgsArray extends Array<any>, EventArgsObject>(
    event: TypedEventFilter<EventArgsArray, EventArgsObject>,
    fromBlockOrBlockhash?: string | number | undefined,
    toBlock?: string | number | undefined
  ): Promise<Array<TypedEvent<EventArgsArray & EventArgsObject>>>;

  interface: IFutureInterface;

  functions: {
    calcNewPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _sizeDelta: BigNumberish,
      _isIncreasePosition: boolean,
      overrides?: CallOverrides
    ): Promise<
      [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
        fundingFee: BigNumber;
        tradingFee: BigNumber;
        pnl: BigNumber;
        remainMargin: BigNumber;
        marginRatio: BigNumber;
        openNotional: BigNumber;
      }
    >;

    collateralInsuranceFunds(
      addr: string,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    cumulativeLongFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    cumulativeShortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    decreaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _marginDelta: BigNumberish,
      _receiver: string,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<ContractTransaction>;

    decreasePositionByRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _receiver: string,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<ContractTransaction>;

    getMaintanenceMarginRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    getPairKey(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<[string]>;

    getPairStatus(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<[number]>;

    getPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<
      [BigNumber, BigNumber, BigNumber, BigNumber] & {
        margin: BigNumber;
        openNotional: BigNumber;
        size: BigNumber;
        entryFundingRate: BigNumber;
      }
    >;

    getPrice(_token: string, overrides?: CallOverrides): Promise<[BigNumber]>;

    getUtilisationRatio(
      _collateralToken: string,
      _indexToken: string,
      _longSizeDelta: BigNumberish,
      _shortSizeDelta: BigNumberish,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    increaseInsuranceFund(
      _collateralToken: string,
      _insuranceInAmount: BigNumberish,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<ContractTransaction>;

    increaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _marginInAmount: BigNumberish,
      _isLong: boolean,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<ContractTransaction>;

    increasePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _marginInAmount: BigNumberish,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<ContractTransaction>;

    increasePositionExecFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    lastFundingTimestamps(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    liquidatePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<ContractTransaction>;

    longFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    maxDecreasePositionTradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    maxLeverages(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    maxMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    maxPositionUsdWithMaxLeverages(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    maxTotalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    maxTotalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    minMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    protocolUnrealizedFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    shortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    token1ToToken2(
      token1: string,
      token1Amount: BigNumberish,
      token2: string,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    tokenDecimals(token: string, overrides?: CallOverrides): Promise<[number]>;

    totalLongOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    totalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    totalShortOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    totalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    tradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<[BigNumber]>;

    validateLiquidate(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _raise: boolean,
      overrides?: CallOverrides
    ): Promise<[boolean] & { shouldLiquidate: boolean }>;
  };

  calcNewPosition(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    _notionalDelta: BigNumberish,
    _sizeDelta: BigNumberish,
    _isIncreasePosition: boolean,
    overrides?: CallOverrides
  ): Promise<
    [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
      fundingFee: BigNumber;
      tradingFee: BigNumber;
      pnl: BigNumber;
      remainMargin: BigNumber;
      marginRatio: BigNumber;
      openNotional: BigNumber;
    }
  >;

  collateralInsuranceFunds(
    addr: string,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  cumulativeLongFundingRates(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  cumulativeShortFundingRates(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  decreaseMargin(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    _marginDelta: BigNumberish,
    _receiver: string,
    overrides?: Overrides & { from?: string | Promise<string> }
  ): Promise<ContractTransaction>;

  decreasePositionByRatio(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    _notionalDelta: BigNumberish,
    _receiver: string,
    overrides?: Overrides & { from?: string | Promise<string> }
  ): Promise<ContractTransaction>;

  getMaintanenceMarginRatio(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  getPairKey(
    _collateralToken: string,
    _indexToken: string,
    overrides?: CallOverrides
  ): Promise<string>;

  getPairStatus(
    _collateralToken: string,
    _indexToken: string,
    overrides?: CallOverrides
  ): Promise<number>;

  getPosition(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    overrides?: CallOverrides
  ): Promise<
    [BigNumber, BigNumber, BigNumber, BigNumber] & {
      margin: BigNumber;
      openNotional: BigNumber;
      size: BigNumber;
      entryFundingRate: BigNumber;
    }
  >;

  getPrice(_token: string, overrides?: CallOverrides): Promise<BigNumber>;

  getUtilisationRatio(
    _collateralToken: string,
    _indexToken: string,
    _longSizeDelta: BigNumberish,
    _shortSizeDelta: BigNumberish,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  increaseInsuranceFund(
    _collateralToken: string,
    _insuranceInAmount: BigNumberish,
    overrides?: Overrides & { from?: string | Promise<string> }
  ): Promise<ContractTransaction>;

  increaseMargin(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _marginInAmount: BigNumberish,
    _isLong: boolean,
    overrides?: Overrides & { from?: string | Promise<string> }
  ): Promise<ContractTransaction>;

  increasePosition(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    _notionalDelta: BigNumberish,
    _marginInAmount: BigNumberish,
    overrides?: Overrides & { from?: string | Promise<string> }
  ): Promise<ContractTransaction>;

  increasePositionExecFees(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  lastFundingTimestamps(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  liquidatePosition(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    overrides?: Overrides & { from?: string | Promise<string> }
  ): Promise<ContractTransaction>;

  longFundingRates(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  maxDecreasePositionTradingFeeRates(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  maxLeverages(key: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;

  maxMaintanenceMarginRatios(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  maxPositionUsdWithMaxLeverages(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  maxTotalLongSizes(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  maxTotalShortSizes(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  minMaintanenceMarginRatios(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  protocolUnrealizedFees(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  shortFundingRates(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  token1ToToken2(
    token1: string,
    token1Amount: BigNumberish,
    token2: string,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  tokenDecimals(token: string, overrides?: CallOverrides): Promise<number>;

  totalLongOpenNotionals(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  totalLongSizes(key: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;

  totalShortOpenNotionals(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  totalShortSizes(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  tradingFeeRates(
    key: BytesLike,
    overrides?: CallOverrides
  ): Promise<BigNumber>;

  validateLiquidate(
    _collateralToken: string,
    _indexToken: string,
    _account: string,
    _isLong: boolean,
    _raise: boolean,
    overrides?: CallOverrides
  ): Promise<boolean>;

  callStatic: {
    calcNewPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _sizeDelta: BigNumberish,
      _isIncreasePosition: boolean,
      overrides?: CallOverrides
    ): Promise<
      [BigNumber, BigNumber, BigNumber, BigNumber, BigNumber, BigNumber] & {
        fundingFee: BigNumber;
        tradingFee: BigNumber;
        pnl: BigNumber;
        remainMargin: BigNumber;
        marginRatio: BigNumber;
        openNotional: BigNumber;
      }
    >;

    collateralInsuranceFunds(
      addr: string,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    cumulativeLongFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    cumulativeShortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    decreaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _marginDelta: BigNumberish,
      _receiver: string,
      overrides?: CallOverrides
    ): Promise<void>;

    decreasePositionByRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _receiver: string,
      overrides?: CallOverrides
    ): Promise<[BigNumber, BigNumber, BigNumber]>;

    getMaintanenceMarginRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    getPairKey(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<string>;

    getPairStatus(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<number>;

    getPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<
      [BigNumber, BigNumber, BigNumber, BigNumber] & {
        margin: BigNumber;
        openNotional: BigNumber;
        size: BigNumber;
        entryFundingRate: BigNumber;
      }
    >;

    getPrice(_token: string, overrides?: CallOverrides): Promise<BigNumber>;

    getUtilisationRatio(
      _collateralToken: string,
      _indexToken: string,
      _longSizeDelta: BigNumberish,
      _shortSizeDelta: BigNumberish,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    increaseInsuranceFund(
      _collateralToken: string,
      _insuranceInAmount: BigNumberish,
      overrides?: CallOverrides
    ): Promise<void>;

    increaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _marginInAmount: BigNumberish,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<void>;

    increasePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _marginInAmount: BigNumberish,
      overrides?: CallOverrides
    ): Promise<[BigNumber, BigNumber]>;

    increasePositionExecFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    lastFundingTimestamps(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    liquidatePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<[BigNumber, BigNumber]>;

    longFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxDecreasePositionTradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxLeverages(key: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;

    maxMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxPositionUsdWithMaxLeverages(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxTotalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxTotalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    minMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    protocolUnrealizedFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    shortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    token1ToToken2(
      token1: string,
      token1Amount: BigNumberish,
      token2: string,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    tokenDecimals(token: string, overrides?: CallOverrides): Promise<number>;

    totalLongOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    totalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    totalShortOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    totalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    tradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    validateLiquidate(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _raise: boolean,
      overrides?: CallOverrides
    ): Promise<boolean>;
  };

  filters: {};

  estimateGas: {
    calcNewPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _sizeDelta: BigNumberish,
      _isIncreasePosition: boolean,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    collateralInsuranceFunds(
      addr: string,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    cumulativeLongFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    cumulativeShortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    decreaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _marginDelta: BigNumberish,
      _receiver: string,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<BigNumber>;

    decreasePositionByRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _receiver: string,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<BigNumber>;

    getMaintanenceMarginRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    getPairKey(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    getPairStatus(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    getPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    getPrice(_token: string, overrides?: CallOverrides): Promise<BigNumber>;

    getUtilisationRatio(
      _collateralToken: string,
      _indexToken: string,
      _longSizeDelta: BigNumberish,
      _shortSizeDelta: BigNumberish,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    increaseInsuranceFund(
      _collateralToken: string,
      _insuranceInAmount: BigNumberish,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<BigNumber>;

    increaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _marginInAmount: BigNumberish,
      _isLong: boolean,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<BigNumber>;

    increasePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _marginInAmount: BigNumberish,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<BigNumber>;

    increasePositionExecFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    lastFundingTimestamps(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    liquidatePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<BigNumber>;

    longFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxDecreasePositionTradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxLeverages(key: BytesLike, overrides?: CallOverrides): Promise<BigNumber>;

    maxMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxPositionUsdWithMaxLeverages(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxTotalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    maxTotalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    minMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    protocolUnrealizedFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    shortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    token1ToToken2(
      token1: string,
      token1Amount: BigNumberish,
      token2: string,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    tokenDecimals(token: string, overrides?: CallOverrides): Promise<BigNumber>;

    totalLongOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    totalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    totalShortOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    totalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    tradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<BigNumber>;

    validateLiquidate(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _raise: boolean,
      overrides?: CallOverrides
    ): Promise<BigNumber>;
  };

  populateTransaction: {
    calcNewPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _sizeDelta: BigNumberish,
      _isIncreasePosition: boolean,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    collateralInsuranceFunds(
      addr: string,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    cumulativeLongFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    cumulativeShortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    decreaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _marginDelta: BigNumberish,
      _receiver: string,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<PopulatedTransaction>;

    decreasePositionByRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _receiver: string,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<PopulatedTransaction>;

    getMaintanenceMarginRatio(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    getPairKey(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    getPairStatus(
      _collateralToken: string,
      _indexToken: string,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    getPosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    getPrice(
      _token: string,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    getUtilisationRatio(
      _collateralToken: string,
      _indexToken: string,
      _longSizeDelta: BigNumberish,
      _shortSizeDelta: BigNumberish,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    increaseInsuranceFund(
      _collateralToken: string,
      _insuranceInAmount: BigNumberish,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<PopulatedTransaction>;

    increaseMargin(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _marginInAmount: BigNumberish,
      _isLong: boolean,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<PopulatedTransaction>;

    increasePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _notionalDelta: BigNumberish,
      _marginInAmount: BigNumberish,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<PopulatedTransaction>;

    increasePositionExecFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    lastFundingTimestamps(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    liquidatePosition(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      overrides?: Overrides & { from?: string | Promise<string> }
    ): Promise<PopulatedTransaction>;

    longFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    maxDecreasePositionTradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    maxLeverages(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    maxMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    maxPositionUsdWithMaxLeverages(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    maxTotalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    maxTotalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    minMaintanenceMarginRatios(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    protocolUnrealizedFees(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    shortFundingRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    token1ToToken2(
      token1: string,
      token1Amount: BigNumberish,
      token2: string,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    tokenDecimals(
      token: string,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    totalLongOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    totalLongSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    totalShortOpenNotionals(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    totalShortSizes(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    tradingFeeRates(
      key: BytesLike,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;

    validateLiquidate(
      _collateralToken: string,
      _indexToken: string,
      _account: string,
      _isLong: boolean,
      _raise: boolean,
      overrides?: CallOverrides
    ): Promise<PopulatedTransaction>;
  };
}
