Skip to content

Private pool #37

Open
wants to merge 112 commits into
base: main
Choose a base branch
from
Open

Private pool #37

wants to merge 112 commits into from

Conversation

0xm3rlin
Copy link
Collaborator

@0xm3rlin 0xm3rlin commented Dec 6, 2021

No description provided.

Barry Lyndon added 3 commits November 27, 2021 03:43
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)

AccrueInfo memory _accrueInfo = accrueInfo;
require(
block.timestamp >= _accrueInfo.NO_LIQUIDATIONS_BEFORE,
Copy link
Collaborator Author

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

Copy link
Collaborator Author

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.

Barry Lyndon added 2 commits December 26, 2021 13:50
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.
@cryptolyndon cryptolyndon self-assigned this Jan 14, 2022
Copy link

@Dwatrack05 Dwatrack05 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link

@Dwatrack05 Dwatrack05 left a 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);
Copy link
Contributor

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)) {
Copy link
Contributor

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants