Commit Graph

5 Commits

Author SHA1 Message Date
Denali Marsh
d05516bbe0
Hard: sync supply interest on attempted liquidation (#763)
* sync supply interest on attempted liquidation

* update tests with supply interest accrual
2021-01-13 12:59:39 +01:00
Denali Marsh
bc110ce609
Hard: LTV index refactor (#758)
* add set/delete/update ltv methods

* refactor borrow logic

* basic updates to keeper logic for compile

* Add deposit index set/delete/update keeper methods

* refactor deposit logic

* refactor repay logic

* update withdraw logic

* introduce DeleteDepositBorrowAndLtvIndex

* remove unused bool from AttemptKeeperLiquidation

* remove comments (transitioned to asana cards)

* catch multiple error types in liquidation loop
2021-01-07 22:40:25 +01:00
Denali Marsh
f7a73c9245
Hard: suppliers earn interest (#749)
* update to borrow interest factor

* add supply interest factor to accrue interest

* supply interest factor keeper methods

* fix potential bug with user borrow indexing

* sync supply interest on deposit/withdraw

* separate withdraw/deposit

* relocate interest sync methods

* update comment

* simplify supply interest statement

* check truncated int not zero

* add .sub(storedAmount) back

* add store key suppliedcoins

* increment/decrement supplied coins

* update withdraw with new accounting

* update withdraw test

* catch repay edge case

* unit tests

* TestSupplyInterest scaffolding

* test notes

* temp: interest test

* example test

* changes, test checks more state

* fix: calculate supply interest directly

* fix: catch divide by zero

* add state checks back into interest test

* add snapshot test cases

* test owed supplied interest paid at correct ratio

* test user supply syncs user's borrow interest

* remove print statements and clean up

* refactor indented logic

* test supply/borrow multiple coins

* update decoder test

Co-authored-by: karzak <kjydavis3@gmail.com>
2021-01-07 11:23:05 +01:00
Denali Marsh
477b937039
Hard: withdraws limited by ltv (#747)
* liquidations refactor

* validate withdraws above ltv

* set mm in initgenesis

* add ltv limited withdraw test

* address revisions

* resolve diff
2020-12-21 18:28:41 +01:00
Denali Marsh
a4bbea1ec4
update 'harvest' -> 'hard' (#746) 2020-12-21 18:18:55 +01:00