import { Address, Hash, Hex, PublicClient } from 'viem'; import { LoanV5, OfferV5, RenegotiationV5, SignableRepaymentDataV5 } from '../../blockchain'; import { Wallet } from '../../clients/contracts'; import { multiSourceLoanABI as multiSourceLoanABIV5 } from '../../generated/blockchain/v5'; import { EmitLoanArgs } from '../../gondi'; import { LoanDelegation } from '../../utils/delegation'; import { BaseContract } from './BaseContract'; import { MslV6 } from './MslV6'; type RepayArgs = { loan: LoanV5; signableRepaymentData: SignableRepaymentDataV5; }; export declare class MslV5 extends BaseContract { version: "2"; constructor({ walletClient, address, publicClient, }: { walletClient: Wallet; address: Address; publicClient?: PublicClient; }); private getDomain; signOffer({ structToSign }: { structToSign: OfferV5; }): Promise<`0x${string}`>; signRenegotiationOffer({ structToSign }: { structToSign: RenegotiationV5; }): Promise<`0x${string}`>; cancelOffer({ id }: { id: bigint; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; lender: `0x${string}`; offerId: bigint; }>; }>; cancelOffers({ ids }: { ids: bigint[]; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; events: { lender: `0x${string}`; offerId: bigint; }[]; }>; }>; cancelAllOffers({ minId }: { minId: bigint; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; lender: `0x${string}`; minOfferId: bigint; }>; }>; cancelRefinanceOffer({ id }: { id: bigint; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; lender: `0x${string}`; renegotiationId: bigint; }>; }>; cancelAllRenegotiations({ minId }: { minId: bigint; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; lender: `0x${string}`; minRenegotiationId: bigint; }>; }>; private mapEmitLoanToMslEmitLoanArgs; emitLoan(emitArgs: EmitLoanArgs): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; loan: { contractAddress: `0x${string}`; borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint; duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; id: string; }; loanId: bigint; offerId: string; }>; }>; /** This version's `revokeDelegate` takes no rights, so each delegate is revoked once. */ revokeDelegationsAndEmitLoan({ delegations, emit, }: { delegations: readonly LoanDelegation[]; emit: EmitLoanArgs; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ results: ({ loanId: bigint; offerId: bigint; loan: { borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint; duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; }; lender: `0x${string}`; borrower: `0x${string}`; fee: bigint; } | { delegate: `0x${string}`; collection: `0x${string}`; tokenId: bigint; })[]; blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; loan: { contractAddress: `0x${string}`; borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint; duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; id: string; }; loanId: bigint; }>; }>; repayLoan({ loan, loanId }: { loan: LoanV5; loanId: bigint; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; loanId: bigint; totalRepayment: bigint; fee: bigint; }>; }>; getRemainingLockupSeconds({ loan }: { loan: LoanV5; }): Promise; isEndLockedUp(): boolean; refinanceBatch({ renegotiationId, refinancings, }: { renegotiationId: bigint; refinancings: { loan: LoanV5; newAprBps: bigint; sources: { source: LoanV5['source'][number]; refinancingPrincipal: bigint; }[]; }[]; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; results: { renegotiationId: bigint; oldLoanId: bigint; newLoanId: bigint; loan: { borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint; duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; }; fee: bigint; }[]; }>; }>; refinanceFullLoan({ offer, signature, loan, }: { offer: RenegotiationV5; signature: Hash; loan: LoanV5; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; loan: { contractAddress: `0x${string}`; borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint; duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; id: string; }; loanId: bigint; renegotiationId: string; }>; }>; refinancePartialLoan({ offer, loan }: { offer: RenegotiationV5; loan: LoanV5; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; loan: { contractAddress: `0x${string}`; borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint; duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; id: string; }; loanId: bigint; renegotiationId: string; }>; }>; private executeRenegotiation; addTranche(): ReturnType; refinanceFromOffers(): ReturnType; delegateMulticall(delegations: Parameters[0][]): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ results: { loanId: bigint; delegate: `0x${string}`; value: boolean; }[]; blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; }>; }>; delegate({ loan, loanId, to, rights, enable, }: { loan: LoanV5; loanId: bigint; to: Address; rights?: Hash; enable: boolean; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; loan: { loanId: bigint; contractAddress: `0x${string}`; borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint | (bigint & Date); duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; }; value: boolean; }>; }>; revokeDelegate({ to, collection, tokenId, }: { to: Address; collection: Address; tokenId: bigint; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; delegate: `0x${string}`; collection: `0x${string}`; tokenId: bigint; }>; }>; liquidateLoan({ loan, loanId }: { loan: LoanV5; loanId: bigint; }): Promise<{ txHash: `0x${string}`; waitTxInBlock: () => Promise<{ blobGasPrice?: bigint | undefined; blobGasUsed?: bigint | undefined; blockHash: Hash; blockNumber: bigint; blockTimestamp?: bigint | undefined; contractAddress: Address | null | undefined; cumulativeGasUsed: bigint; effectiveGasPrice: bigint; from: Address; gasUsed: bigint; logs: import("viem").Log[]; logsBloom: Hex; root?: Hash | undefined; status: "success" | "reverted"; to: Address | null; transactionHash: Hash; transactionIndex: number; type: import("viem").TransactionType; loanId: bigint; }>; }>; decodeRepaymentCalldata(calldata: Hex): { data: { loanId: bigint; callbackData: `0x${string}`; shouldDelegate: boolean; }; loan: { borrower: `0x${string}`; nftCollateralTokenId: bigint; nftCollateralAddress: `0x${string}`; principalAddress: `0x${string}`; principalAmount: bigint; startTime: bigint; duration: bigint; source: readonly { loanId: bigint; lender: `0x${string}`; principalAmount: bigint; accruedInterest: bigint; startTime: bigint; aprBps: bigint; }[]; }; borrowerSignature: `0x${string}`; }; getProtocolFee(): ReturnType; signRepaymentData({ structToSign }: { structToSign: SignableRepaymentDataV5; }): Promise<`0x${string}`>; encodeRepayLoan({ repayArgs, withSignature, }: { repayArgs: RepayArgs; withSignature: boolean; }): Promise<`0x${string}`>; } export {};