-
Notifications
You must be signed in to change notification settings - Fork 80
Private pool #37
base: main
Are you sure you want to change the base?
Private pool #37
Conversation
Kashi pair with the following changes: - Charge protocol fee on liquidations - Charge protocol fee on borrow open - Allow only one lender, and a whitelist of borrowers - Collect fees as soon as feasible; do not "reinvest" - Add option to seize collateral on liquidation. Bonus and fees are taken out in the collateral as well - Add expiration (liquidation-free period)
contracts/PrivatePool.sol
Outdated
|
||
AccrueInfo memory _accrueInfo = accrueInfo; | ||
require( | ||
block.timestamp >= _accrueInfo.NO_LIQUIDATIONS_BEFORE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we still have an oracle we still need a liquidation if it goes insolvent, it should just also liquidate if the time period is up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after the time period is up, liquidations should be possible even if the position is still solvent.
This reverts commit ae063b3.
6bfb5f5
to
643a85a
Compare
Notable features/differences: - Same lender / borrowers model as PrivatePool - ERC-721 contract as collateral - One loan per contract token - Interest auto-compounds; no accrue() - Repayment can only be in full - Open fee comes out of principal - Lender can update loan parameters. If a loan is currently taken out then the update succeeds as long as it benefits the borrower. - No "flash borrows". (Would probably use a separate borrow function). - Expirations are required, and collateral gets auto-seized by the lender on expiration. Other than that, no liquidations.
6624413
to
8e41876
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Faster
// Cast is safe: No loan will be active if this overflows | ||
uint256 interest = calculateInterest(params.valuation, uint64(block.timestamp - loan.startTime), params.annualInterestBPS); | ||
uint256 amount = params.valuation + interest; | ||
(bool ok, uint256 rate) = params.oracle.get(address(this), tokenId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to pass the address of the collateral instead of address(this)?
|
||
// Protect tokens that are underwater to begin with from being "lent" | ||
// against (and seized immediately): | ||
if (params.oracle != INFTOracle(0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should params.oracle be really optional? otherwise I think it's fair to also "nullcheck" it in remove collateral as well?
0c6899b
to
6ec5a2e
Compare
No description provided.