Denali Marsh
eb856b5a1f
Fix: delete incentive reward factors on full withdraw/repay ( #885 )
...
* delete incentive reward index on repay/withdraw
* call hook on borrow in all cases
* additional types functionality
* extend tests to cover fix
* update naming convention in tests
* update test comment
* feat: add set difference unit tests
* clarify test names
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-03-23 17:28:03 -06:00
Denali Marsh
656c5a80b8
Additional Hard module queries ( #884 )
...
* unsynced deposits/borrows queriers
* cli queriers
* rest querier
* implement interest factor querier
* querier cli
* querier rest
* fix typo in comment
2021-03-22 18:57:07 +01:00
Denali Marsh
21cf7685df
don't sync borrow on deposit - it's redundant ( #876 )
2021-03-15 09:29:13 -06:00
Denali Marsh
72bfee6523
Minor best practices edits in Hard module ( #877 )
...
* put err return inside conditional
* check error type instead of error msg string
2021-03-15 09:15:19 -06:00
Ruaridh
20b3fa53e3
Prevent panic-causing param values ( #875 )
...
* prevent cdp liquidation ratio being 0.0
* fix linter warning
* prevent hard conversin factor being < 1
* add liquidation tests for different keeper rewards
2021-03-15 08:44:23 -06:00
Ruaridh
7779c8ee4d
Fix hard/committee begin blocker order ( #867 )
...
* switch hard and committee begin blocker order
* udpate money market deprecation steps
* move committee begin blocker in front of cdp
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-03-10 21:38:42 -07:00
Ruaridh
509d2edbca
fix bug that skipped minimum borrow check ( #870 )
...
add tests for non-borrower repayer address
2021-03-10 21:13:21 -07:00
Kevin Davis
829aed5256
fix: decrement coins for supply/borrow properly ( #862 )
...
* fix: decrement coins for supply/borrow properly
* fix: decrement keeper liquidation reward coins from hard total supply (#865 )
* fix: use proper safe subtraction for withdraw/repay methods
* fix: decrement keeper liquidation rewards from total supply
* address review comments
2021-03-10 10:56:08 -07:00
Ruaridh
162602f390
Test users cannot borrow from reserves ( #869 )
...
* add ValidateBorrow test
* remove accidentally duplicated test
2021-03-09 12:11:13 -07:00
Denali Marsh
1499a89ce5
Query Hard module reserves ( #843 )
...
* implement CLI reserves query
* implement REST reserves query
2021-02-22 13:48:52 -07:00
Denali Marsh
fe43c2bc41
Hard Audit: don't convert directly from sdk.Int to uint64 ( #842 )
...
* refactor away from sdk.Int's .Uint64() method
* refactor cdp module interest calc
2021-02-20 09:42:57 -07:00
Kevin Davis
5cd94047a4
fix: set interest accumulation time and exit when borrows are zero ( #840 )
2021-02-19 16:33:55 -07:00
Denali Marsh
421f774ec1
sort unique denom list ( #836 )
2021-02-19 14:05:17 -07:00
Denali Marsh
0a51a737cb
fix time elapsed calculation + test ( #838 )
2021-02-19 13:24:00 -07:00
Denali Marsh
6c88c01eb8
validate against money markets in store ( #839 )
2021-02-19 13:23:19 -07:00
Nick DeLuca
bdbc9b9c58
remove unused total deposit value -- not needed by ltv range calculation ( #832 )
2021-02-17 10:37:41 -07:00
Denali Marsh
53eab47c07
Hard Audit: don't let users borrow from reserves ( #827 )
...
* don't borrow from reserves
* use safesub and throw error
2021-02-16 07:45:57 -07:00
Denali Marsh
e8d3d877aa
check borrow err ( #828 )
2021-02-15 08:30:41 -07:00
Denali Marsh
15da55b451
Hard Audit: refresh borrow/deposit after syncing ( #824 )
...
* refresh borrow/deposit after syncing
* revisions
2021-02-12 21:56:03 +01:00
Denali Marsh
a5b72363d0
Hard Audit: decrement total borrowed on liquidation ( #823 )
...
* decrement total borrow on liquidation
* copy kevin's decrement changes
* check error in liquidation
* extend decrement borrowed changes
* mimic negative check on the supplied coins side
* update liquidation test
2021-02-12 13:07:32 -07:00
Denali Marsh
fe2a131b31
Hard Audit: add minimum borrow USD value ( #822 )
...
* add module param MinimumBorrowUSDValue
* borrow/repay min limit restrictions
* add borrow/repay test cases
* update tests with new module params
* update timelock test with param
* update withdraw LTV test
* remove unused GetCurrentBorrowUSDValue method
* commit to prompt CircleCI run
2021-02-12 08:28:05 -07:00
Denali Marsh
cd7a227030
Query Hard module's supply/borrow APYs ( #816 )
...
* calculate estimated apy from internal spy
* implement interest rate query
2021-02-10 10:53:53 -07:00
Denali Marsh
802ed36846
remove auction size param ( #815 )
2021-02-10 07:59:23 -07:00
Denali Marsh
b620275165
Hard Audit: remove liquidation account from Hard module ( #810 )
...
* remove liquidator macc
* remove legacy if statement
2021-02-09 13:33:58 -07:00
Denali Marsh
7465c643b8
decrement/increment coin counters on auctions ( #809 )
2021-02-09 13:32:28 -07:00
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