/* 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_G1 {
  export type SwapArgsStruct = {
    token0: AddressLike;
    token1: AddressLike;
    fee: BigNumberish;
    sqrtPriceLimitX96: BigNumberish;
  };

  export type SwapArgsStructOutput = [
    token0: string,
    token1: string,
    fee: bigint,
    sqrtPriceLimitX96: bigint
  ] & {
    token0: string;
    token1: string;
    fee: bigint;
    sqrtPriceLimitX96: 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_G1Interface extends Interface {
  getFunction(
    nameOrSignature:
      | "TELLER_V2"
      | "WETH9"
      | "borrowSwap"
      | "calculateSqrtPriceLimitX96"
      | "factory"
      | "getMarketFeePct"
      | "getMarketIdForCommitment"
      | "getUniswapPoolAddress"
      | "refundETH"
      | "sweepToken"
      | "uniswapV3SwapCallback"
      | "unwrapWETH9"
  ): FunctionFragment;

  getEvent(nameOrSignatureOrTopic: "BorrowSwapComplete"): EventFragment;

  encodeFunctionData(functionFragment: "TELLER_V2", values?: undefined): string;
  encodeFunctionData(functionFragment: "WETH9", values?: undefined): string;
  encodeFunctionData(
    functionFragment: "borrowSwap",
    values: [
      AddressLike,
      AddressLike,
      BigNumberish,
      BorrowSwap_G1.SwapArgsStruct,
      BorrowSwap_G1.AcceptCommitmentArgsStruct
    ]
  ): string;
  encodeFunctionData(
    functionFragment: "calculateSqrtPriceLimitX96",
    values: [AddressLike, AddressLike, BigNumberish, boolean, BigNumberish]
  ): string;
  encodeFunctionData(functionFragment: "factory", values?: undefined): string;
  encodeFunctionData(
    functionFragment: "getMarketFeePct",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getMarketIdForCommitment",
    values: [AddressLike, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getUniswapPoolAddress",
    values: [AddressLike, AddressLike, BigNumberish]
  ): string;
  encodeFunctionData(functionFragment: "refundETH", values?: undefined): string;
  encodeFunctionData(
    functionFragment: "sweepToken",
    values: [AddressLike, BigNumberish, AddressLike]
  ): string;
  encodeFunctionData(
    functionFragment: "uniswapV3SwapCallback",
    values: [BigNumberish, BigNumberish, BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "unwrapWETH9",
    values: [BigNumberish, AddressLike]
  ): string;

  decodeFunctionResult(functionFragment: "TELLER_V2", data: BytesLike): Result;
  decodeFunctionResult(functionFragment: "WETH9", data: BytesLike): Result;
  decodeFunctionResult(functionFragment: "borrowSwap", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "calculateSqrtPriceLimitX96",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "factory", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "getMarketFeePct",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getMarketIdForCommitment",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getUniswapPoolAddress",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "refundETH", data: BytesLike): Result;
  decodeFunctionResult(functionFragment: "sweepToken", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "uniswapV3SwapCallback",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "unwrapWETH9",
    data: BytesLike
  ): Result;
}

export namespace BorrowSwapCompleteEvent {
  export type InputTuple = [
    borrower: AddressLike,
    loanId: BigNumberish,
    token0: AddressLike,
    token1: AddressLike,
    amount0: BigNumberish,
    amount1: BigNumberish
  ];
  export type OutputTuple = [
    borrower: string,
    loanId: bigint,
    token0: string,
    token1: string,
    amount0: bigint,
    amount1: bigint
  ];
  export interface OutputObject {
    borrower: string;
    loanId: bigint;
    token0: string;
    token1: string;
    amount0: bigint;
    amount1: 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_G1 extends BaseContract {
  connect(runner?: ContractRunner | null): BorrowSwap_G1;
  waitForDeployment(): Promise<this>;

  interface: BorrowSwap_G1Interface;

  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">;

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

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

  calculateSqrtPriceLimitX96: TypedContractMethod<
    [
      token0: AddressLike,
      token1: AddressLike,
      fee: BigNumberish,
      zeroForOne: boolean,
      bufferBps: BigNumberish
    ],
    [bigint],
    "view"
  >;

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

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

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

  getUniswapPoolAddress: TypedContractMethod<
    [token0: AddressLike, token1: AddressLike, fee: BigNumberish],
    [string],
    "view"
  >;

  refundETH: TypedContractMethod<[], [void], "payable">;

  sweepToken: TypedContractMethod<
    [token: AddressLike, amountMinimum: BigNumberish, recipient: AddressLike],
    [void],
    "payable"
  >;

  uniswapV3SwapCallback: TypedContractMethod<
    [amount0Delta: BigNumberish, amount1Delta: BigNumberish, data: BytesLike],
    [void],
    "nonpayable"
  >;

  unwrapWETH9: TypedContractMethod<
    [amountMinimum: BigNumberish, recipient: AddressLike],
    [void],
    "payable"
  >;

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

  getFunction(
    nameOrSignature: "TELLER_V2"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "WETH9"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "borrowSwap"
  ): TypedContractMethod<
    [
      _lenderCommitmentForwarder: AddressLike,
      _principalToken: AddressLike,
      _additionalInputAmount: BigNumberish,
      _swapArgs: BorrowSwap_G1.SwapArgsStruct,
      _acceptCommitmentArgs: BorrowSwap_G1.AcceptCommitmentArgsStruct
    ],
    [void],
    "nonpayable"
  >;
  getFunction(
    nameOrSignature: "calculateSqrtPriceLimitX96"
  ): TypedContractMethod<
    [
      token0: AddressLike,
      token1: AddressLike,
      fee: BigNumberish,
      zeroForOne: boolean,
      bufferBps: BigNumberish
    ],
    [bigint],
    "view"
  >;
  getFunction(
    nameOrSignature: "factory"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "getMarketFeePct"
  ): TypedContractMethod<[_marketId: BigNumberish], [bigint], "view">;
  getFunction(
    nameOrSignature: "getMarketIdForCommitment"
  ): TypedContractMethod<
    [_lenderCommitmentForwarder: AddressLike, _commitmentId: BigNumberish],
    [bigint],
    "view"
  >;
  getFunction(
    nameOrSignature: "getUniswapPoolAddress"
  ): TypedContractMethod<
    [token0: AddressLike, token1: AddressLike, fee: BigNumberish],
    [string],
    "view"
  >;
  getFunction(
    nameOrSignature: "refundETH"
  ): TypedContractMethod<[], [void], "payable">;
  getFunction(
    nameOrSignature: "sweepToken"
  ): TypedContractMethod<
    [token: AddressLike, amountMinimum: BigNumberish, recipient: AddressLike],
    [void],
    "payable"
  >;
  getFunction(
    nameOrSignature: "uniswapV3SwapCallback"
  ): TypedContractMethod<
    [amount0Delta: BigNumberish, amount1Delta: BigNumberish, data: BytesLike],
    [void],
    "nonpayable"
  >;
  getFunction(
    nameOrSignature: "unwrapWETH9"
  ): TypedContractMethod<
    [amountMinimum: BigNumberish, recipient: AddressLike],
    [void],
    "payable"
  >;

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

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