Commit Graph

25 Commits

Author SHA1 Message Date
Kevin Davis
7d4235ca87
fix: don't accumulate if borrow interest rounds to zero (#808) 2021-02-09 10:11:12 -07:00
Denali Marsh
c60365f12e
call both incentive hooks (#804) 2021-02-08 07:13:30 -07:00
Denali Marsh
0edbdf968e
hotfix (#803) 2021-02-08 13:57:02 +01:00
Denali Marsh
5af50e1a2d
Hard Audit: enable users to repay another account's borrows (#801)
* add owner to repay msg

* pass owner and sender to repay function

* make owner arg an optional flag

* make owner optional for REST
2021-02-08 13:51:42 +01:00
Denali Marsh
1b2cfa6d1a
Hard Audit: remove LTV index from Hard module (#800)
* remove LTV index

* remove LTV param

* remove LTV param from tests

* remove LTV index from tests

* fix incentive hook not called before sync
2021-02-08 13:23:37 +01:00
Denali Marsh
c8d4c02fb7
Remove unused Hard module accounts (#796)
* remove unused hard module accs

* update tests

* update migration for compile

* maintain migration
2021-02-05 12:45:37 +01:00
Denali Marsh
0343edf0d0
Hard Audit: fix duplicate supply/borrow index factors (#794)
* types: set/get interest factor

* delete 0 balance index factors from deposit

* types: set/get borrow interest factor

* delete 0 balance index factors from borrow

* delete index factor directly
2021-02-05 12:31:38 +01:00
Denali Marsh
be498c72f5
sync supply interest before ValidateBorrow (#798) 2021-02-04 17:54:13 +01:00
Denali Marsh
9fa83f0a1e
remove GetPreviousBlockTime/SetPreviousBlockTime (#797) 2021-02-04 17:54:01 +01:00
Denali Marsh
facb357fe9
return err in ValidateBorrow (#799) 2021-02-04 17:53:50 +01:00
Denali Marsh
0c1fa5d27b
emit hard liquidation event (#790) 2021-02-03 23:23:17 +01:00
Denali Marsh
7be0c8b48e
decrement supplied coins (#791) 2021-02-03 23:23:03 +01:00
Denali Marsh
58494fe357
Hard: fix liquidation engine (#771)
* initial

* liquidation debugging

* max lot == macc coin balance

* add print statements

* add test for pricefeed liquidation scenarios

* skip zero lot

* add insolvency liquidation test scenario

* remove debugging statements

* fix tests after rebase

Co-authored-by: karzak <kjydavis3@gmail.com>
2021-02-01 14:13:17 -07:00
Kevin Davis
dc330d02bf
Update hard genesis state (#777)
* feat: update hard genesis state and init/export methods

* address review comments
2021-01-22 22:17:40 -07:00
Denali Marsh
4e6f6d1e9c
Incentive/Hard rebase to master (#773)
* spike: incentive/types

* spike: incentive/types tests

* spike: incentive/types/expected_keepers.go

* spike: incentive/keeper

* spike: incentive/keeper tests

* spike: incentive/sims and incentive/sims tests

* spike: incentive/module

* spike: incentive/module tests

* spike: hard/types

* spike: hard/types hooks

* spike: hard/types

* spike: hard/keeper basics

* spike: hard/keeper hooks

* integrate hard/keeper/borrow.go

* integrate hard/keeper/deposit.go

* integrate hard/keeper/liquidation.go

* integrate hard/keeper/withdraw.go

* integrate hard/keeper/repay.go

* spike: hard/sims

* spike: hard/sims tests

* spike: hard/client

* spike: hard/module

* integrate app.go

* spike: x/hard/keeper compile tests

* incentive/keeper test clean up

* validate usdx incentive types in genesis

* refactoring & fix deposit test

* fix liquidaton tests

* fix incentive tests for hard supply rewards

* fix hard genesis tests

* update incentive genesis state and params

* update cdp rewards accumulation

* update app init order and begin blocker order

Co-authored-by: karzak <kjydavis3@gmail.com>
2021-01-21 14:52:09 +01:00
Denali Marsh
fba6b8c4f2
Hard: delete borrow/deposit from store on 0 amount (#766)
* delete borrow/deposit on 0 balance

* add/update tests to ensure deletion

* delete from LTV index
2021-01-18 10:43:20 +01:00
Denali Marsh
34a7172581
Hard: refactor borrow/borrows and deposit/deposits query (#761)
* refactor cli borrows query

* rest api feature parity for borrows query

* refactor deposits cli query

* remove deposit/borrow query names from types

* add named deposit/borrow queries back into types

* rest api feature parity for deposits query

* load synced deposit instead of synced balance

* deposits query returns synced deposits

* borrows query returns synced borrows

* refactor querier types

* update comment for accuracy

* add deposit/borrow slice types

* refactor 'borrowed' query

* implement 'deposited' query types

* implement 'deposited' query keeper function

* implement 'deposited' query CLI

* implement 'deposited' query rest endpoint

* update naming conventions to 'total'
2021-01-13 19:14:58 +01:00
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
f6efc2597b
Hard: investigate sdk.RelativePow runtime panic (#762)
* interest rate practical test

* add clarification comment
2021-01-12 10:03:09 +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
38306e5465
add deposit balance query (#759) 2021-01-07 17:22:00 +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
e9f5043c84
Hard: update REST API (#748)
* borrows, borrow, borrowed queries

* update deposit, withdraw, claim rest txs

* add borrow, repay, liquidate rest tx

* update liquidate on handler
2020-12-22 17:08:27 +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