/* 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 ICommitmentRolloverLoan {
  export type AcceptCommitmentArgsStruct = {
    commitmentId: BigNumberish;
    principalAmount: BigNumberish;
    collateralAmount: BigNumberish;
    collateralTokenId: BigNumberish;
    collateralTokenAddress: AddressLike;
    interestRate: BigNumberish;
    loanDuration: BigNumberish;
  };

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

export interface FlashRolloverLoanInterface extends Interface {
  getFunction(
    nameOrSignature:
      | "ADDRESSES_PROVIDER"
      | "LENDER_COMMITMENT_FORWARDER"
      | "POOL"
      | "POOL_ADDRESSES_PROVIDER"
      | "TELLER_V2"
      | "calculateRolloverAmount"
      | "executeOperation"
      | "rolloverLoanWithFlash"
  ): FunctionFragment;

  getEvent(nameOrSignatureOrTopic: "RolloverLoanComplete"): EventFragment;

  encodeFunctionData(
    functionFragment: "ADDRESSES_PROVIDER",
    values?: undefined
  ): string;
  encodeFunctionData(
    functionFragment: "LENDER_COMMITMENT_FORWARDER",
    values?: undefined
  ): string;
  encodeFunctionData(functionFragment: "POOL", values?: undefined): string;
  encodeFunctionData(
    functionFragment: "POOL_ADDRESSES_PROVIDER",
    values?: undefined
  ): string;
  encodeFunctionData(functionFragment: "TELLER_V2", values?: undefined): string;
  encodeFunctionData(
    functionFragment: "calculateRolloverAmount",
    values: [
      BigNumberish,
      ICommitmentRolloverLoan.AcceptCommitmentArgsStruct,
      BigNumberish,
      BigNumberish
    ]
  ): string;
  encodeFunctionData(
    functionFragment: "executeOperation",
    values: [AddressLike, BigNumberish, BigNumberish, AddressLike, BytesLike]
  ): string;
  encodeFunctionData(
    functionFragment: "rolloverLoanWithFlash",
    values: [
      BigNumberish,
      BigNumberish,
      BigNumberish,
      ICommitmentRolloverLoan.AcceptCommitmentArgsStruct
    ]
  ): string;

  decodeFunctionResult(
    functionFragment: "ADDRESSES_PROVIDER",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "LENDER_COMMITMENT_FORWARDER",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "POOL", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "POOL_ADDRESSES_PROVIDER",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "TELLER_V2", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "calculateRolloverAmount",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "executeOperation",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "rolloverLoanWithFlash",
    data: BytesLike
  ): Result;
}

export namespace RolloverLoanCompleteEvent {
  export type InputTuple = [
    borrower: AddressLike,
    originalLoanId: BigNumberish,
    newLoanId: BigNumberish,
    fundsRemaining: BigNumberish
  ];
  export type OutputTuple = [
    borrower: string,
    originalLoanId: bigint,
    newLoanId: bigint,
    fundsRemaining: bigint
  ];
  export interface OutputObject {
    borrower: string;
    originalLoanId: bigint;
    newLoanId: bigint;
    fundsRemaining: 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 FlashRolloverLoan extends BaseContract {
  connect(runner?: ContractRunner | null): FlashRolloverLoan;
  waitForDeployment(): Promise<this>;

  interface: FlashRolloverLoanInterface;

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

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

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

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

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

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

  calculateRolloverAmount: TypedContractMethod<
    [
      _loanId: BigNumberish,
      _commitmentArgs: ICommitmentRolloverLoan.AcceptCommitmentArgsStruct,
      _flashloanPremiumPct: BigNumberish,
      _timestamp: BigNumberish
    ],
    [[bigint, bigint] & { _flashAmount: bigint; _borrowerAmount: bigint }],
    "view"
  >;

  executeOperation: TypedContractMethod<
    [
      _flashToken: AddressLike,
      _flashAmount: BigNumberish,
      _flashFees: BigNumberish,
      initiator: AddressLike,
      _data: BytesLike
    ],
    [boolean],
    "nonpayable"
  >;

  rolloverLoanWithFlash: TypedContractMethod<
    [
      _loanId: BigNumberish,
      _flashLoanAmount: BigNumberish,
      _borrowerAmount: BigNumberish,
      _acceptCommitmentArgs: ICommitmentRolloverLoan.AcceptCommitmentArgsStruct
    ],
    [bigint],
    "nonpayable"
  >;

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

  getFunction(
    nameOrSignature: "ADDRESSES_PROVIDER"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "LENDER_COMMITMENT_FORWARDER"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "POOL"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "POOL_ADDRESSES_PROVIDER"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "TELLER_V2"
  ): TypedContractMethod<[], [string], "view">;
  getFunction(
    nameOrSignature: "calculateRolloverAmount"
  ): TypedContractMethod<
    [
      _loanId: BigNumberish,
      _commitmentArgs: ICommitmentRolloverLoan.AcceptCommitmentArgsStruct,
      _flashloanPremiumPct: BigNumberish,
      _timestamp: BigNumberish
    ],
    [[bigint, bigint] & { _flashAmount: bigint; _borrowerAmount: bigint }],
    "view"
  >;
  getFunction(
    nameOrSignature: "executeOperation"
  ): TypedContractMethod<
    [
      _flashToken: AddressLike,
      _flashAmount: BigNumberish,
      _flashFees: BigNumberish,
      initiator: AddressLike,
      _data: BytesLike
    ],
    [boolean],
    "nonpayable"
  >;
  getFunction(
    nameOrSignature: "rolloverLoanWithFlash"
  ): TypedContractMethod<
    [
      _loanId: BigNumberish,
      _flashLoanAmount: BigNumberish,
      _borrowerAmount: BigNumberish,
      _acceptCommitmentArgs: ICommitmentRolloverLoan.AcceptCommitmentArgsStruct
    ],
    [bigint],
    "nonpayable"
  >;

  getEvent(
    key: "RolloverLoanComplete"
  ): TypedContractEvent<
    RolloverLoanCompleteEvent.InputTuple,
    RolloverLoanCompleteEvent.OutputTuple,
    RolloverLoanCompleteEvent.OutputObject
  >;

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