Commit Graph

59 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Kevin Davis
bc1fab7836
fix: renumber error messages (#812) 2021-02-10 07:57:28 -07:00
Kevin Davis
04b65e1d4e
fix: export synced deposits/borrows (#811)
* fix: export synced deposits/borrows

* fix: epxort synced cdps
2021-02-10 07:56:38 -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
Kevin Davis
37be34b4d6
fix: replace is zero time check (#787) 2021-02-02 14:42:51 -07: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
Denali Marsh
72a6df17fd
Hard: Kava delegators earn HARD rewards via the Incentive module (#776)
* add staking keeper to incentive module

* update hard with delegator methods

* add delegator methods to incentive

* implement delegator hook scaffolds

* implement hard delegator reward accumulation

* update claim names to delegator

* stakingKeeper expected keeper methods

* accumulate delegator rewards

* initialize delegator reward

* synchronize delegator reward

* add TODO comments to rewards

* implement staking hooks interface

* initial revisions

* remove outdated TODO

* update methods for test compatibility

* update method names for test compatibility

* implement initial accumulate delegator reward test

* attempt validator set up in staking module

* initial synchronize delegator reward test

* delegator accumulation test passing

* synchronize delegator rewards test (not passing)

* synchronize delegator rewards passing

* revisions
2021-01-25 13:58:12 +01: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
f89b8797ed
Clean up leftover Hard module claim types/queries (#775)
* clean up types

* clean up client/rest

* clean up alias

* remove LP/Gov schedule errors

* clean up claim multipliers
2021-01-21 18:38:52 +01: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
Kevin Davis
c63ecf908a
Cdp accumulators (#751)
* Add 'InterestFactor' to CDP type (#734)

* update cdp type to include interest factor

* fix build

* Add cdp accumulator methods (#735)

* remame fees to interest

* add accumulate interest method

* add basic test

* add note

* address review comments

* update tests

* Add sync cdp interest method (#737)

* remame fees to interest

* add accumulate interest method

* add basic test

* add note

* address review comments

* update tests

* remove old fee functions

* add method to synchronize cdp interest

* add multi-cdp tests

* add test with many blocks

* add test for interest getter

* address review comments

* calculate time difference then convert to seconds

* fix: update collateral index when syncing interest

* fix: differentiate between case when apy is zero and all fees are being rounded to zero

* fix: round time difference properly

* update cdp genesis state and migrations (#738)

* remame fees to interest

* add accumulate interest method

* add basic test

* add note

* address review comments

* update tests

* remove old fee functions

* add method to synchronize cdp interest

* add multi-cdp tests

* add test with many blocks

* add test for interest getter

* update cdp genesis state and migrations

* address review comments

* calculate time difference then convert to seconds

* fix: update collateral index when syncing interest

* fix: differentiate between case when apy is zero and all fees are being rounded to zero

* fix: simplify add/remove/update collateral index

* update genesis state to include total principal amounts

* update migration

* Delete kava-4-cdp-state-block-500000.json

* Add cdp liquidations by external keeper (#750)

* feat: split liquidations between external keepers and automated begin blocker

* address review comments

* USDX incentive accumulators (#752)

* feat: split liquidations between external keepers and automated begin blocker

* wip: refactor usdx minting incentives to use accumulators/hooks

* wip: refactor usdx minting claim object

* feat: use accumulators/hooks for usdx minting rewards

* fix: get tests passing

* fix: don't create claim objects unless that cdp type is eligable for rewards

* add begin blocker

* update client

* cleanup comments/tests

* update querier

* address review comments

* fix: check for division by zero

* address review comments

* run hook before interest is synced

* Remove savings rate (#764)

* remove savings rate

* remove savings rate from debt param

* update migrations

* address review comments

* Add usdx incentives calculation test (#765)

* add usdx incentive calculation test

* update reward calculation

* add allowable error to test criteria

* Update x/incentive/keeper/rewards_test.go

Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>

* fix: remove old fields from test genesis state

Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>

Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2021-01-18 12:12:37 -07: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