Commit Graph

15 Commits

Author SHA1 Message Date
Ruaridh
d56bb77231
Incentive Test Refactors (#908)
* organise testing committee gen state

* remove repeated test app initialization

* minor fixes from linter in tests

* move more setup to SetupApp

* split up KeeperTestSuite for each reward type

* simplify KeeperTestSuite

* simplify PayoutKeeperSuite

* simplify DelegatorRewardSuite

* simplify SupplyRewardsSuite

* simplify BorrowRewardsSuite

* simplify USDXRewardsSuite

* add auth genesis builder for easier test setup

* migrate all incentive tests to auth builder

* add incentive genesis builder for easier setup
migrate hard incentive tests

* migrate all tests to incentive builder

* add hard genesis builder

* small tidy ups

* deduplicate initialTime from borrow tests

* deduplicate initialtTime from supply tests

* deduplicate initialTime from usdx and keeper tests

* deduplicate initialTime in delgator tests

* deduplicate genesis time in payout test

* deduplicate test app initialization

* make authGenesisBuilder available for all modules

* remove unused pricefeed setup

* export incentive genesis builder

* remove commented out test cases

* migrate cdp test to new test state builders

* migrate vv payout tests to use new builders
2021-06-10 14:35:44 +01:00
Kevin Davis
4d6f6aab3c
[R4R] re-enable claiming rewards validator vesting accounts (#920)
* feat: add new msg types for claim rewards from validator vesting accounts

* fix: validate owner is validator vesting account

* feat: add validator vesting tests for incent claims

* address review comments

* fix: client command name and example
2021-06-07 09:04:32 -05: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
754c018f04
Incentive module multiple reward denom tests (#788)
* types: multiple rewards

* supply-side reward keeper methods

* remove legacy comments

* update hard claim reward to coins type

* borrow-side reward keeper methods

* update claim payout to sdk.Coins

* make tests compile

* fix genesis validation for compile

* comment out failing tests

* fix ! found logic

* accumulate hard supply rewards (single)

* sync hard supply rewards (single)

* update hard borrow/supply index denoms

* accumulate hard borrow rewards (single)

* sync hard borrow rewards (single)

* sync hard delegator rewards

* payout hard claim (single)

* accumulate hard supply rewards (multiple)

* sync hard supply rewards (multiple)

* update hard supply index denoms (multiple)

* update hard borrow index denoms (multiple)

* accumulate hard borrow rewards (multiple)

* sync hard borrow rewards (multiple)

* fix denom

* remove comment

* fix merge

* payout hard reward (multiple)

Co-authored-by: karzak <kjydavis3@gmail.com>
2021-02-03 23:23:53 +01:00
Kevin Davis
6118876074
[R4R] fix: match reward payouts to current harvest v1 payouts (#786)
* fix: payout rewards on 1st or 15th of month

* backport payout test

* fix: add default case
2021-02-02 15:10:32 -07:00
Denali Marsh
9b52154409
Accrue Hard module rewards in multiple coin denoms (#785)
* types: multiple rewards

* supply-side reward keeper methods

* remove legacy comments

* update hard claim reward to coins type

* borrow-side reward keeper methods

* update claim payout to sdk.Coins

* make tests compile

* fix genesis validation for compile

* comment out failing tests

* fix ! found logic
2021-02-02 09:17:46 -07:00
Denali Marsh
3a08fc582b
Incentive PR 4: claim Hard rewards via the Incentive module (#780)
* claim hard reward keeper methods

* test hard claim payout

* claim hard rewards via cli

* query hard claims via cli

* rest txs and queries

* add handler test

* add claim type event field
2021-01-26 12:52:34 +01: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
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
Kevin Davis
7292b8843a
[R4R] feat: add variable length lockups for incentive rewards (#655)
* fix: update params in spec to match implementation

* feat: add variable length lockups for incentive rewards

* fix typos

* update spec

* address review comments

* feat: improve claim test
2020-09-21 16:20:11 -04:00
Kevin Davis
c0006ca8eb
Update reward vesting length calculation (#624)
* use remaining length when sending coins to vesting account

* query claims that have corresponding claim periods

* cleanup comments

* remove debugging statements

* fix bug with inserting period in middle of vesting schedule

* apply review suggestion
2020-08-26 20:34:55 -04:00
Federico Kunze
fe72a24aa0
update format 2020-04-30 10:23:41 -04:00
Federico Kunze
8853e8d3d1
linters and format 2020-04-30 10:13:31 -04:00
Kevin Davis
e9a73b80ce
Incentives tests (#429)
* USDX Incentives tests (#429)

Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: John Maheswaran <jmaheswaran@users.noreply.github.com>
Co-authored-by: John Maheswaran <john@kava.io>
2020-04-24 11:44:44 -04:00