/* Autogenerated file. Do not edit manually. */
/* tslint:disable */
/* eslint-disable */
import type {
  BaseContract,
  BigNumberish,
  BytesLike,
  FunctionFragment,
  Result,
  Interface,
  EventFragment,
  AddressLike,
  ContractRunner,
  ContractMethod,
  Listener,
} from "ethers";
import type {
  TypedContractEvent,
  TypedDeferredTopicFilter,
  TypedEventLog,
  TypedLogDescription,
  TypedListener,
  TypedContractMethod,
} from "../../../../common";

export declare namespace BorrowSwap_G2 {
  export type TokenSwapPathStruct = {
    poolFee: BigNumberish;
    tokenOut: AddressLike;
  };

  export type TokenSwapPathStructOutput = [
    poolFee: bigint,
    tokenOut: string
  ] & { poolFee: bigint; tokenOut: string };

  export type SwapArgsStruct = {
    swapPaths: BorrowSwap_G2.TokenSwapPathStruct[];
    amountOutMinimum: BigNumberish;
  };

  export type SwapArgsStructOutput = [
    swapPaths: BorrowSwap_G2.TokenSwapPathStructOutput[],
    amountOutMinimum: bigint
  ] & {
    swapPaths: BorrowSwap_G2.TokenSwapPathStructOutput[];
    amountOutMinimum: bigint;
  };

  export type AcceptCommitmentArgsStruct = {
    commitmentId: BigNumberish;
    smartCommitmentAddress: AddressLike;
    principalAmount: BigNumberish;
    collateralAmount: BigNumberish;
    collateralTokenId: BigNumberish;
    collateralTokenAddress: AddressLike;
    interestRate: BigNumberish;
    loanDuration: BigNumberish;
    merkleProof: BytesLike[];
  };

  export type AcceptCommitmentArgsStructOutput = [
    commitmentId: bigint,
    smartCommitmentAddress: string,
    principalAmount: bigint,
    collateralAmount: bigint,
    collateralTokenId: bigint,
    collateralTokenAddress: string,
    interestRate: bigint,
    loanDuration: bigint,
    merkleProof: string[]
  ] & {
    commitmentId: bigint;
    smartCommitmentAddress: string;
    principalAmount: bigint;
    collateralAmount: bigint;
    collateralTokenId: bigint;
    collateralTokenAddress: string;
    interestRate: bigint;
    loanDuration: bigint;
    merkleProof: string[];
  };
}

export interface BorrowSwap_G2Interface extends Interface {
  getFunction(
    nameOrSignature:
      | "TELLER_V2"
      | "UNISWAP_QUOTER"
      | "UNISWAP_SWAP_ROUTER"
      | "borrowSwap"
      | "generateSwapPath"
      | "getMarketFeePct"
      | "getMarketIdForCommitment"
      | "quoteExactInput"
  ): FunctionFragment;

  getEvent(nameOrSignatureOrTopic: "BorrowSwapComplete"): EventFragment;

  encodeFunctionData(functionFragment: "TELLER_V2", values?: undefined): string;
  encodeFunctionData(
    functionFragment: "UNISWAP_QUOTER",
    values?: undefined
  ): string;
  encodeFunctionData(
    functionFragment: "UNISWAP_SWAP_ROUTER",
    values?: undefined
  ): string;
  encodeFunctionData(
    functionFragment: "borrowSwap",
    values: [
      AddressLike,
      AddressLike,
      BigNumberish,
      BorrowSwap_G2.SwapArgsStruct,
      BorrowSwap_G2.AcceptCommitmentArgsStruct
    ]
  ): string;
  encodeFunctionData(
    functionFragment: "generateSwapPath",
    values: [AddressLike, BorrowSwap_G2.TokenSwapPathStruct[]]
  ): string;
  encodeFunctionData(
    functionFragment: "getMarketFeePct",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getMarketIdForCommitment",
    values: [AddressLike, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "quoteExactInput",
    values: [AddressLike, BigNumberish, BorrowSwap_G2.TokenSwapPathStruct[]]
  ): string;

  decodeFunctionResult(functionFragment: "TELLER_V2", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "UNISWAP_QUOTER",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "UNISWAP_SWAP_ROUTER",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "borrowSwap", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "generateSwapPath",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getMarketFeePct",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getMarketIdForCommitment",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "quoteExactInput",
    data: BytesLike
  ): Result;
}

export namespace BorrowSwapCompleteEvent {
  export type InputTuple = [
    borrower: AddressLike,
    loanId: BigNumberish,
    token0: AddressLike,
    amountIn: BigNumberish,
    amountOut: BigNumberish
  ];
  export type OutputTuple = [
    borrower: string,
    loanId: bigint,
    token0: string,
    amountIn: bigint,
    amountOut: bigint
  ];
  export interface OutputObject {
    borrower: string;
    loanId: bigint;
    token0: string;
    amountIn: bigint;
    amountOut: bigint;
  }
  export type Event = TypedContractEvent<InputTuple, OutputTuple, OutputObject>;
  export type Filter = TypedDeferredTopicFilter<Event>;
  export type Log = TypedEventLog<Event>;
  export type LogDescription = TypedLogDescription<Event>;
}

export interface BorrowSwap_G2 extends BaseContract {
  connect(runner?: ContractRunner | null): BorrowSwap_G2;
  waitForDeployment(): Promise<this>;

  interface: BorrowSwap_G2Interface;

  queryFilter<TCEvent extends TypedContractEvent>(
    event: TCEvent,
    fromBlockOrBlockhash?: string | number | undefined,
    toBlock?: string | number | undefined
  ): Promise<Array<TypedEventLog<TCEvent>>>;
  queryFilter<TCEvent extends TypedContractEvent>(
    filter: TypedDeferredTopicFilter<TCEvent>,
    fromBlockOrBlockhash?: string | number | undefined,
    toBlock?: string | number | undefined
  ): Promise<Array<TypedEventLog<TCEvent>>>;

  on<TCEvent extends TypedContractEvent>(
    event: TCEvent,
    listener: TypedListener<TCEvent>
  ): Promise<this>;
  on<TCEvent extends TypedContractEvent>(
    filter: TypedDeferredTopicFilter<TCEvent>,
    listener: TypedListener<TCEvent>
  ): Promise<this>;

  once<TCEvent extends TypedContractEvent>(
    event: TCEvent,
    listener: TypedListener<TCEvent>
  ): Promise<this>;
  once<TCEvent extends TypedContractEvent>(
    filter: TypedDeferredTopicFilter<TCEvent>,
    listener: TypedListener<TCEvent>
  ): Promise<this>;

  listeners<TCEvent extends TypedContractEvent>(
    event: TCEvent
  ): Promise<Array<TypedListener<TCEvent>>>;
  listeners(eventName?: string): Promise<Array<Listener>>;
  removeAllListeners<TCEvent extends TypedContractEvent>(
    event?: TCEvent
  ): Promise<this>;

  TELLER_V2: TypedContractMethod<[], [string], "view">;

  UNISWAP_QUOTER: TypedContractMethod<[], [string], "view">;

  UNISWAP_SWAP_ROUTER: TypedContractMethod<[], [string], "view">;

  borrowSwap: TypedContractMethod<
    [
      _lenderCommitmentForwarder: AddressLike,
      _principalToken: AddressLike,
      _additionalInputAmount: BigNumberish,
      _swapArgs: BorrowSwap_G2.SwapArgsStruct,
      _acceptCommitmentArgs: BorrowSwap_G2.AcceptCommitmentArgsStruct
    ],
    [void],
    "nonpayable"
  >;

  generateSwapPath: TypedContractMethod<
    [inputToken: AddressLike, swapPaths: BorrowSwap_G2.TokenSwapPathStruct[]],
    [string],
    "view"
  >;

  getMarketFeePct: TypedContractMethod<
    [_marketId: BigNumberish],
    [bigint],
    "view"
  >;

  getMarketIdForCommitment: TypedContractMethod<
    [_lenderCommitmentForwarder: AddressLike, _commitmentId: BigNumberish],
    [bigint],
    "view"
  >;

  quoteExactInput: TypedContractMethod<
    [
      inputToken: AddressLike,
      amountIn: BigNumberish,
      swapPaths: BorrowSwap_G2.TokenSwapPathStruct[]
    ],
    [bigint],
    "view"
  >;

  getFunction<T extends ContractMethod = ContractMethod>(
    key: string | FunctionFragment
  ): T;

  getFunction(
    nameOrSignature: "TELLER_V2"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "UNISWAP_QUOTER"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "UNISWAP_SWAP_ROUTER"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "borrowSwap"
  ): TypedContractMethod<
    [
      _lenderCommitmentForwarder: AddressLike,
      _principalToken: AddressLike,
      _additionalInputAmount: BigNumberish,
      _swapArgs: BorrowSwap_G2.SwapArgsStruct,
      _acceptCommitmentArgs: BorrowSwap_G2.AcceptCommitmentArgsStruct
    ],
    [void],
    "nonpayable"
  >;
  getFunction(
    nameOrSignature: "generateSwapPath"
  ): TypedContractMethod<
    [inputToken: AddressLike, swapPaths: BorrowSwap_G2.TokenSwapPathStruct[]],
    [string],
    "view"
  >;
  getFunction(
    nameOrSignature: "getMarketFeePct"
  ): TypedContractMethod<[_marketId: BigNumberish], [bigint], "view">;
  getFunction(
    nameOrSignature: "getMarketIdForCommitment"
  ): TypedContractMethod<
    [_lenderCommitmentForwarder: AddressLike, _commitmentId: BigNumberish],
    [bigint],
    "view"
  >;
  getFunction(
    nameOrSignature: "quoteExactInput"
  ): TypedContractMethod<
    [
      inputToken: AddressLike,
      amountIn: BigNumberish,
      swapPaths: BorrowSwap_G2.TokenSwapPathStruct[]
    ],
    [bigint],
    "view"
  >;

  getEvent(
    key: "BorrowSwapComplete"
  ): TypedContractEvent<
    BorrowSwapCompleteEvent.InputTuple,
    BorrowSwapCompleteEvent.OutputTuple,
    BorrowSwapCompleteEvent.OutputObject
  >;

  filters: {
    "BorrowSwapComplete(address,uint256,address,uint256,uint256)": TypedContractEvent<
      BorrowSwapCompleteEvent.InputTuple,
      BorrowSwapCompleteEvent.OutputTuple,
      BorrowSwapCompleteEvent.OutputObject
    >;
    BorrowSwapComplete: TypedContractEvent<
      BorrowSwapCompleteEvent.InputTuple,
      BorrowSwapCompleteEvent.OutputTuple,
      BorrowSwapCompleteEvent.OutputObject
    >;
  };
}
