LoanManager

Git Source

Inherits: ILoanManager, IERC721Receiver, LoanManagerStorage, VersionedInitializable, ReentrancyGuardUpgradeable

State Variables

LOAN_MANAGER_REVISION

uint256 public constant LOAN_MANAGER_REVISION = 0x1;

HUNDRED_PERCENT

uint256 public constant HUNDRED_PERCENT = 1e6;

SCALED_ONE

uint256 private constant SCALED_ONE = 1e18;

PRECISION

uint256 public constant PRECISION = 1e27;

ADDRESSES_PROVIDER

IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;

Functions

constructor

initialize

whenNotPaused

Can only be called when the function is not paused

onlyPoolAdminOrGovernor

Can only be called by the Pool Admin or the Governor

onlyPoolAdmin

Can only be called by the Pool Admin

onlyPoolConfigurator

Can only be called by the PoolConfigurator

getRevision

Returns the revision number of the contract

Needs to be defined in the inherited class as a constant.

Returns

Name
Type
Description

revision_

uint256

The revision number

onERC721Received

Whenever an {IERC721} tokenId token is transferred to this contract via {IERC721-safeTransferFrom} by operator from from, this function is called. It must return its Solidity selector to confirm the token transfer. If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. The selector can be obtained in Solidity with IERC721Receiver.onERC721Received.selector.

getLoanInfo

Gets the loan info.

Parameters

Name
Type
Description

loanId_

uint16

The id of the loan.

Returns

Name
Type
Description

loan_

Loan.Info

Struct that contains the info of the loan.

accruedInterest

Gets the amount of interest up until this point in time.

Returns

Name
Type
Description

accruedInterest_

uint256

The amount of accrued interest up until this point in time.

assetsUnderManagement

Gets the total assets under management.

Returns

Name
Type
Description

assetsUnderManagement_

uint256

The total value of assets under management.

getLoanPaymentDetailedBreakdown

Gets the detailed payment breakdown of a loan up until this point in time.

Parameters

Name
Type
Description

loanId_

uint16

The id of the loan.

Returns

Name
Type
Description

principal_

uint256

The principal due for the loan.

interest_

uint256[2]

Interest Parameter: [0]: The interest due for the loan. [1]: The late interest due for the loan.

getLoanPaymentBreakdown

Gets the payment breakdown of a loan up until this point in time.

Parameters

Name
Type
Description

loanId_

uint16

The id of the loan.

Returns

Name
Type
Description

principal_

uint256

The principal due for the loan.

interest_

uint256

The total interest due for the loan.

updateAccounting

Manually updates the accounting state of the pool.

requestLoan

Used by buyer to request a loan from the pool with the following terms.

Parameters

Name
Type
Description

receivableAsset_

address

receivablesTokenId_

uint256

Token ID of the receivable that would be used as collateral.

gracePeriod_

uint256

Grace period of the loan.

principalRequested_

uint256

Amount of principal requested by the buyer.

rates_

uint256[2]

Rates parameters: [0]: interestRate. [1]: lateInterestPremiumRate.

Returns

Name
Type
Description

loanId_

uint16

Id of the loan that is created.

fundLoan

Used by the pool admin to fund the loan requested by the buyer.

Parameters

Name
Type
Description

loanId_

uint16

The id of the loan.

repayLoan

Repays the loan (note that the loan can be repaid early but not partially).

Parameters

Name
Type
Description

loanId_

uint16

Id of the loan to repay.

Returns

Name
Type
Description

principal_

uint256

Principal amount repaid.

interest_

uint256

Interest amount repaid.

withdrawFunds

Used by sellers to withdraw funds from a loan.

Parameters

Name
Type
Description

loanId_

uint16

Id of the loan to withdraw funds from.

destination_

address

The destination address for the funds.

impairLoan

Impairs the loan.

Parameters

Name
Type
Description

loanId_

uint16

The id of the loan.

removeLoanImpairment

Removes the impairment on the loan.

Parameters

Name
Type
Description

loanId_

uint16

The id of the loan.

triggerDefault

Triggers the default of a loan.

Parameters

Name
Type
Description

loanId_

uint16

The id of the loan that is triggered.

Returns

Name
Type
Description

remainingLosses_

uint256

The amount of remaining losses.

protocolFees_

uint256

The amount of protocol fees.

_getIssuance

_getInterestBreakdown

_getInterest

_getLateInterest

_getPeriodicInterestRate

_poolConfigurator

_globals

_governor

_poolAdmin

_pool

_vault

_advanceGlobalPaymentAccounting

_updateIssuanceParams

_compareAndSubtractAccountedInterest

_getAccruedAmount

_getDefaultInterestAndFees

_getInterestAndFeesFromLiquidationInfo

_getNetInterest

_getPaymentAccruedInterest

_accountToEndOfPayment

_deletePayment

_handlePaymentAccounting

_queuePayment

_reverseLoanImpairment

_addPaymentToList

_removePaymentFromList

_distributeClaimedFunds

_handleDefault

_revertIfPaused

_revertIfNotPoolAdminOrGovernor

_revertIfNotPoolAdmin

_revertIfNotPoolConfigurator

_revertIfCallerNotReceivableBuyer

_revertIfInvalidReceivable

_min

Last updated