Git Source
Inherits: ILoanManager , IERC721Receiver, LoanManagerStorage , ReentrancyGuard, VersionedInitializable
State Variables
LOAN_MANAGER_REVISION
Copy uint256 public constant LOAN_MANAGER_REVISION = 0x1 ;
HUNDRED_PERCENT
Copy uint256 public constant HUNDRED_PERCENT = 1e6 ;
SCALED_ONE
Copy uint256 private constant SCALED_ONE = 1e18 ;
PRECISION
Copy uint256 public constant PRECISION = 1e27 ;
ADDRESSES_PROVIDER
Copy IPoolAddressesProvider public immutable ADDRESSES_PROVIDER;
Functions
constructor
Copy constructor ( IPoolAddressesProvider provider_);
initialize
Copy function initialize ( address asset_) external override initializer ;
whenNotPaused
Can only be called when the function is not paused
Copy modifier whenNotPaused ();
onlyPoolAdminOrGovernor
Can only be called by the Pool Admin or the Governor
Copy modifier onlyPoolAdminOrGovernor ();
onlyPoolAdmin
Can only be called by the Pool Admin
Copy modifier onlyPoolAdmin ();
onlyPoolConfigurator
Can only be called by the PoolConfigurator
Copy modifier onlyPoolConfigurator ();
getRevision
Returns the revision number of the contract
Needs to be defined in the inherited class as a constant.
Copy function getRevision () public pure virtual override returns ( uint256 revision_);
Returns
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
.
Copy function onERC721Received ( address , address , uint256 , bytes calldata ) external pure override returns ( bytes4 );
getLoanInfo
Gets the loan info.
Copy function getLoanInfo ( uint16 loanId_) external view returns ( Loan . Info memory loan_);
Parameters
Returns
accruedInterest
Gets the amount of interest up until this point in time.
Copy function accruedInterest () public view override returns ( uint256 accruedInterest_);
Returns
assetsUnderManagement
Gets the total assets under management.
Copy function assetsUnderManagement () public view override returns ( uint256 assetsUnderManagement_);
Returns
getLoanPaymentDetailedBreakdown
Gets the detailed payment breakdown of a loan up until this point in time.
Copy function getLoanPaymentDetailedBreakdown (
uint16 loanId_
)
public
view
override
returns ( uint256 principal_ , uint256 [2] memory interest_);
Parameters
Returns
getLoanPaymentBreakdown
Gets the payment breakdown of a loan up until this point in time.
Copy function getLoanPaymentBreakdown ( uint16 loanId_) public view override returns ( uint256 principal_ , uint256 interest_);
Parameters
Returns
updateAccounting
Manually updates the accounting state of the pool.
Copy function updateAccounting () external whenNotPaused onlyPoolAdminOrGovernor ;
requestLoan
Used by buyer to request a loan from the pool with the following terms.
Copy function requestLoan (
address receivableAsset_ ,
uint256 receivablesTokenId_ ,
uint256 gracePeriod_ ,
uint256 principalRequested_ ,
uint256 [2] memory rates_
)
external
override
whenNotPaused
returns ( uint16 loanId_);
Parameters
Returns
fundLoan
Used by the pool admin to fund the loan requested by the buyer.
Copy function fundLoan ( uint16 loanId_) external override nonReentrant whenNotPaused onlyPoolAdmin ;
Parameters
repayLoan
Repays the loan (note that the loan can be repaid early but not partially).
Copy function repayLoan ( uint16 loanId_) external override whenNotPaused returns ( uint256 principal_ , uint256 interest_);
Parameters
Returns
withdrawFunds
Used by sellers to withdraw funds from a loan.
Copy function withdrawFunds ( uint16 loanId_ , address destination_) external override whenNotPaused ;
Parameters
impairLoan
Impairs the loan.
Copy function impairLoan ( uint16 loanId_) external override whenNotPaused onlyPoolAdminOrGovernor ;
Parameters
removeLoanImpairment
Removes the impairment on the loan.
Copy function removeLoanImpairment ( uint16 loanId_) external override nonReentrant whenNotPaused onlyPoolAdminOrGovernor ;
Parameters
triggerDefault
Triggers the default of a loan.
Copy function triggerDefault (
uint16 loanId_
)
external
override
whenNotPaused
onlyPoolConfigurator
returns ( uint256 remainingLosses_ , uint256 protocolFees_);
Parameters
Returns
_getIssuance
Copy function _getIssuance ( uint256 issuanceRate_ , uint256 interval_) internal pure returns ( uint256 issuance_);
_getInterestBreakdown
Copy function _getInterestBreakdown (
uint256 currentTime_ ,
uint256 startDate_ ,
uint256 dueDate_ ,
uint256 principal_ ,
uint256 interestRate_ ,
uint256 lateInterestPremiumRate_
)
internal
pure
returns ( uint256 [2] memory interest_);
_getInterest
Copy function _getInterest (
uint256 principal_ ,
uint256 interestRate_ ,
uint256 interval_
)
internal
pure
returns ( uint256 interest_);
_getLateInterest
Copy function _getLateInterest (
uint256 currentTime_ ,
uint256 principal_ ,
uint256 interestRate_ ,
uint256 dueDate_ ,
uint256 lateInterestPremiumRate_
)
internal
pure
returns ( uint256 lateInterest_);
_getPeriodicInterestRate
Copy function _getPeriodicInterestRate (
uint256 interestRate_ ,
uint256 interval_
)
internal
pure
returns ( uint256 periodicInterestRate_);
_poolConfigurator
Copy function _poolConfigurator () internal view returns ( address poolConfigurator_);
_globals
Copy function _globals () internal view returns ( address globals_);
_governor
Copy function _governor () internal view returns ( address governor_);
_poolAdmin
Copy function _poolAdmin () internal view returns ( address poolAdmin_);
_pool
Copy function _pool () internal view returns ( address pool_);
_vault
Copy function _vault () internal view returns ( address vault_);
_advanceGlobalPaymentAccounting
Copy function _advanceGlobalPaymentAccounting () internal ;
_updateIssuanceParams
Copy function _updateIssuanceParams ( uint256 issuanceRate_ , uint112 accountedInterest_) internal ;
_compareAndSubtractAccountedInterest
Copy function _compareAndSubtractAccountedInterest ( uint256 amount_) internal ;
_getAccruedAmount
Copy function _getAccruedAmount (
uint256 totalAccruingAmount_ ,
uint256 startTime_ ,
uint256 endTime_ ,
uint256 currentTime_
)
internal
pure
returns ( uint256 accruedAmount_);
_getDefaultInterestAndFees
Copy function _getDefaultInterestAndFees (
uint16 loanId_ ,
Loan . PaymentInfo memory paymentInfo_
)
internal
view
returns ( uint256 netInterest_ , uint256 netLateInterest_ , uint256 protocolFees_);
_getInterestAndFeesFromLiquidationInfo
Copy function _getInterestAndFeesFromLiquidationInfo (
uint16 loanId_
)
internal
view
returns ( uint256 netInterest_ , uint256 netLateInterest_ , uint256 protocolFees_);
_getNetInterest
Copy function _getNetInterest ( uint256 interest_ , uint256 feeRate_) internal pure returns ( uint256 netInterest_);
_getPaymentAccruedInterest
Copy function _getPaymentAccruedInterest (
uint256 startTime_ ,
uint256 endTime_ ,
uint256 paymentIssuanceRate_
)
internal
pure
returns ( uint256 accruedInterest_);
_accountToEndOfPayment
Copy function _accountToEndOfPayment (
uint256 paymentId_ ,
uint256 issuanceRate_ ,
uint256 intervalStart_ ,
uint256 intervalEnd_
)
internal
returns ( uint256 accountedInterestIncrease_ , uint256 issuanceRateReduction_);
_deletePayment
Copy function _deletePayment ( uint16 loanId_) internal ;
_handlePaymentAccounting
Copy function _handlePaymentAccounting ( uint16 loanId_) internal returns ( uint256 issuanceRate_);
_queuePayment
Copy function _queuePayment ( uint16 loanId_ , uint256 startDate_ , uint256 dueDate_) internal returns ( uint256 newRate_);
_reverseLoanImpairment
Copy function _reverseLoanImpairment(Loan.LiquidationInfo memory liquidationInfo_) internal;
_addPaymentToList
Copy function _addPaymentToList(uint48 paymentDueDate_) internal returns (uint24 paymentId_);
_removePaymentFromList
Copy function _removePaymentFromList(uint256 paymentId_) internal;
_distributeClaimedFunds
Copy function _distributeClaimedFunds(uint16 loanId_, uint256 principal_, uint256 interest_) internal;
_handleDefault
Copy function _handleDefault(
uint16 loanId_,
uint256 netInterest_,
uint256 netLateInterest_
)
internal
returns (uint256 remainingLosses_);
_revertIfPaused
Copy function _revertIfPaused() internal view;
_revertIfNotPoolAdminOrGovernor
Copy function _revertIfNotPoolAdminOrGovernor() internal view;
_revertIfNotPoolAdmin
Copy function _revertIfNotPoolAdmin() internal view;
_revertIfNotPoolConfigurator
Copy function _revertIfNotPoolConfigurator() internal view;
_revertIfCallerNotReceivableBuyer
Copy function _revertIfCallerNotReceivableBuyer(address buyer_) internal view;
_revertIfInvalidReceivable
Copy function _revertIfInvalidReceivable(
uint256 receivablesTokenId_,
address buyer_,
address seller_,
uint256 repaymentTimestamp_
)
internal
view;
_min
Copy function _min(uint256 a_, uint256 b_) internal pure returns (uint256 minimum_);