Commit Graph

501 Commits

Author SHA1 Message Date
Denali Marsh
fa57876ad8
Incentive queries: unsynced claims, global reward factors (#894)
* unsynced querier types

* unsynced querier keeper methods

* unsynced querier cli

* unsynced querrier rest

* reward factors querier types

* reward factors querier keeper methods

* reward factors querier cli

* reward factors querier rest

* move PostClaimReq from types to rest
2021-04-02 15:34:42 -06:00
Ruaridh
54c0793ced
Fix delegation claim syncing (#889)
* sync claims on validator state changes and slashes

* add test notes

* update missed sync delegator calls

* tidy up suite addresses initialization

* test claim synced when validator bonds/unbonds

* test validator slashed

* check reward factor increased

* test redelegation sync claim

* revert mistake

* resolve trailing TODOs

* call incentive hooks after hard liquidation

* check global index in tests after delegator reward sync

Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-03-25 00:10:13 -06:00
Ruaridh
818b848190
zero out coins on payout (#892) 2021-03-24 22:21:26 -06:00
Denali Marsh
c7ed944503
fix delegation reward index (#888) 2021-03-23 17:44:37 -06:00
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
Ruaridh
d601481b95
Fix index sync when deposits/borrows are small (#886)
* sync indexes when deposit is small

* add test for borrow index sync when zero rewards

* update test for borrow index updates

* fix synchronize hard supply reward

Co-authored-by: denalimarsh <denalimarsh@gmail.com>
2021-03-22 22:31:21 -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
fa97a7db0e
refactor to MsgClaimHardReward (#879) 2021-03-15 12:03:15 -06: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
Kevin Davis
2611d48b77
fix: return nil instead of empty byte slice (#878) 2021-03-15 08:41:36 -06:00
Denali Marsh
12f5a67d6d
CDP Querier: update AugmentedCDP's FeesUpdated and InterestFactor (#860)
* update CDP's FeesUpdated and InterestFactor

* remove newline
2021-03-10 21:40:43 -07: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
Denali Marsh
8744d3210c
Genesis import/export fixes (#871)
* panic on export if prev accrual time not set

* on export if interest factor not set, set to 1.0

* fix prev accrual time in cdp export

* panic on export if prev accrual time not set

* export hard reward denom accumulation times

* init genesis starts usdx reward indexes at 0.0

* update incentive migration

* update incentive tests
2021-03-10 21:32:35 -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
e21a04ca57
fix: set previous block time correctly on block one (#868)
* fix: set previous block time correctly on block one

* fix failing tests
2021-03-10 10:56:23 -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
Kevin Davis
203d7e0063
Fix delegator rewards initialization (#859)
* fix: sync delegator rewards if they exist before creating new delegation

* remove comments
2021-03-01 18:36:40 -07:00
Kevin Davis
5ff0e4eea4
fix: ensure time elapsed is not negative (#855) 2021-02-28 10:33:56 -07:00
Kevin Davis
26e88c6177
fix: check correct time elpased condition (#853) 2021-02-24 11:25:40 -07:00
Denali Marsh
0e718d3510
Update Swagger for kava-5 (#852)
* hard: posts, gets, object definitions

* formatting

* incentive params

* incentive claims and rewards

* incentive fromatting

* update CDP

* format CDP

* fix typo in cdp liquidate route registration
2021-02-23 14:02:08 -07:00
Kevin Davis
5352c2489d
fix: set indexes to zero (#835) 2021-02-23 12:41:30 -07:00
Denali Marsh
8a878b0d66
add liquidate msg to cdp spec (#850) 2021-02-23 12:41:17 -07:00
Kevin Davis
e4daffcaf8
fix: enforce max number of liquidations in cdp begin blocker (#849)
* fix: enforce max number of liquidations in cdp begin blocker

* address review comments
2021-02-23 12:39:39 -07:00
Kevin Davis
667ad87825
[R4R] kava 5 migration (#848)
* wip: kava-5 migration

* feat: kava 5 migration

* fix: don't repeat genesis time
2021-02-22 18:28:07 -07:00
Kevin Davis
0865e40553
[R4R] incentive, hard migrations (#783)
* update v0_11 harvest genesis state

* wip: hard migration

* wip: incentive migration

* wip: incentive migration

* update incentive migration for multi-rewards

* address review comments

* sort slices for deterministic ordering

* update interest rate model and reserves

* fix: use correct conversion factor

* fix: remove auction size param

* remove ununsed module accounts

* update incentive claim multiplier for one month rewards

* address hard migration review comments

* add hard test

* migrate harvest mod account (#844)

* migrate harvest mod account

* update hard account permissions

* update hard module account permissions

Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2021-02-22 14:08:23 -07:00
Denali Marsh
99fb79a1ae
update spec, add money market deprecation steps (#841) 2021-02-22 13:52:17 -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
Kevin Davis
1ab2e9965f
Add committee migrations (#818)
* fix: collateral param permission

* wip: kava-5 committee updates

* feat: add committee migrations

* rename functions so git recognizes diffs better

* rename

* remove auction_size param

* address review comments

* add check ltv index count to collateral param perms

* fix: update legacy migration

* use function to define collateral param in test

* use go 1.15 in circle

* address review comments

* fix: no nil values for collateral params
2021-02-19 14:05:42 -07:00
Denali Marsh
421f774ec1
sort unique denom list (#836) 2021-02-19 14:05:17 -07:00
Denali Marsh
0b6e47ff46
call hooks in export genesis (#837) 2021-02-19 13:49:36 -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
Denali Marsh
6045a94b39
Allocate Hard supply/borrow rewards to legacy suppliers/borrowers (#833)
* initialize hard supply reward for empty rewards

* add god committee to integration test

* organize claim types, add helper methods

* reorder integration test's god committee

* legacy suppliers earn rewards + tests

* update InitializeHardBorrowReward + test

* remove formatting comments from tests

* allocate rewards to legacy borrowers + test

* apply change to update index denom methods

* Update querier to show synced rewards for legacy deposits/borrows (#834)

* update simulated sync method to show rewards for legacy deposits/borrows

* more explicity debuging logs

* revisions

Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
2021-02-19 13:02:51 -07:00
Kevin Davis
c5fc1c6b4f
Add hard and incentive spec updates (#817)
* wip: update hard spec

* feat: updated hard spec

* feat: updated incentive spec
2021-02-19 17:14:48 +01: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
Kevin Davis
58573e7b26
fix: allow ltv of zero (#830) 2021-02-16 07:43:46 -07:00
Kevin Davis
ad6ef76979
fix: set interest last updated to previous accrual time, not block time (#829) 2021-02-16 07:43:21 -07:00
Denali Marsh
e8d3d877aa
check borrow err (#828) 2021-02-15 08:30:41 -07:00
Denali Marsh
94999b6b02
Incentive module: accounts should only be able to claim their own rewards (#826)
* make rewards only claimable by sender

* remove 'owner' from cli for incentive claims
2021-02-15 08:29:00 -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
Kevin Davis
7e39c1d0a8
fix: account for start time in calculating time elapsed (#821) 2021-02-12 08:30:10 -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