FixedTermLoan
MapleLoan implements a primitive loan with additional functionality, and is intended to be proxied.
\
Functions
HUNDRED_PERCENT
HUNDRED_PERCENT
The value that represents 100%, to be easily comparable with the loan rates.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
\
acceptBorrower
acceptBorrower
Accept the borrower role, must be called by pendingBorrower.
\
acceptLender
acceptLender
Accept the lender role, must be called by pendingLender.
\
acceptNewTerms
acceptNewTerms
Accept the proposed terms ans trigger refinance execution
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the refinancer contract. |
1 |
|
|
| The deadline for accepting the new terms. |
2 |
|
|
| The encoded arguments to be passed to refinancer. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The hash of the accepted refinance agreement. |
\
borrower
borrower
The borrower of the loan, responsible for repayments.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
closeLoan
closeLoan
Repay all principal and interest and close a loan. FUNDS SHOULD NOT BE TRANSFERRED TO THIS CONTRACT NON-ATOMICALLY. IF THEY ARE, THE BALANCE MAY BE STOLEN USING `skim`.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| An amount to pull from the caller, if any. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The portion of the amount paying back principal. |
1 |
|
|
| The portion of the amount paying interest. |
2 |
|
|
| The portion of the amount paying service fees. |
\
closingRate
closingRate
The fee rate (applied to principal) to close the loan. This value should be configured so that it is less expensive to close a loan with more than one payment remaining, but more expensive to close it if on the last payment.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
collateral
collateral
The amount of collateral posted against outstanding (drawn down) principal.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
collateralAsset
collateralAsset
The address of the asset deposited by the borrower as collateral, if needed.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
collateralRequired
collateralRequired
The amount of collateral required if all of the principal required is drawn down.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
drawableFunds
drawableFunds
The amount of funds that have yet to be drawn down by the borrower.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
drawdownFunds
drawdownFunds
Draw down funds from the loan.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount to draw down. |
1 |
|
|
| The address to send the funds. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of additional collateral posted, if any. |
\
endingPrincipal
endingPrincipal
The portion of principal to not be paid down as part of payment installments, which would need to be paid back upon final payment. If endingPrincipal = principal, loan is interest-only.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
excessCollateral
excessCollateral
Returns the excess collateral that can be removed.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The excess collateral that can be removed, if any. |
\
factory
factory
The address of the proxy factory.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
feeManager
feeManager
The address of the contract that handles payments of fees on behalf of the loan.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
fundLoan
fundLoan
Lend funds to the loan/borrower.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount funded. |
\
fundsAsset
fundsAsset
The asset deposited by the lender to fund the loan.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
getAdditionalCollateralRequiredFor
getAdditionalCollateralRequiredFor
Get the additional collateral to be posted to drawdown some amount.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount desired to be drawn down. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
getClosingPaymentBreakdown
getClosingPaymentBreakdown
Get the breakdown of the total payment needed to satisfy an early repayment to close the loan.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The portion of the total amount that will go towards principal. |
1 |
|
|
| The portion of the total amount that will go towards interest fees. |
2 |
|
|
| The portion of the total amount that will go towards fees. |
\
getNextPaymentBreakdown
getNextPaymentBreakdown
Get the breakdown of the total payment needed to satisfy the next payment installment.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The portion of the total amount that will go towards principal. |
1 |
|
|
| The portion of the total amount that will go towards interest fees. |
2 |
|
|
| The portion of the total amount that will go towards paying administrative fees. |
\
getNextPaymentDetailedBreakdown
getNextPaymentDetailedBreakdown
Get the detailed breakdown of the total payment needed to satisfy the next payment installment.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The portion of the total amount that will go towards principal. |
1 |
|
|
| The portion of the total amount that will go towards interest fees. [0] Interest from the payment interval. [1] Late interest. [2] Refinance interest. |
2 |
|
|
| The portion of the total amount that will go towards paying administrative fees. [0] Delegate fees. [1] Platform fees. |
\
getRefinanceInterest
getRefinanceInterest
Get the extra interest that will be charged according to loan terms before refinance, based on a given timestamp.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The timestamp when the new terms will be accepted. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The interest portion to be added in the next payment. |
\
getUnaccountedAmount
getUnaccountedAmount
Get the amount on an asset that in not accounted for by the accounting variables (and thus can be skimmed).
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of a asset contract. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount that is not accounted for. |
\
globals
globals
The Maple globals address
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
governor
governor
The address of the Maple Governor.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
gracePeriod
gracePeriod
The amount of time the borrower has, after a payment is due, to make a payment before being in default.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
impairLoan
impairLoan
Fast forward the next payment due date to the current time. This enables the pool delegate to force a payment (or default).
\
implementation
implementation
The address of the implementation contract being proxied.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
interestRate
interestRate
The annualized interest rate (APR), in units of 1e18, (i.e. 1% is 0.01e18).
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
isImpaired
isImpaired
Return if the loan has been impaired.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| Is the loan impaired or not. |
\
lateFeeRate
lateFeeRate
The rate charged at late payments.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
lateInterestPremiumRate
lateInterestPremiumRate
The premium over the regular interest rate applied when paying late.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
lender
lender
The lender of the Loan.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
makePayment
makePayment
Make a payment to the loan. FUNDS SHOULD NOT BE TRANSFERRED TO THIS CONTRACT NON-ATOMICALLY. IF THEY ARE, THE BALANCE MAY BE STOLEN USING `skim`.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| An amount to pull from the caller, if any. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The portion of the amount paying back principal. |
1 |
|
|
| The portion of the amount paying interest fees. |
2 |
|
|
| The portion of the amount paying service fees. |
\
migrate
migrate
Modifies the proxy's storage by delegate-calling a migrator contract with some arguments. Access control logic critical since caller can force a selfdestruct via a malicious `migrator_` which is delegatecalled.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of a migrator contract. |
1 |
|
|
| Some encoded arguments to use for the migration. |
\
nextPaymentDueDate
nextPaymentDueDate
The timestamp due date of the next payment.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
originalNextPaymentDueDate
originalNextPaymentDueDate
The saved original payment due date from a loan impairment.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
paymentInterval
paymentInterval
The specified time between loan payments.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
paymentsRemaining
paymentsRemaining
The number of payment installments remaining for the loan.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
pendingBorrower
pendingBorrower
The address of the pending borrower.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
pendingLender
pendingLender
The address of the pending lender.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
postCollateral
postCollateral
Post collateral to the loan. FUNDS SHOULD NOT BE TRANSFERRED TO THIS CONTRACT NON-ATOMICALLY. IF THEY ARE, THE BALANCE MAY BE STOLEN USING `skim`.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| An amount to pull from the caller, if any. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount posted. |
\
principal
principal
The amount of principal owed (initially, the requested amount), which needs to be paid back.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
principalRequested
principalRequested
The initial principal amount requested by the borrower.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
proposeNewTerms
proposeNewTerms
Propose new terms for refinance.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the refinancer contract. |
1 |
|
|
| The deadline for accepting the new terms. |
2 |
|
|
| The encoded arguments to be passed to refinancer. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The hash of the proposed refinance agreement. |
\
refinanceCommitment
refinanceCommitment
The hash of the proposed refinance agreement.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
refinanceInterest
refinanceInterest
Amount of unpaid interest that has accrued before a refinance was accepted.
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
|
\
rejectNewTerms
rejectNewTerms
Nullify the current proposed terms.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the refinancer contract. |
1 |
|
|
| The deadline for accepting the new terms. |
2 |
|
|
| The encoded arguments to be passed to refinancer. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The hash of the rejected refinance agreement. |
\
removeCollateral
removeCollateral
Remove collateral from the loan (opposite of posting collateral).
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount removed. |
1 |
|
|
| The destination to send the removed collateral. |
\
removeLoanImpairment
removeLoanImpairment
Remove the loan impairment by restoring the original payment due date.
\
repossess
repossess
Repossess collateral, and any funds, for a loan in default.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address where the collateral and funds asset is to be sent, if any. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of collateral asset repossessed. |
1 |
|
|
| The amount of funds asset repossessed. |
\
returnFunds
returnFunds
Return funds to the loan (opposite of drawing down). FUNDS SHOULD NOT BE TRANSFERRED TO THIS CONTRACT NON-ATOMICALLY. IF THEY ARE, THE BALANCE MAY BE STOLEN USING `skim`.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| An amount to pull from the caller, if any. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount returned. |
\
setImplementation
setImplementation
Modifies the proxy's implementation address.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of an implementation contract. |
\
setPendingBorrower
setPendingBorrower
Set the pendingBorrower to a new account.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the new pendingBorrower. |
\
setPendingLender
setPendingLender
Set the pendingLender to a new account.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the new pendingLender. |
\
skim
skim
Remove all token that is not accounted for by the loan (i.e. not `collateral` or `drawableFunds`).
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the token contract. |
1 |
|
|
| The recipient of the token. |
Return Values:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of token removed from the loan. |
\
upgrade
upgrade
Upgrades a contract implementation to a specific version. Access control logic critical since caller can force a selfdestruct via a malicious `migrator_` which is delegatecalled.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The version to upgrade to. |
1 |
|
|
| Some encoded arguments to use for the upgrade. |
\
Events
BorrowerAccepted
BorrowerAccepted
Borrower was accepted, and set to a new account.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the new borrower. |
\
CollateralPosted
CollateralPosted
Collateral was posted.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of collateral posted. |
\
CollateralRemoved
CollateralRemoved
Collateral was removed.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of collateral removed. |
1 |
|
|
| The recipient of the collateral removed. |
\
Funded
Funded
The loan was funded.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the lender. |
1 |
|
|
| The amount funded. |
2 |
|
|
| The due date of the next payment. |
\
FundsClaimed
FundsClaimed
Funds were claimed.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of funds claimed. |
1 |
|
|
| The recipient of the funds claimed. |
\
FundsDrawnDown
FundsDrawnDown
Funds were drawn.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of funds drawn. |
1 |
|
|
| The recipient of the funds drawn down. |
\
FundsReturned
FundsReturned
Funds were returned.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of funds returned. |
\
ImpairmentRemoved
ImpairmentRemoved
The loan impairment was explicitly removed (i.e. not the result of a payment or new terms acceptance).
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The new next payment due date. |
\
Initialized
Initialized
Loan was initialized.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the borrower. |
1 |
|
|
| The address of the lender. |
2 |
|
|
| The address of the entity responsible for calculating fees. |
3 |
|
|
| Array of asset addresses. [0]: collateralAsset, [1]: fundsAsset. |
4 |
|
|
| Array of loan parameters: [0]: gracePeriod, [1]: paymentInterval, [2]: payments, |
5 |
|
|
| Requested amounts: [0]: collateralRequired, [1]: principalRequested, [2]: endingPrincipal. |
6 |
|
|
| Fee parameters: [0]: interestRate, [1]: closingFeeRate, [2]: lateFeeRate, [3]: lateInterestPremiumRate |
7 |
|
|
| Array of fees: [0]: delegateOriginationFee, [1]: delegateServiceFee |
\
LenderAccepted
LenderAccepted
Lender was accepted, and set to a new account.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the new lender. |
\
LoanClosed
LoanClosed
Loan was repaid early and closed.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The portion of the total amount that went towards principal. |
1 |
|
|
| The portion of the total amount that went towards interest. |
2 |
|
|
| The portion of the total amount that went towards fees. |
\
LoanImpaired
LoanImpaired
The next payment due date was fast forwarded to the current time, activating the grace period. This is emitted when the pool delegate wants to force a payment (or default).
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The new next payment due date. |
\
NewTermsAccepted
NewTermsAccepted
The terms of the refinance proposal were accepted.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The hash of the refinancer, deadline, and calls proposed. |
1 |
|
|
| The address that will execute the refinance. |
2 |
|
|
| The deadline for accepting the new terms. |
3 |
|
|
| The individual calls for the refinancer contract. |
\
NewTermsProposed
NewTermsProposed
A refinance was proposed.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The hash of the refinancer, deadline, and calls proposed. |
1 |
|
|
| The address that will execute the refinance. |
2 |
|
|
| The deadline for accepting the new terms. |
3 |
|
|
| The individual calls for the refinancer contract. |
\
NewTermsRejected
NewTermsRejected
The terms of the refinance proposal were rejected.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The hash of the refinancer, deadline, and calls proposed. |
1 |
|
|
| The address that will execute the refinance. |
2 |
|
|
| The deadline for accepting the new terms. |
3 |
|
|
| The individual calls for the refinancer contract. |
\
PaymentMade
PaymentMade
Payments were made.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The portion of the total amount that went towards principal. |
1 |
|
|
| The portion of the total amount that went towards interest. |
2 |
|
|
| The portion of the total amount that went towards fees. |
\
PendingBorrowerSet
PendingBorrowerSet
Pending borrower was set.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| Address that can accept the borrower role. |
\
PendingLenderSet
PendingLenderSet
Pending lender was set.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| Address that can accept the lender role. |
\
Repossessed
Repossessed
The loan was in default and funds and collateral was repossessed by the lender.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The amount of collateral asset repossessed. |
1 |
|
|
| The amount of funds asset repossessed. |
2 |
|
|
| The recipient of the collateral and funds, if any. |
\
Skimmed
Skimmed
Some token (neither fundsAsset nor collateralAsset) was removed from the loan.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The address of the token contract. |
1 |
|
|
| The amount of token remove from the loan. |
2 |
|
|
| The recipient of the token. |
\
Upgraded
Upgraded
The instance was upgraded.
Parameters:
Index | Name | Type | Internal Type | Description |
---|---|---|---|---|
0 |
|
|
| The new version of the loan. |
1 |
|
|
| The upgrade arguments, if any. |
\
Last updated