anilhelvaci / dapp-pool-lending-protocol

The core of the Agoric economy
9 stars 1 forks source link

Demonstrate Expanded Behaviors #51

Open anilhelvaci opened 1 year ago

anilhelvaci commented 1 year ago

We should construct a scenario that showcases the behaviors in the Work Plan.

anilhelvaci commented 1 year ago

Think

Basically, below is what I've in mind;

  1. Start LendingPool contract with 100k units of governance tokens to be minted.
  2. The committee members(users who have access to the creatorFacet's getGovernanceInvitation method) fetch their governance tokens.
  3. Add a new pool via governance token weighted voting.
    • We start the pool with below risk controls
      const riskControls: {
             borrowable: false,
             usableAsCol: false,
             limitValue: 1_000n, // We only care about the limit of the collateral pool but we've to state an initial value for every pool anyway
      }
  4. Alice tries to borrow from new pool, fail.
  5. Creator marks the new pool as BORROWABLE.
  6. Try to borrow again, fail again.
  7. Creator marks the collateral brand USABLE_AS_COLLATERAL.
  8. Try to borrow again, fail again. This time allowed collateral limit is exceeded.
  9. Creator increases the collateral limit to 5_001n(This number might change) units.
  10. Try to borrow again, success!
  11. Bob tries to borrow, fails. Collateral limit exceeded.
  12. Alice adjusts her loan by paying some debt and receiving some collateral.
  13. Bob tries to borrow again, success.
  14. Maggie tries to borrow, fail. Collateral limit exceeded.
  15. Alice closes her loan.
  16. Maggie tries again, success.
  17. Bob tries to adjust his loan by giving some more collateral and asking for some debt, fail. Collateral limit exceeded.
  18. Maggie gets liquidated.
  19. Bob tries to adjust again, success!

Above is what I've in mind for demonstration. Please let me know if there's another case you'd like to be showcased. Or, since last time took a little bit too long(AMM Stop-Loss) you might want to keep this one a little bit shorter. Please feel free to let me know @rowgraus

anilhelvaci commented 1 year ago

Action Items