bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 41쪽
still marked `FAILED` (resolved messages are filtered out).
* `getMessage` returns the full stored message, including sender and token payloads, which is used for recovery.
# Interfaces
# FixedTermLoan
MapleLoan implements a primitive loan with additional functionality, and is intended to be proxied.
## Functions
### `HUNDRED_PERCENT`
The value that represents 100%, to be easily comparable with the loan rates.
```solidity
function HUNDRED_PERCENT()
view
returns (
uint256
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :--: | :-------: | :-----------: | ----------- |
| 0 | | `uint256` | `uint256` | |
### `acceptBorrower`
Accept the borrower role, must be called by pendingBorrower.
```solidity
function acceptBorrower()
nonpayable;
```
### `acceptLender`
Accept the lender role, must be called by pendingLender.
```solidity
function acceptLender()
nonpayable;
```
### `acceptNewTerms`
Accept the proposed terms ans trigger refinance execution
```solidity
function acceptNewTerms(
address refinancer_,
uint256 deadline_,
bytes[] calls_
)
nonpayable
returns (
bytes32 refinanceCommitment_
);
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------: | :-------: | :-----------: | ------------------------------------------------- |
| 0 | `refinancer_` | `address` | `address` | The address of the refinancer contract. |
| 1 | `deadline_` | `uint256` | `uint256` | The deadline for accepting the new terms. |
| 2 | `calls_` | `bytes[]` | `bytes[]` | The encoded arguments to be passed to refinancer. |
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :--------------------: | :-------: | :-----------: | --------------------------------------------- |
| 0 | `refinanceCommitment_` | `bytes32` | `bytes32` | The hash of the accepted refinance agreement. |
### `borrower`
The borrower of the loan, responsible for repayments.
```solidity
function borrower()
view
returns (
address borrower_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :---------: | :-------: | :-----------: | ----------- |
| 0 | `borrower_` | `address` | `address` | |
### `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\`.
```solidity
function closeLoan(
uint256 amount_
)
nonpayable
returns (
uint256 principal_,
uint256 interest_,
uint256 fees_
);
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :-------: | :-------: | :-----------: | ------------------------------------------ |
| 0 | `amount_` | `uint256` | `uint256` | An amount to pull from the caller, if any. |
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :-------: | :-----------: | ------------------------------------------------ |
| 0 | `principal_` | `uint256` | `uint256` | The portion of the amount paying back principal. |
| 1 | `interest_` | `uint256` | `uint256` | The portion of the amount paying interest. |
| 2 | `fees_` | `uint256` | `uint256` | The portion of the amount paying service fees. |
### `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.
```solidity
function closingRate()
view
returns (
uint256 closingRate_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ----------- |
| 0 | `closingRate_` | `uint256` | `uint256` | |
### `collateral`
The amount of collateral posted against outstanding (drawn down) principal.
```solidity
function collateral()
view
returns (
uint256 collateral_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------: | :-------: | :-----------: | ----------- |
| 0 | `collateral_` | `uint256` | `uint256` | |
### `collateralAsset`
The address of the asset deposited by the borrower as collateral, if needed.
```solidity
function collateralAsset()
view
returns (
address collateralAsset_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------------: | :-------: | :-----------: | ----------- |
| 0 | `collateralAsset_` | `address` | `address` | |
### `collateralRequired`
The amount of collateral required if all of the principal required is drawn down.
```solidity
function collateralRequired()
view
returns (
uint256 collateralRequired_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-------------------: | :-------: | :-----------: | ----------- |
| 0 | `collateralRequired_` | `uint256` | `uint256` | |
### `drawableFunds`
The amount of funds that have yet to be drawn down by the borrower.
```solidity
function drawableFunds()
view
returns (
uint256 drawableFunds_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :--------------: | :-------: | :-----------: | ----------- |
| 0 | `drawableFunds_` | `uint256` | `uint256` | |
### `drawdownFunds`
Draw down funds from the loan.
```solidity
function drawdownFunds(
uint256 amount_,
address destination_
)
nonpayable
returns (
uint256 collateralPosted_
);
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ------------------------------ |
| 0 | `amount_` | `uint256` | `uint256` | The amount to draw down. |
| 1 | `destination_` | `address` | `address` | The address to send the funds. |
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------------: | :-------: | :-----------: | --------------------------------------------------- |
| 0 | `collateralPosted_` | `uint256` | `uint256` | The amount of additional collateral posted, if any. |
### `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.
```solidity
function endingPrincipal()
view
returns (
uint256 endingPrincipal_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------------: | :-------: | :-----------: | ----------- |
| 0 | `endingPrincipal_` | `uint256` | `uint256` | |
### `excessCollateral`
Returns the excess collateral that can be removed.
```solidity
function excessCollateral()
view
returns (
uint256 excessCollateral_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------------: | :-------: | :-----------: | -------------------------------------------------- |
| 0 | `excessCollateral_` | `uint256` | `uint256` | The excess collateral that can be removed, if any. |
### `factory`
The address of the proxy factory.
```solidity
function factory()
view
returns (
address factory_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :--------: | :-------: | :-----------: | ----------- |
| 0 | `factory_` | `address` | `address` | |
### `feeManager`
The address of the contract that handles payments of fees on behalf of the loan.
```solidity
function feeManager()
view
returns (
address feeManager_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------: | :-------: | :-----------: | ----------- |
| 0 | `feeManager_` | `address` | `address` | |
### `fundLoan`
Lend funds to the loan/borrower.
```solidity
function fundLoan()
nonpayable
returns (
uint256 fundsLent_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :-------: | :-----------: | ------------------ |
| 0 | `fundsLent_` | `uint256` | `uint256` | The amount funded. |
### `fundsAsset`
The asset deposited by the lender to fund the loan.
```solidity
function fundsAsset()
view
returns (
address fundsAsset_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------: | :-------: | :-----------: | ----------- |
| 0 | `fundsAsset_` | `address` | `address` | |
### `getAdditionalCollateralRequiredFor`
Get the additional collateral to be posted to drawdown some amount.
```solidity
function getAdditionalCollateralRequiredFor(
uint256 drawdown_
)
view
returns (
uint256 collateral_
);
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :---------: | :-------: | :-----------: | ------------------------------------ |
| 0 | `drawdown_` | `uint256` | `uint256` | The amount desired to be drawn down. |
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------: | :-------: | :-----------: | ----------- |
| 0 | `collateral_` | `uint256` | `uint256` | |
### `getClosingPaymentBreakdown`
Get the breakdown of the total payment needed to satisfy an early repayment to close the loan.
```solidity
function getClosingPaymentBreakdown()
view
returns (
uint256 principal_,
uint256 interest_,
uint256 fees_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :-------: | :-----------: | ------------------------------------------------------------------- |
| 0 | `principal_` | `uint256` | `uint256` | The portion of the total amount that will go towards principal. |
| 1 | `interest_` | `uint256` | `uint256` | The portion of the total amount that will go towards interest fees. |
| 2 | `fees_` | `uint256` | `uint256` | The portion of the total amount that will go towards fees. |
### `getNextPaymentBreakdown`
Get the breakdown of the total payment needed to satisfy the next payment installment.
```solidity
function getNextPaymentBreakdown()
view
returns (
uint256 principal_,
uint256 interest_,
uint256 fees_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :-------: | :-----------: | -------------------------------------------------------------------------------- |
| 0 | `principal_` | `uint256` | `uint256` | The portion of the total amount that will go towards principal. |
| 1 | `interest_` | `uint256` | `uint256` | The portion of the total amount that will go towards interest fees. |
| 2 | `fees_` | `uint256` | `uint256` | The portion of the total amount that will go towards paying administrative fees. |
### `getNextPaymentDetailedBreakdown`
Get the detailed breakdown of the total payment needed to satisfy the next payment installment.
```solidity
function getNextPaymentDetailedBreakdown()
view
returns (
uint256 principal_,
uint256[3] interest_,
uint256[2] fees_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :----------: | :-----------: | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 0 | `principal_` | `uint256` | `uint256` | The portion of the total amount that will go towards principal. |
| 1 | `interest_` | `uint256[3]` | `uint256[3]` | 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 | `fees_` | `uint256[2]` | `uint256[2]` | The portion of the total amount that will go towards paying administrative fees. \[0] Delegate fees. \[1] Platform fees. |
### `getRefinanceInterest`
Get the extra interest that will be charged according to loan terms before refinance, based on a given timestamp.
```solidity
function getRefinanceInterest(
uint256 timestamp_
)
view
returns (
uint256 proRataInterest_
);
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :-------: | :-----------: | -------------------------------------------------- |
| 0 | `timestamp_` | `uint256` | `uint256` | The timestamp when the new terms will be accepted. |
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------------: | :-------: | :-----------: | ----------------------------------------------------- |
| 0 | `proRataInterest_` | `uint256` | `uint256` | The interest portion to be added in the next payment. |
### `getUnaccountedAmount`
Get the amount on an asset that in not accounted for by the accounting variables (and thus can be skimmed).
```solidity
function getUnaccountedAmount(
address asset_
)
view
returns (
uint256 unaccountedAmount_
);
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :------: | :-------: | :-----------: | -------------------------------- |
| 0 | `asset_` | `address` | `address` | The address of a asset contract. |
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :------------------: | :-------: | :-----------: | ------------------------------------- |
| 0 | `unaccountedAmount_` | `uint256` | `uint256` | The amount that is not accounted for. |
### `globals`
The Maple globals address
```solidity
function globals()
view
returns (
address globals_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :--------: | :-------: | :-----------: | ----------- |
| 0 | `globals_` | `address` | `address` | |
### `governor`
The address of the Maple Governor.
```solidity
function governor()
view
returns (
address governor_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :---------: | :-------: | :-----------: | ----------- |
| 0 | `governor_` | `address` | `address` | |
### `gracePeriod`
The amount of time the borrower has, after a payment is due, to make a payment before being in default.
```solidity
function gracePeriod()
view
returns (
uint256 gracePeriod_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ----------- |
| 0 | `gracePeriod_` | `uint256` | `uint256` | |
### `impairLoan`
Fast forward the next payment due date to the current time. This enables the pool delegate to force a payment (or default).
```solidity
function impairLoan()
nonpayable;
```
### `implementation`
The address of the implementation contract being proxied.
```solidity
function implementation()
view
returns (
address implementation_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :---------------: | :-------: | :-----------: | ----------- |
| 0 | `implementation_` | `address` | `address` | |
### `interestRate`
The annualized interest rate (APR), in units of 1e18, (i.e. 1% is 0.01e18).
```solidity
function interestRate()
view
returns (
uint256 interestRate_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-------------: | :-------: | :-----------: | ----------- |
| 0 | `interestRate_` | `uint256` | `uint256` | |
### `isImpaired`
Return if the loan has been impaired.
```solidity
function isImpaired()
view
returns (
bool isImpaired_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-----------: | :----: | :-----------: | ---------------------------- |
| 0 | `isImpaired_` | `bool` | `bool` | Is the loan impaired or not. |
### `lateFeeRate`
The rate charged at late payments.
```solidity
function lateFeeRate()
view
returns (
uint256 lateFeeRate_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :------------: | :-------: | :-----------: | ----------- |
| 0 | `lateFeeRate_` | `uint256` | `uint256` | |
### `lateInterestPremiumRate`
The premium over the regular interest rate applied when paying late.
```solidity
function lateInterestPremiumRate()
view
returns (
uint256 lateInterestPremiumRate_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :------------------------: | :-------: | :-----------: | ----------- |
| 0 | `lateInterestPremiumRate_` | `uint256` | `uint256` | |
### `lender`
The lender of the Loan.
```solidity
function lender()
view
returns (
address lender_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-------: | :-------: | :-----------: | ----------- |
| 0 | `lender_` | `address` | `address` | |
### `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\`.
```solidity
function makePayment(
uint256 amount_
)
nonpayable
returns (
uint256 principal_,
uint256 interest_,
uint256 fees_
);
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :-------: | :-------: | :-----------: | ------------------------------------------ |
| 0 | `amount_` | `uint256` | `uint256` | An amount to pull from the caller, if any. |
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :-------: | :-----------: | ------------------------------------------------ |
| 0 | `principal_` | `uint256` | `uint256` | The portion of the amount paying back principal. |
| 1 | `interest_` | `uint256` | `uint256` | The portion of the amount paying interest fees. |
| 2 | `fees_` | `uint256` | `uint256` | The portion of the amount paying service fees. |
### `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.
```solidity
function migrate(
address migrator_,
bytes arguments_
)
nonpayable;
```
#### Parameters:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------: | :-------: | :-----------: | ------------------------------------------------ |
| 0 | `migrator_` | `address` | `address` | The address of a migrator contract. |
| 1 | `arguments_` | `bytes` | `bytes` | Some encoded arguments to use for the migration. |
### `nextPaymentDueDate`
The timestamp due date of the next payment.
```solidity
function nextPaymentDueDate()
view
returns (
uint256 nextPaymentDueDate_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :-------------------: | :-------: | :-----------: | ----------- |
| 0 | `nextPaymentDueDate_` | `uint256` | `uint256` | |
### `originalNextPaymentDueDate`
The saved original payment due date from a loan impairment.
```solidity
function originalNextPaymentDueDate()
view
returns (
uint256 originalNextPaymentDueDate_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :---------------------------: | :-------: | :-----------: | ----------- |
| 0 | `originalNextPaymentDueDate_` | `uint256` | `uint256` | |
### `paymentInterval`
The specified time between loan payments.
```solidity
function paymentInterval()
view
returns (
uint256 paymentInterval_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :----------------: | :-------: | :-----------: | ----------- |
| 0 | `paymentInterval_` | `uint256` | `uint256` | |
### `paymentsRemaining`
The number of payment installments remaining for the loan.
```solidity
function paymentsRemaining()
view
returns (
uint256 paymentsRemaining_
);
```
#### Return Values:
| Index | Name | Type | Internal Type | Description |
| :---: | :------------------: | :-------:프로젝트로 돌아가기