SaplingLendingPool
SaplingLendingPool
Extends SaplingPoolContext with lending strategy.
loanDesk
Address of the loan desk contract
treasury
Address where the protocol fees are sent to
yieldSettledDay
unix day on which the yield has been settled.
onlyLoanDesk
A modifier to limit access only to the loan desk contract
constructor
initialize
Creates a Sapling pool.
Addresses must not be 0.
Name | Type | Description |
---|---|---|
_poolToken | address | ERC20 token contract address to be used as the pool issued token. |
_liquidityToken | address | ERC20 token contract address to be used as pool liquidity currency. |
_accessControl | address | Access control contract |
_treasury | address | Address where the protocol fees are sent to |
_stakerAddress | address | Staker address |
setLoanDesk
Links a new loan desk for the pool to use. Intended for use upon initial pool deployment.
Caller must be the governance. This setter may also be used to switch loan desks. If applicable: Outstanding loan operations must be concluded on the loan desk before the switch.
Name | Type | Description |
---|---|---|
_loanDesk | address | New LoanDesk address |
setTreasury
Designates a new treasury address for the pool.
Protocol fees will be sent to this address on every interest payment.
Name | Type | Description |
---|---|---|
_treasury | address | New treasury address |
settleYield
Settle pending yield.
Calculates interest due since last update and increases preSettledYield, taking into account the protocol fee and the staker earnings.
onOfferAllocate
Hook for a new loan offer. Caller must be the LoanDesk.
Name | Type | Description |
---|---|---|
amount | uint256 | Amount to be allocated for loan offers. |
onOfferDeallocate
Hook for a loan offer amount update. Amount update can be due to offer update or cancellation. Caller must be the LoanDesk.
Name | Type | Description |
---|---|---|
amount | uint256 | Previously allocated amount being returned. |
onRepay
_Hook for repayments. Caller must be the LoanDesk.
Name | Type | Description |
---|---|---|
loanId | uint256 | ID of the loan which has just been borrowed |
borrower | address | Borrower address |
payer | address | Actual payer address |
transferAmount | uint256 | Amount chargeable |
interestPayable | uint256 | Amount of interest paid, this value is already included in the payment amount |
borrowedTime | uint256 | Block timestamp when this loan was borrowed |
onDefault
Hook for defaulting a loan. Caller must be the LoanDesk. Defaulting a loan will cover the loss using the staked funds. If these funds are not sufficient, the lenders will share the loss.
Name | Type | Description |
---|---|---|
loanId | uint256 | ID of the loan to default |
principalLoss | uint256 | Unpaid principal amount to resolve |
yieldLoss | uint256 | Unpaid yield amount to resolve |
canOffer
View indicating whether or not a given loan amount can be offered.
Hook for checking if the lending pool can provide liquidity for the total offered loans amount.
Name | Type | Description |
---|---|---|
amount | uint256 | Amount to check for new loan allocation |
Name | Type | Description |
---|---|---|
[0] | bool | True if the pool has sufficient lending liquidity, false otherwise |
canOpen
Indicates whether or not the contract can be opened in it's current state.
Overrides a hook in SaplingStakerContext.
Name | Type | Description |
---|---|---|
[0] | bool | True if the conditions to open are met, false otherwise. |
canClose
Implementation of the abstract hook in SaplingManagedContext. Pool can be close when no funds remain committed to strategies.
strategizedFunds
Current amount of liquidity tokens in strategies, including both allocated and committed but excluding pending yield.
Overrides the same method in the base contract.
currentAPY
Estimate APY breakdown given the current pool state.
Name | Type | Description |
---|---|---|
[0] | struct IPoolContext.APYBreakdown | Current APY breakdown |
breakdownEarnings
Breaks down an interest amount to shareholder yield, protocol fee and staker earnings.
Name | Type | Description |
---|---|---|
interestAmount | uint256 | Interest amount paid by the borrower |
Name | Type | Description |
---|---|---|
[0] | uint256 | Amounts for (shareholderYield, protocolFee, stakerEarnings) |
[1] | uint256 | |
[2] | uint256 |
Last updated