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

export type PaymentStruct = { principal: BigNumberish; interest: BigNumberish };

export type PaymentStructOutput = [principal: bigint, interest: bigint] & {
  principal: bigint;
  interest: bigint;
};

export type CollateralStruct = {
  _collateralType: BigNumberish;
  _amount: BigNumberish;
  _tokenId: BigNumberish;
  _collateralAddress: AddressLike;
};

export type CollateralStructOutput = [
  _collateralType: bigint,
  _amount: bigint,
  _tokenId: bigint,
  _collateralAddress: string
] & {
  _collateralType: bigint;
  _amount: bigint;
  _tokenId: bigint;
  _collateralAddress: string;
};

export interface ITellerV2Interface extends Interface {
  getFunction(
    nameOrSignature:
      | "calculateAmountDue"
      | "calculateAmountOwed"
      | "getBidState"
      | "getBorrowerActiveLoanIds"
      | "getLoanBorrower"
      | "getLoanLender"
      | "getLoanLendingToken"
      | "getLoanMarketId"
      | "getLoanSummary"
      | "isLoanDefaulted"
      | "isLoanLiquidateable"
      | "isPaymentLate"
      | "lenderAcceptBid"
      | "repayLoan"
      | "repayLoanFull"
      | "repayLoanMinimum"
      | "submitBid(address,uint256,uint256,uint32,uint16,string,address)"
      | "submitBid(address,uint256,uint256,uint32,uint16,string,address,(uint8,uint256,uint256,address)[])"
  ): FunctionFragment;

  encodeFunctionData(
    functionFragment: "calculateAmountDue",
    values: [BigNumberish, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "calculateAmountOwed",
    values: [BigNumberish, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getBidState",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getBorrowerActiveLoanIds",
    values: [AddressLike]
  ): string;
  encodeFunctionData(
    functionFragment: "getLoanBorrower",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getLoanLender",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getLoanLendingToken",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getLoanMarketId",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "getLoanSummary",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "isLoanDefaulted",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "isLoanLiquidateable",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "isPaymentLate",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "lenderAcceptBid",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "repayLoan",
    values: [BigNumberish, BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "repayLoanFull",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "repayLoanMinimum",
    values: [BigNumberish]
  ): string;
  encodeFunctionData(
    functionFragment: "submitBid(address,uint256,uint256,uint32,uint16,string,address)",
    values: [
      AddressLike,
      BigNumberish,
      BigNumberish,
      BigNumberish,
      BigNumberish,
      string,
      AddressLike
    ]
  ): string;
  encodeFunctionData(
    functionFragment: "submitBid(address,uint256,uint256,uint32,uint16,string,address,(uint8,uint256,uint256,address)[])",
    values: [
      AddressLike,
      BigNumberish,
      BigNumberish,
      BigNumberish,
      BigNumberish,
      string,
      AddressLike,
      CollateralStruct[]
    ]
  ): string;

  decodeFunctionResult(
    functionFragment: "calculateAmountDue",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "calculateAmountOwed",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getBidState",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getBorrowerActiveLoanIds",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getLoanBorrower",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getLoanLender",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getLoanLendingToken",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getLoanMarketId",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "getLoanSummary",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "isLoanDefaulted",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "isLoanLiquidateable",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "isPaymentLate",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "lenderAcceptBid",
    data: BytesLike
  ): Result;
  decodeFunctionResult(functionFragment: "repayLoan", data: BytesLike): Result;
  decodeFunctionResult(
    functionFragment: "repayLoanFull",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "repayLoanMinimum",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "submitBid(address,uint256,uint256,uint32,uint16,string,address)",
    data: BytesLike
  ): Result;
  decodeFunctionResult(
    functionFragment: "submitBid(address,uint256,uint256,uint32,uint16,string,address,(uint8,uint256,uint256,address)[])",
    data: BytesLike
  ): Result;
}

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

  interface: ITellerV2Interface;

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

  calculateAmountDue: TypedContractMethod<
    [_bidId: BigNumberish, _timestamp: BigNumberish],
    [PaymentStructOutput],
    "view"
  >;

  calculateAmountOwed: TypedContractMethod<
    [_bidId: BigNumberish, _timestamp: BigNumberish],
    [PaymentStructOutput],
    "view"
  >;

  getBidState: TypedContractMethod<[_bidId: BigNumberish], [bigint], "view">;

  getBorrowerActiveLoanIds: TypedContractMethod<
    [_borrower: AddressLike],
    [bigint[]],
    "view"
  >;

  getLoanBorrower: TypedContractMethod<
    [_bidId: BigNumberish],
    [string],
    "view"
  >;

  getLoanLender: TypedContractMethod<[_bidId: BigNumberish], [string], "view">;

  getLoanLendingToken: TypedContractMethod<
    [_bidId: BigNumberish],
    [string],
    "view"
  >;

  getLoanMarketId: TypedContractMethod<
    [_bidId: BigNumberish],
    [bigint],
    "view"
  >;

  getLoanSummary: TypedContractMethod<
    [_bidId: BigNumberish],
    [
      [string, string, bigint, string, bigint, bigint, bigint, bigint] & {
        borrower: string;
        lender: string;
        marketId: bigint;
        principalTokenAddress: string;
        principalAmount: bigint;
        acceptedTimestamp: bigint;
        lastRepaidTimestamp: bigint;
        bidState: bigint;
      }
    ],
    "view"
  >;

  isLoanDefaulted: TypedContractMethod<
    [_bidId: BigNumberish],
    [boolean],
    "view"
  >;

  isLoanLiquidateable: TypedContractMethod<
    [_bidId: BigNumberish],
    [boolean],
    "view"
  >;

  isPaymentLate: TypedContractMethod<[_bidId: BigNumberish], [boolean], "view">;

  lenderAcceptBid: TypedContractMethod<
    [_bidId: BigNumberish],
    [
      [bigint, bigint, bigint] & {
        amountToProtocol: bigint;
        amountToMarketplace: bigint;
        amountToBorrower: bigint;
      }
    ],
    "nonpayable"
  >;

  repayLoan: TypedContractMethod<
    [_bidId: BigNumberish, _amount: BigNumberish],
    [void],
    "nonpayable"
  >;

  repayLoanFull: TypedContractMethod<
    [_bidId: BigNumberish],
    [void],
    "nonpayable"
  >;

  repayLoanMinimum: TypedContractMethod<
    [_bidId: BigNumberish],
    [void],
    "nonpayable"
  >;

  "submitBid(address,uint256,uint256,uint32,uint16,string,address)": TypedContractMethod<
    [
      _lendingToken: AddressLike,
      _marketplaceId: BigNumberish,
      _principal: BigNumberish,
      _duration: BigNumberish,
      _APR: BigNumberish,
      _metadataURI: string,
      _receiver: AddressLike
    ],
    [bigint],
    "nonpayable"
  >;

  "submitBid(address,uint256,uint256,uint32,uint16,string,address,(uint8,uint256,uint256,address)[])": TypedContractMethod<
    [
      _lendingToken: AddressLike,
      _marketplaceId: BigNumberish,
      _principal: BigNumberish,
      _duration: BigNumberish,
      _APR: BigNumberish,
      _metadataURI: string,
      _receiver: AddressLike,
      _collateralInfo: CollateralStruct[]
    ],
    [bigint],
    "nonpayable"
  >;

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

  getFunction(
    nameOrSignature: "calculateAmountDue"
  ): TypedContractMethod<
    [_bidId: BigNumberish, _timestamp: BigNumberish],
    [PaymentStructOutput],
    "view"
  >;
  getFunction(
    nameOrSignature: "calculateAmountOwed"
  ): TypedContractMethod<
    [_bidId: BigNumberish, _timestamp: BigNumberish],
    [PaymentStructOutput],
    "view"
  >;
  getFunction(
    nameOrSignature: "getBidState"
  ): TypedContractMethod<[_bidId: BigNumberish], [bigint], "view">;
  getFunction(
    nameOrSignature: "getBorrowerActiveLoanIds"
  ): TypedContractMethod<[_borrower: AddressLike], [bigint[]], "view">;
  getFunction(
    nameOrSignature: "getLoanBorrower"
  ): TypedContractMethod<[_bidId: BigNumberish], [string], "view">;
  getFunction(
    nameOrSignature: "getLoanLender"
  ): TypedContractMethod<[_bidId: BigNumberish], [string], "view">;
  getFunction(
    nameOrSignature: "getLoanLendingToken"
  ): TypedContractMethod<[_bidId: BigNumberish], [string], "view">;
  getFunction(
    nameOrSignature: "getLoanMarketId"
  ): TypedContractMethod<[_bidId: BigNumberish], [bigint], "view">;
  getFunction(
    nameOrSignature: "getLoanSummary"
  ): TypedContractMethod<
    [_bidId: BigNumberish],
    [
      [string, string, bigint, string, bigint, bigint, bigint, bigint] & {
        borrower: string;
        lender: string;
        marketId: bigint;
        principalTokenAddress: string;
        principalAmount: bigint;
        acceptedTimestamp: bigint;
        lastRepaidTimestamp: bigint;
        bidState: bigint;
      }
    ],
    "view"
  >;
  getFunction(
    nameOrSignature: "isLoanDefaulted"
  ): TypedContractMethod<[_bidId: BigNumberish], [boolean], "view">;
  getFunction(
    nameOrSignature: "isLoanLiquidateable"
  ): TypedContractMethod<[_bidId: BigNumberish], [boolean], "view">;
  getFunction(
    nameOrSignature: "isPaymentLate"
  ): TypedContractMethod<[_bidId: BigNumberish], [boolean], "view">;
  getFunction(
    nameOrSignature: "lenderAcceptBid"
  ): TypedContractMethod<
    [_bidId: BigNumberish],
    [
      [bigint, bigint, bigint] & {
        amountToProtocol: bigint;
        amountToMarketplace: bigint;
        amountToBorrower: bigint;
      }
    ],
    "nonpayable"
  >;
  getFunction(
    nameOrSignature: "repayLoan"
  ): TypedContractMethod<
    [_bidId: BigNumberish, _amount: BigNumberish],
    [void],
    "nonpayable"
  >;
  getFunction(
    nameOrSignature: "repayLoanFull"
  ): TypedContractMethod<[_bidId: BigNumberish], [void], "nonpayable">;
  getFunction(
    nameOrSignature: "repayLoanMinimum"
  ): TypedContractMethod<[_bidId: BigNumberish], [void], "nonpayable">;
  getFunction(
    nameOrSignature: "submitBid(address,uint256,uint256,uint32,uint16,string,address)"
  ): TypedContractMethod<
    [
      _lendingToken: AddressLike,
      _marketplaceId: BigNumberish,
      _principal: BigNumberish,
      _duration: BigNumberish,
      _APR: BigNumberish,
      _metadataURI: string,
      _receiver: AddressLike
    ],
    [bigint],
    "nonpayable"
  >;
  getFunction(
    nameOrSignature: "submitBid(address,uint256,uint256,uint32,uint16,string,address,(uint8,uint256,uint256,address)[])"
  ): TypedContractMethod<
    [
      _lendingToken: AddressLike,
      _marketplaceId: BigNumberish,
      _principal: BigNumberish,
      _duration: BigNumberish,
      _APR: BigNumberish,
      _metadataURI: string,
      _receiver: AddressLike,
      _collateralInfo: CollateralStruct[]
    ],
    [bigint],
    "nonpayable"
  >;

  filters: {};
}
