Commit Graph

656 Commits

Author SHA1 Message Date
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
Denali Marsh
802ed36846
remove auction size param (#815) 2021-02-10 07:59:23 -07:00
Denali Marsh
7f43e6336e
permissioned incentive claims (#814) 2021-02-10 07:58:05 -07:00
Kevin Davis
bc1fab7836
fix: renumber error messages (#812) 2021-02-10 07:57:28 -07:00
Kevin Davis
e351e20727
fix: collateral param permission (#813) 2021-02-10 07:57:02 -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
Kevin Davis
58db05f8e2
fix: set reward indexes in init genesis and zero them out on export genesis (#807) 2021-02-08 17:32:54 -07:00
Kevin Davis
e9eb5ea20c
genesis updates for incentive migration (#806) 2021-02-08 13:47:29 -07:00
Kevin Davis
176c1973d3
fix: valid default genesis state (#805) 2021-02-08 08:00:37 -07:00
Denali Marsh
44d4d19565
fix incentive rewards query REST res (#802) 2021-02-08 07:14:25 -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
Kevin Davis
3d6e730368
address issues from audit (#793) 2021-02-04 11:35:24 -07: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
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
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
cfb9e0cb76
add liquidate msg to codec (#792) 2021-02-03 23:22:51 +01:00
Kevin Davis
dd3470260d
add v0.13 legacy types for kava-5 (#784) 2021-02-02 15:10:57 -07: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
Kevin Davis
37be34b4d6
fix: replace is zero time check (#787) 2021-02-02 14:42:51 -07:00
Kevin Davis
71f60ec4d9
fix: update synchronize claim method (#789) 2021-02-02 14:42:01 -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
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
b5e02fde35
Hard incentive reward querier updates for acceptance (#782)
* simulate hard reward sync for querier

* test hard sync simulations

* simulate usdx minting sync for querier

* test usdx minting reward simulation
2021-01-29 13:32:07 -07:00
Denali Marsh
92a2425668
Query rewards via incentive module (#781)
* query rewards types

* query rewards keeper

* query rewards cli/rest

* query rewards alias

* implement branched query

* mirror changes in rest querier

* clean up rest querier
2021-01-27 14:33:36 +01: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
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
Kevin Davis
4eef80b47f
[R4R] CDP module migrations from v0.11 -> v0.13 (#769)
* remove references to savings rate

* removing savings rate module account in auth migration

* use compact json

* fix non-determinism is cdp migration
2021-01-21 10:37:35 -07:00
Kevin Davis
92afaf6ca0
add query for all current prices (#768) 2021-01-21 10:36:51 -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
Kevin Davis
67b58f555b
[R4R] fix: validate usdx minting collaterals in incentive genesis (#770)
* fix: validate that usdx incentive collateral types are found in cdp params

* update app initialization and tests
2021-01-19 22:42:50 -07: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
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
a0d70e1c81
fix example cli liquidate cmd (#760) 2021-01-11 13:50:00 -07: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
Denali Marsh
f140d7aff6
update naming conventions (#745) 2020-12-21 18:07:02 +01:00
Kevin Davis
06fd215de1
[hard] Update deposit type to use sdk.Coins (#744)
* update deposits to use sdk.Coins

* update tests

* update liquidation tests
2020-12-18 09:05:21 -07:00
Denali Marsh
83a5f51c11
Hard: automatic liquidation by LTV index (#743)
* hotfix

* update params, keys

* liquidation by keeper

* refactor GetPendingBorrowBalance

* fix app build

* elegant handling of denom arrays

* auction deposit in lots

* add error msg

* update tests with new params

* happy path liquidation test

* update liquidator macc name

* refactor reward % to money market params

* refactor tests for updated params

* compile: harvest liquidator module account

* add liquidate msg

* liquidation approach

* update liquidations

* return remaining deposit coins to original borrowr

* check keeper reward before sending

* introduce ValuationMap

* convert Ints <> Decs

* implement double-loop

* ModuleAccountName

* sort keys for deterministic auctions

* test: correct auctions created

* test: preset keeper coins

* ensure deterministic iteration

* test cases

* update repay test

* auction fixes, tests

* LTV index

* user actions sync interest and update ltv index

* tests: all deposits must have money markets

* reorder borrow logic

* ltv index liquidation logic

* test specific items in ltv index

* index liquidation tests

* update repay to spendable coins

* revisions

* remove address sort method

* merge master test package
2020-12-18 02:12:48 +01:00
Denali Marsh
6c0890d5ff
Hard: introduce LTV index (#742)
* hotfix

* update params, keys

* liquidation by keeper

* refactor GetPendingBorrowBalance

* fix app build

* elegant handling of denom arrays

* auction deposit in lots

* add error msg

* update tests with new params

* happy path liquidation test

* update liquidator macc name

* refactor reward % to money market params

* refactor tests for updated params

* compile: harvest liquidator module account

* add liquidate msg

* liquidation approach

* update liquidations

* return remaining deposit coins to original borrowr

* check keeper reward before sending

* introduce ValuationMap

* convert Ints <> Decs

* implement double-loop

* ModuleAccountName

* sort keys for deterministic auctions

* test: correct auctions created

* test: preset keeper coins

* ensure deterministic iteration

* test cases

* update repay test

* auction fixes, tests

* LTV index

* user actions sync interest and update ltv index

* tests: all deposits must have money markets

* reorder borrow logic

* check mm before setting borrow index

* insert into LTV index even when LTV is 0
2020-12-16 22:08:29 +01:00
Denali Marsh
89f07e92b4
Hard: liquidation by keeper (#731)
* hotfix

* update params, keys

* liquidation by keeper

* refactor GetPendingBorrowBalance

* fix app build

* elegant handling of denom arrays

* auction deposit in lots

* add error msg

* update tests with new params

* happy path liquidation test

* update liquidator macc name

* refactor reward % to money market params

* refactor tests for updated params

* compile: harvest liquidator module account

* add liquidate msg

* liquidation approach

* update liquidations

* return remaining deposit coins to original borrowr

* check keeper reward before sending

* introduce ValuationMap

* convert Ints <> Decs

* implement double-loop

* ModuleAccountName

* sort keys for deterministic auctions

* test: correct auctions created

* test: preset keeper coins

* ensure deterministic iteration

* test cases

* update repay test

* auction fixes, tests
2020-12-15 18:38:14 +01:00
Denali Marsh
2442d281ab
update ltv error msg (#733) 2020-12-08 14:28:01 +01:00
Denali Marsh
4e641c5212
Hard: repay borrowed coins (#725)
* add msg borrow test

* repay types

* register msg repay on codec

* repay keeper functionality

* repay cli

* repay keeper test

* Hard: repay insufficient balance error (#726)

* repay error: insufficient balance

* isolate coin type in error msg

* add multi-coin repay example

* CalculatePaymentAmount, repay > SyncBorrowInterest

* remove todo: index updated by sync

* update tests

* add back in test
2020-12-07 22:51:35 +01:00
Denali Marsh
4dd174ea85
query borrow balance (#732) 2020-12-04 20:04:05 +01:00
Denali Marsh
6aa97a8f75
hotfix (#730) 2020-12-04 15:35:26 +01:00
Kevin Davis
4c95227c1d
fix go 1.15 build warning (#729) 2020-12-03 16:07:47 -07:00
Kevin Davis
01311e77f6
Kd fix interest test (#728)
* fix: fix go 1.15 build

* fix: correct highest apy test
2020-12-03 16:05:56 -07:00
Denali Marsh
49d62dd076
Harvest: interest rate logic (#720)
* initial feature scaffolding

* implement interest keeper logic

* basic AccrueInterest

* accrue interest on borrow

* update borrow index formula

* update sample reserve factor

* move AccrueInterest to begin blocker

* refactor interest rate updates for accrue interest

* use interest rate model from store

* refactor begin blocker state machine

* add reserve factor to interest model params

* update comment

* store money market instead of interest rate models

* update test suite

* use BorrowedCoins store key

* update public functions and alias

* unit tests, keeper test scaffolding

* demo panic

* address revisions

* add 'normal no jump' test case

* spy = 1 + borrow rate

* update comment

* APYToSPY unit test

* per user borrow index list

* interest keeper test

* test: interest applied on successive borrows

* varied snapshot times

* test: multiple, varied snapshots

* address revisions

* add pending interest before validating new borrow

* update makefile

* address revisions

* fix test
2020-12-03 22:50:35 +01:00
Ruaridh
9c69ee2fbf
merge release v0.12.1 updates (#724)
* use kava antehandler

* add authenticated mempool decorator

* add get authorised address methods

* hook antehandler into app

* refactor address fetcher interface

* tidy up args to NewApp

* remove unused function

* tidy up after removing address fetcher interface

* read authorized addresses from config

* fix error message, and minor tidy

* update cosmos-sdk and tendermint

* clarify function name

* add flags for mempool options
2020-12-02 10:37:11 -07:00
Denali Marsh
e1ad9569a7
Harvest: interest rate model params (#719)
* add interest rate models to params

* move interest rate models to money market param

* add interest rate models to store

* update store interest rate models from params

* refactor money market init function, update tests

* use cmp package for optimized comparison

* implement equal function, remove gocmp dep

* delete unseen interest rate model param from store
2020-11-13 16:51:52 +01:00
Denali Marsh
fba4860331
Add custom HARD, USDX circulating supply endpoints (#718)
* HARD circulating supply query

* USDX circulating supply query

* add rest endpoints

* drop trailing newlines

* HARD, USDX total supply queries
2020-11-12 22:48:20 +01:00
Denali Marsh
df2c4271e4
Harvest: refactor deposit type to claim type (#716)
* status: refactor deposit type to claim type

* refactor all deposit types to claim types

* refactor msg withdraw

* update module errors

* refactor querier and rest

* update spec

* update tests

* update handler, alias

* refactor to IterateDepositsByDenom

* v0_12 legacy types

* fix build
2020-11-12 17:43:28 +01:00
Denali Marsh
510b7e7c04
Harvest: borrows limited by global asset borrow limit (#715)
* update MaximumLimit param to MaximumLimitUSD

* track total borrowed coins in the store

* implement total borrowed coins querier

* add maximum value usd check

* update test suite, add zero coins check

* add test case, update error msg

* max limit in native amount

* remove debug logging

* prepare for master rebase

* master rebase

* fix build
2020-11-12 16:50:54 +01:00
Denali Marsh
cfb1905ad3
Harvest: borrows capped by utilization (#714)
* wrap error borrow exceeds mod acc balance

* address revisions
2020-11-11 16:05:17 +01:00
Denali Marsh
e43fb9d030
no asset price in pricefeed (#713) 2020-11-11 09:57:14 +01:00
Denali Marsh
33cbe34991
Harvest: deposit multiple assets supplying multiple assets (#712)
* introduce local cache

* apply LTV for borrowable amount calculation

* add multiple previous borrow tests

* remove unused functions

* address revisions
2020-11-09 22:52:08 +01:00
Denali Marsh
3ea3148129
Harvest: multiple deposits (#711)
* test suite: dynamic pricefeed genesis

* multiple deposits

* improve borrow validation

* improve test, add multiple deposits test case

* add over limit multiple deposit test case

* explicit function names

* rename outdated variable
2020-11-05 18:36:49 +01:00
Denali Marsh
e9d04cd7c6
Harvest: borrows limited by LTV (#710)
* basic borrow types

* borrow keeper scaffolding

* borrow limits param

* integrate pricefeed keeper

* msg handling and querier

* borrow user validation

* update migration scripts for compile

* borrows querier, fixes

* add money market param

* add spot market ID to params, refactor pricefeed

* working bnb -> ukava borrows

* refactor to getAssetPrice

* conversion_factor param, refactor validateBorrow()

* address misc revisions

* remove validation code

* add borrow test

* update test params

* single borrow with sdk.Coins per user

* fix harvest test

* add borrow validation

* simplify borrow validation

* add test case

* master compatibility

* fix build

* refactor to calculateUSDValue()

* add maxLoanToValue to test
2020-11-03 10:46:08 +01:00
Denali Marsh
1442deb3dc
Harvest basic borrow functionality (#702)
* basic borrow types

* borrow keeper scaffolding

* borrow limits param

* integrate pricefeed keeper

* msg handling and querier

* borrow user validation

* update migration scripts for compile

* borrows querier, fixes

* add money market param

* add spot market ID to params, refactor pricefeed

* working bnb -> ukava borrows

* refactor to getAssetPrice

* conversion_factor param, refactor validateBorrow()

* address misc revisions

* remove validation code

* add borrow test

* update test params

* single borrow with sdk.Coins per user

* fix harvest test

* removed legacy commented out code

* address minor revisions
2020-10-30 10:59:47 +01:00
Ruaridh
35a82acbd0
Module account permissions fix (#701)
* initial draft

* fix log msg formatting

* fix mod account type

* sync permissions at a block time

* update the update time
2020-10-27 21:06:44 -04:00
Nick DeLuca
c02ce618da
return after writing error response when owner address is invalid (#699) 2020-10-20 13:18:12 -04:00
Ruaridh
fabeee93cc
add arg to usage message (#697) 2020-10-19 10:58:14 -04:00
Nick DeLuca
13c8d4e3fd
cdp withdraw takes 3 args (#696) 2020-10-19 10:57:42 -04:00
Kevin Davis
9654f9d086
fix: set from address in cli context (#695) 2020-10-16 15:42:09 -04:00
Paul Downing
74bbb6a0d7
update msg spec to match code (#691) 2020-10-14 14:50:43 -04:00
Denali Marsh
6e6ed69383
add name param to query (#689) 2020-10-14 10:34:31 -04:00
Denali Marsh
5fdf23a2ba
fix claim query: owner && depositType (#687) 2020-10-13 10:37:46 -04:00
Kevin Davis
a9c253c09f
[R4R] address harvest preliminary audit exhibits (#686)
* resolve KAV-01

* resolve KAV-02

* resolve KAV-03

* resolve KAV-04
2020-10-12 09:26:18 -04:00
Jay Namsayin
5764c710a6
typo fixes (#685)
* Update 01_concepts.md

* Update 03_messages.md

* Update 01_concepts.md
2020-10-11 22:34:07 -04:00
Kevin Davis
8d142458dd
fix: remove duplicat query logic (#684) 2020-10-09 09:28:18 -04:00
Kevin Davis
69512d508b
harvest-fix: check for status other than bonded, add staking tests (#677)
* fix: check for any status other than bonded

* Add harvest staking tests (#680)

* refactor config initialization

* refactor delegator rewards test, add tests

* fix share to token calculation, add unbonding test

* remove dead link

Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2020-10-05 17:44:17 -04:00
Ruaridh
e0771cc9e8
Incentive query fixes (#681)
* fix claims endpoint

* fix cli query claims
2020-10-05 15:11:55 -04:00
Kevin Davis
1a8a4b86e7
feat: add query for previous savings rate distribution time (#679) 2020-10-03 19:14:42 -04:00
Kevin Davis
04946493ae
kava-3 to kava-4 migration (#676)
* feat: kava-3 to kava-4 migration function

* update migrate command
2020-10-03 13:48:57 -04:00
Kevin Davis
d15e3a43dd
[R4R] fix: don't panic on expired auctions in init genesis (#668)
* fix: close expired auctions in init genesis

* fix: initialize variable

* remove expired auction invarient
2020-10-02 12:50:56 -04:00
Kevin Davis
8f69dcf960
Committee migration (#665)
* draft: kava-3 to kava-4 committee migrations

* migration: add busd, xrpb, btcb bep3 and cdp params to stability committee

* add new pricefeed markets to safety committee

* add harvest to committee
2020-10-01 15:22:26 -04:00
Kevin Davis
495898170c
Auth migration (#667)
* draft auth migration from kava-3 to kava-4

* add harvest module accounts to auth state

* check account state equality

* add supply reconciliation to auth migration

* add gov migration

* add exact json test (#674)

Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>

* fix: check err variable

* correct import path

* feat: add hard accounts

Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
2020-09-30 19:14:07 -04:00
Kevin Davis
ed7ce81e30
Harvest Migration (#672)
* add harvest to kava-4 migration

* add mainnet harvest incentive schedules

* fix: check for 0 lockup instead of assuming small in always 0
2020-09-30 19:07:30 -04:00
Kevin Davis
056f9c0cf0
Cdp migration (#663)
* draft kava-3 to kava-4 cdp migration

* fix: use starting cdp id from the old genesis state

* update auction size for xrp
2020-09-30 18:58:50 -04:00
Kevin Davis
c416423412
[R4R] harvest fixes (#673)
* fix: don't allow denoms other than hard for harvest rewards

* fix: parse cli flags correctly

* fix: convert duration to seconds before calculating time elapsed

* fix: don't distribute rewards before they start or after they end

* fix: return correct message type
2020-09-30 14:44:56 -04:00
Kevin Davis
993d36d05a
Incentive migration (#666)
* draft kava-3 to kava-4 incentive migration

* fix: use collateral type instead of denom

* add additional claim multiplier to incentives

* remove testdata file creation
2020-09-30 14:41:46 -04:00
Kevin Davis
d577711056
kava-3 to kava-4 pricefeed migration (#664) 2020-09-30 14:33:48 -04:00
Kevin Davis
8e01b0b3f4
fix (harvest-cli): parse correct arg index (#669) 2020-09-27 11:47:49 -04:00
Denali Marsh
5ce045f46f
rename hvt (#661) 2020-09-25 11:07:20 -04:00
Kevin Davis
2e250cc750
fix: use correct querier endpoint (#659) 2020-09-22 10:42:30 -04:00
Kevin Davis
fe38c4aa43
harvest v1 (#658)
* wip: and types and keeper methods

* add keeper tests

* add client

* add spec and events

* respond to review comments

* apply suggestions from review

* feat: add test for validator vesting case

* use int64 for multiplier type

* remove incentive changes
2020-09-21 17:08:43 -04: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
Denali Marsh
e2f515ba9e
Querier improvements: CDP and Auction priority 1 queries (#644)
* query auction by lot owner

* add SavingsRateDistributed to store

* v2cdps: filtered cdps query

* update v2cdps cli examples

* add savings rate dist counter to begin blocker

* implement savings rate dist cli query

* implement cdp REST queries

* minor auction CLI/REST updates

* fix auction querier bug

* update REST endpoint to 'cdps'

* update to savings-rate-dist

* update SavingsRateDistributed get/set

* update tests

* fix savings rate dist rounding errors

* 'collateralDenom' -> 'collateralType'

* refactor 'v2cdps' -> 'cdps', add ratio param

* fix augmented CDP type, msg string() method

* fix cdp querier test

* filter query results efficiently

* querier tests

* limit type iteration if owner defined

* improve savings rate dist genesis validation

* default sdk.Dec{} to sdk.ZeroDec in queries

* update condition logic for finding intersection

* fix cdp querier filtering

* Update kava-4 swagger (#653)

* add collateral_type, update cdp params

* savings rate, auctions, get cdps

* drop owner from AuctionResponse

* remove duplicate collateral denom

* update query paths with {collateral-type}
2020-09-16 20:45:10 -04:00
Kevin Davis
641d946ae7
[R4R] address potential panic in validator vesting (#645)
* emit event instead of panic on undelegation errors
2020-09-16 20:44:15 -04:00
Ruaridh
64aa61d285
Update to sdk v0.39.x (#625)
* fix cli tests
- add pruning config
- add the new build path

* bump sdk version, make changes to get kvd running

* add draft multi-tx test

* add multiple txs per block test

* remove unused file

* sync VV account json format with sdk account types

* add another jsons test

* refactor coin creation in tests

* add missed file

* update changelog
2020-09-16 15:16:14 -04:00
Kevin Davis
15a7dc610e
[R4R] feat: Fetch auctions from historical state (#649)
* feat: query old blocks for auctions

* fix: add next auction id to querier

* fix: set boolean when found

* fix: use correct query route and params

* apply suggestions from review comments
2020-09-16 14:58:11 -04:00
Kevin Davis
c249746bf3
[R4R] feat: payout liquid claims without creating vesting account (#651)
* feat: payout liquid claims without creating vesting account
2020-09-14 16:18:21 -04:00
Denali Marsh
8966329643
add example to cli cmd (#648) 2020-09-11 14:58:22 +02:00
Ruaridh
2ffb1edd1f
Simulation fixes (#527)
* fix go version in dockerfile

* mix frequently occuring errors

* add missed import

* fix minor validator vesting sim bug

* fix auction sim bug

* fix docker build

* add todo from sim failure

* tidy up dockerfile

* update docs, add dockerignore to speed up builds

* Update simulations/README.md

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

* add stack traces to logs for easier debugging

* replace root func with sdk version

Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2020-09-01 11:33:12 -04:00
Kevin Davis
f22139fcee
[R4R] return all claims for incentive queries (#642)
* feat: return all claims for incentive queries

* cleanup test comments

* add struct tags

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

Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2020-09-01 08:34:11 -04:00
Kevin Davis
dbb8f387f9
fix: use correct committee params (#640) 2020-08-30 10:47:07 -04:00
Kevin Davis
a53fbc354a
fix: enforce cdp denom matches collateral type (#638) 2020-08-27 07:21:35 -04:00
Kevin Davis
5fc85f10a6
Add rate limiting to bep3 assets (#623)
* feat: use only module account for bep3 txs

* wip: add time-based supply limits

* add tests and sims

* update genesis tests

* fix migration, committee tests

* update migrations

* fix: set previous block time in begin block

* update store decoder

* add additional bep3 params to committee

* revert incorrect rebase changes

* add migration test

* address review comments
2020-08-26 22:05:27 -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
Kevin Davis
fca16da84a
fix: return if supply limit hit in issuance sims (#635)
* fix: return if supply limit hit in issuance sims
2020-08-21 19:39:20 -04:00
Kevin Davis
b2eff063a8
fix: initialize issuance asset supplies at genesis (#634) 2020-08-21 19:24:31 -04:00
Kevin Davis
b356309d90
Add optional rate limits to issuance (#627)
* add rate-limiting and optional blocklists

* fix: check account is not nil

* add tests for rate-limiting

* update simulations

* fix typos

* remove unsued function arg
2020-08-21 18:56:20 -04:00
Kevin Davis
2a3192fa0e
fix: use collateral type in cdp simulations (#632) 2020-08-21 17:38:12 -04:00
Kevin Davis
daa1b2bb83
Add collateral type to cdp (#629)
* add collateral type field to cdp and collateral  param

* fix upstream tests

* fix simulations

* fix validation logic

* update incentive to use collateral type instead of denom

* use collateral type instead of denom in cdp

* remove unused code

* address review comments
2020-08-21 15:42:46 -04:00
Kevin Davis
e14466547d
Issuance module (#599)
* wip: issuance module

* add keeper and module methods

* add begin blocker

* add client

* update events

* add simulations

* ignore v0.8 migration tests for now

* ignore migration tests in ci

* add test suite

* update spec to match implementation details

* add unblock method

* address review comments

* fix typos
2020-08-17 13:09:02 -04:00
Kevin Davis
790753f156
BEP3: support multiple assets (#616)
* wip: refactor to allow multiple bep3 assets

* update tests

* sims: validate asset before claiming

* move asset supply to params

* update tests

* fix sims

* fix tests

* wip: add migration from v0.9 -> v0.10 bep3

* fix build and migration tests

* nit: rename file

* move asset supply out of params

* update committee tests

* fix sims

* address review comments

* address review comments

* address review comments
2020-08-17 11:06:59 -04:00
Kevin Davis
928ce5f064
initialize claim period ids if they don't exist (#620) 2020-07-29 13:06:14 -04:00
Kevin Davis
e9e038a2c4
fix: use correct recipient for bep3 tests (#613) 2020-07-21 17:48:31 -04:00
Ruaridh
9ae99ade27
fix bep3 calc-swapid address parsing (#611) 2020-07-21 16:23:40 -04:00
Nick DeLuca
86c0225174
encapsulate total principle calculation within cdp type and use (#610)
throughout codebase
2020-07-10 08:16:05 -05:00
Kevin Davis
f2643e40e2
bump tendermint and cosmos-sdk versions (#608) 2020-07-02 19:48:43 -04:00
Kevin Davis
79e9a2c67a
add bep3 patch activation date (#607) 2020-07-02 13:37:53 -04:00
Nick DeLuca
a68ef74b07
Query old blocks for proposals in CLI (#598)
* move file to query.go (we are adding functionality so specific name
doesn't fit anymore)

* Add tx search for proposals in cli query proposal

* add rest support, height support for rest api, and add go doc string

* add in deadline calculation

* update changelog

Co-authored-by: Kevin Davis <kjydavis3@gmail.com>
2020-06-29 19:39:35 -04:00
Kevin Davis
8001cbbfd7
Update asset supply when params change (#604)
* fix: check asset supply

* update begin blocker

* add activation height and tests

* fix: verify outgoing swap recipient

* validate recipient address for outgoing swaps

* update activation time

* remove unused files

Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
2020-06-29 17:38:26 -04:00
Ruaridh
b539820c88
Add raw params querier (#591)
* add raw-params cmd

* add querier test

* update changelog
2020-06-23 09:17:08 -04:00
Nick DeLuca
2ea75458ff
Update BEB3 CLI Client to Support JSON (#597)
* add initial augmented swaps to bring cli & rest api's under same schema

* use an array type

* update to not cause breaking changes in REST API -- don't embed swap
fields
2020-06-22 19:34:51 -04:00
Nick DeLuca
e81987c31f
Add QueryGetAccounts to CDP Client (#596)
* add module accounts command

* update get accounts query to return array of
module accounts instead of map of addresses

* update tests and add update swagger

Co-authored-by: Kevin Davis <kjydavis3@gmail.com>
2020-06-19 15:30:10 -04:00
Nick DeLuca
687c39be82
Update kvcli tx bep3 create -h with valid height span (#594)
* 360 is an invalid height, update to 270

* update changelog

* remove changelog entry so we don't overdo it and keep changelog clean
2020-06-18 19:54:06 -05:00
Nick DeLuca
70e8f95f02
Pricefeed price simulation refactor (#585)
* refactor price generation to use determistic sequence up to each block
height and reset for each simulation

* remove extra whitespace

* improve comment

* move PriceGenerator to simulation/types to keep logic clean
2020-06-17 21:03:47 -05:00
Kevin Davis
e913dc2ff0
Fix misleading comments from audit (#592)
* fix misleading or incorrect comments

* fix unnecessary variable declaration

* fix punctuation
2020-06-17 14:40:44 -04:00
Nick DeLuca
dda84c79ab
Add CLI Command to Query Kavadist Balance (#590)
* add command to view balance of kavadist module account

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-17 09:04:16 -04:00
Federico Kunze
bfb9f7e20a
cleanup begin/end block (#553)
* cleanup begin/end block

* update cdp BeginBlocker

* update dist mint

* fix tests

* typo

* add comment on CloseExpiredAuctions

* fix tests
2020-06-17 05:09:44 -04:00
Nick DeLuca
f0e73e4aa8
Refactor CreateAuctionsFromDeposit (#589)
* refactor CreateAuctionsFromDeposit to complete exhibits 7 & 8 by
removing auction slices and simplify usage of largest remainder method
2020-06-16 11:02:47 -04:00
Kevin Davis
db2b237e1d
[R4R] Restore supply endpoints (#586)
* feat: restore supply endpoints

* use complete circulating supply schedule

* standardize query path
2020-06-15 12:01:58 -04:00
Denali Marsh
3784b4971b
update bep3 docs for mainnet (#587)
* update bep3 docs for mainnet

* update make link-check
2020-06-15 04:37:28 -04:00
Kevin Davis
2eb6036f42
[R4R] Add client for kavadist module (#584)
* feat: add params query for kavadist
2020-06-12 15:45:07 -04:00
Nick DeLuca
3e63356c58
Cache redundant calculation in cdp RepayPrinciple (#569)
* fix exhibit 29 and remove redundant calcuation

* use better naming (totalPrincipal instead of totalDebt) and add comment
for future maintainers
2020-06-11 16:14:47 -04:00
Nick DeLuca
890411b685
fix exhibit 48 - error message should match if statement (#580) 2020-06-11 14:33:36 -05:00
Nick DeLuca
25abdd10b5
Remove some redunancy in RepayPrinciple (#577)
* fix exhibit 30 - remove redunant conversions in adding principle to fee
amount, and store debt denom in local var to avoid calling getter
several times

* add deleted comment back
2020-06-11 14:32:39 -05:00
Nick DeLuca
5ba2706d56
Optimize calculation in savings distribution (#573)
* fix exhibit 33 by storing remaining surplus

* simplify with sdk.MinInt - if statement logic & assignment is just
taking the minimum
2020-06-11 14:25:32 -05:00
Nick DeLuca
7ae76b8440
Auctions Clean Up - Fixes redenancy and legibility (#576)
* resolve exhibit 41 - move redundant assignment into if block and only
assign if value is false.  No need to assign true to already true value.

* fix exhibit 43 - use existing auctionID variable instead of GetID

* use improved name for auction type in case statemnt

* rename a to auction in PlaceBidSurplus for legibility (part of exhibit 44)

* rename a to auctions in PlaceForwardBidCollateral (part of exhibit 44)

* rename a to auction in PlaceReverseBigCollateral for legibility (part of exhibit 44)

* rename a to auction in PlaceBidDebt for legibility (part of exhibit 44)

* renmae rest of a to auction variables for legibility and resolve exhibit
44

* one missed rename and a typo fix
2020-06-11 14:23:58 -05:00
Nick DeLuca
2a446fe530
fix misleading logging (#572) 2020-06-10 12:10:55 -04:00
Nick DeLuca
3f043b90ac
Update GetTotalSurplus and GetTotalDebt to be consistent (#567)
* update GetTotalSurplus and GetTotalDebt code blocks to be consistent and
resolve feedback in exhibit 13

* spelling fix

* remove uneeded temp variables

* address PR feedback - use suite.Require() instead of default assertions
2020-06-10 10:18:13 -04:00
Nick DeLuca
44467569af
Fix Ineffectual if statements (#568)
* fix exhibits 19,20,28,32 ineffectual if statements

* Apply suggestions from code review

* Apply suggestions from code review

* Update x/cdp/keeper/cdp.go

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-06-09 07:07:58 -04:00
Denali Marsh
978efbcc49
Fix bep3 sims determinism (#555)
* fix bep3 sims

* remove newline
2020-06-05 14:24:08 -04:00
Federico Kunze
b2a4369d4e
ValidatorVestingAccount validation (#552) 2020-06-05 08:59:16 -04:00
Kevin Davis
5723001390
fix: populate collateral denoms once (#551) 2020-06-05 08:41:13 -04:00
Denali Marsh
a44068d08d
use collateral params from cdp state (#550) 2020-06-04 19:14:40 -07:00
Denali Marsh
ba3b353ee9
[R4R] add bep3 module param to committee (#547)
* update committee test

* update committee params

* update default deputy address to expected mainnet address

* spelling in comment

* fix bep3 sim values to 1

* bep3 sims:generate 32 length random number
2020-06-04 18:27:54 -07:00
Denali Marsh
09a75bd7c6
[R4R] optional bep3 config params (#546)
* add minAmount, maxAmount

* update kava-3 params for compile

* fix migration script

* update to mainnet params

* remove height span validation for incoming swaps

* update to sdk.Int, set lock to 220

* update lock range to [220, 270]

* update bep3 module docs

* update MsgClaim's ValidateBasic

* update test comments
2020-06-04 16:03:14 -07:00
Kevin Davis
c049aad495
Minor audit fixes (#540)
* use mod and quo to calculate how many auctions to start

* check both return values in getDenomPrefix

* split auctions using weighted buckets
2020-06-04 08:58:39 -04:00
Kevin Davis
aebb3093ff
fix: use sdk.Int when loading augmented cdp (#539) 2020-06-03 18:36:58 -04:00
Ruaridh
4a8b5696cb
v0.8 Migration Scripts (#518)
* initial sketch

* add module migrations

* add migrations for all accout types

* test account migration

* add tendermint migration and migrate cmd

* remove need for errors pkg dependency

* add bech32 decoding fork

* add suggested params and cmd to write them

* add basic upgrade instructions

* fix tests

* address some migration todos

* tidy contrib folder

* finalize params values

* align cdp init genesis with other modules

* add tendermint and distribution test
add custom distribution migration to patch bug

* add staking migration test

* add slashing, evidence tests, refactor auth tests

* add full migration test

* remove go-amino dependency from go.mod
also tidy up unused indirect dependencies

* address remaining TODOs

* remove commented out code from legacy types

* add spot/liquidation markets ids to kava-3 params

* Apply suggestions from code review

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* address code review suggestions

* add validate genesis to migrate test

* refactor add params func

* remove commented out code from old types

* fix add params

* add deputy address

* add tests using exported kava-2 state

* incorporate new cdp params from master

* update params from review

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

* add deputy account

* add committee permissions for new params

Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
2020-06-03 15:35:00 -04:00
Denali Marsh
2d7f5c4080
[R4R] Better docs (#541)
* update sidebar order

* update event backticks

* fix broken links

* fix spelling
2020-06-03 14:54:31 -04:00
Denali Marsh
706207c60f
add backticks to params in spec (#538) 2020-06-02 10:49:29 -04:00
Kevin Davis
5336ccc0c0
Add surplus and debt auction lot params (#531)
* wip: add lot size param for surplus and debt auctions

* update tests with new params

* update spec

* address review comments
2020-05-31 09:59:40 -04:00
Denali Marsh
2ea06e4c80
[R4R] Basic docs tidying (#534)
* fix bep3 spec title, cdp collateral params

* display mod readme first

* fix link test

* update license year
2020-05-29 15:53:57 -07:00
Alexander Bezobchuk
90681abcc9
Merge PR #532: Fix expiry parsing 2020-05-29 16:07:34 -04:00
Kevin Davis
eb3cb55fd0
Add incentive queries (#528)
* add incentive queries

* fix: add query route for claim periods

* address review comments
2020-05-28 10:57:22 -04:00
Federico Kunze
d130734c2e
x/incentive: genesis validation (#519)
* x/incentive: genesis validation

* validation funcs for arrays

* tests

* genesis tests

* rewards tests

* address @alexanderbez comments

* fix genesis incentive simulation
2020-05-28 10:26:08 -04:00
Denali Marsh
b2edeb8549
[R4R] Add flags to auction queries (#522)
* cli auction query flags

* update bep3 filter method name

* rest auction query flags

* add constants for auction type, phase

* fix test

* revisions
2020-05-24 19:27:11 -07:00
Alexander Bezobchuk
e7ceada952
REST Client Cleanup & Validation (#523)
* cleanup & from validation

* Add ValidateBasic calls

* Update x/incentive tx requests

* Address comments
2020-05-24 14:29:48 -04:00
Kevin Davis
aa54473309
fix struct tag (#525) 2020-05-24 09:46:22 -04:00
Kevin Davis
ade6edb918
[R4R] Add liquidation pricefeed (#524)
* add parameter for liquidation pricefeed
2020-05-24 09:42:46 -04:00
Federico Kunze
e3ce6a7c9f
x/auction: types validation (#500)
x/auction: types validation
2020-05-21 10:25:47 -04:00
Denali Marsh
67b89c2b9c
[R4R] Blacklist module accounts (#517)
* implement module account blacklist

* update cdp getModuleAccountCoins method
2020-05-21 00:50:12 -04:00
Kevin Davis
c556bd8c6c
fix: remove vesting client (#516) 2020-05-21 00:49:42 -04:00
Federico Kunze
ad7c08cfc3
x/pricefeed: GenesisState validation (#514)
* x/pricefeed: GenesisState validation
2020-05-21 00:49:27 -04:00
Denali Marsh
00508b61fe
Change !GTE to LT (#512) 2020-05-15 15:43:52 -07:00
Ruaridh
c28bc03248
Committtee audit revisions (#510)
* comments from review

Co-authored-by: Sunny Aggarwal <sunnya97@protonmail.ch>
Co-authored-by: jmahess <maheswaran@google.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>

* add vote methods

* add draft new param change permission

* add and update tests

* rename ParamChangePermission

* account for perms becoming invalid at a later time

* add debtParam to permission

* add bep3 AssetParam to permissions

* add pricefeed Markets to permission

* add upgrade permission

* move proposal passing to the begin blocker

* fix iteration bug

Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>

* address todos and audit comments

* add proposal examples

* refactor handler to be easier to read

* address review comments

* update comments

Co-authored-by: Kevin Davis <kjydavis3@gmail.com>
Co-authored-by: Sunny Aggarwal <sunnya97@protonmail.ch>
Co-authored-by: jmahess <maheswaran@google.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-05-15 15:25:49 -04:00
Federico Kunze
5069aebda7
minor fix 2020-05-15 12:49:54 -04:00
Federico Kunze
6a07def455
remove test case 2020-05-15 12:43:52 -04:00
Denali Marsh
dd1d248be2
[R4R] Add BnbDeputyFixedFee param to BEP3 module (#511)
* generate length 32 random bytes

* fix test

* implement BnbDeputyFixedFee param

* clean up for PR

* update deputy address

* remove impossible check

* move comment
2020-05-13 16:39:29 -07:00
Denali Marsh
fa8ae9647a
[R4R] Update secure RNG to generate bytes directly (#509)
* generate length 32 random bytes

* fix test
2020-05-13 16:38:34 -07:00
Federico Kunze
9932169a67
sim fixes 2020-05-13 12:05:55 -04:00
Kevin Davis
1099dfbd7d
CDP revisions (#508)
* address review comments

* add kavadist to modaccount check

* cdp and deposit validation in genesis

* cleanup genesis validation

* add validation test for types

* don't error on augmented cdp loading

* simplify collateral auction logic
2020-05-13 10:19:19 -04:00
Federico Kunze
907e93b7a8
fix conflicts 2020-05-13 09:38:38 -04:00
Federico Kunze
6dedc1520a
x/auction: audit revisions (#497)
Auction audit revisions
2020-05-13 09:31:36 -04:00
Federico Kunze
1a46b3fa2b
fix tests 2020-05-13 09:24:17 -04:00
Federico Kunze
3ee16963aa
Merge branch 'master' of github.com:Kava-Labs/kava into fedekunze/auction-validation 2020-05-13 09:14:47 -04:00
Federico Kunze
12fe0c60a3
x/bep3: fix swap validation (#507) 2020-05-13 08:41:54 -04:00
Kevin Davis
7f236d322d
[R4R] Update Swagger for testnet-6000 (#496)
* wip: update swagger for testnet-6000

* add remaining modules to swagger

* add committee api
2020-05-13 08:41:31 -04:00
Federico Kunze
2327b01ed4
message test 2020-05-12 16:37:08 -04:00
Federico Kunze
71742d2eef
auction tests 2020-05-12 16:32:18 -04:00
Denali Marsh
6c68e41758
[R4R] bep3 module audit revisions (#505)
* most audit revisions

* remove expected income

* update begin block spec

* filter queryAtomicSwaps, add queryAssetSupplies

* update old address

* update test

* Remove legacy method

* remove legacy comment

* address PR comments

* IsValid for SwapDirection, SwapStatus

* fix rng logging

* query asset supplies

* return [64]byte from rng

* remove cross chain field from MsgCreateAtomicSwap

* move swap filtering to querier

* rename Limit field to SupplyLimit
2020-05-12 13:15:38 -07:00
rhuairahrighairigh
f0c750cb4a remove cdp review comment 2020-05-12 01:10:57 +01:00
rhuairahrighairigh
a5d70d1424 Merge branch 'master' into ro-auction-audit-revisions 2020-05-12 01:09:32 +01:00
rhuairahrighairigh
bc1a6a68e0 bugfix 2020-05-12 01:06:32 +01:00
rhuairahrighairigh
6b478a0f95 minor refactor 2020-05-12 00:57:48 +01:00
Federico Kunze
e3aad2306b
other validations 2020-05-11 19:10:14 -04:00
Federico Kunze
32213ed56c
x/auction: types validation 2020-05-11 18:56:28 -04:00
Kevin Davis
89b63a3cba fix: simplify collateral auction logic 2020-05-11 18:35:16 -04:00
Ruaridh
d489bacfac
tidy payout function
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
2020-05-11 21:07:39 +01:00
rhuairahrighairigh
7c477eb75d add cdp math fix and debugging 2020-05-11 20:48:42 +01:00
rhuairahrighairigh
5987d966ef increase auction maths safety 2020-05-11 20:45:00 +01:00
Federico Kunze
04cb414593
x/bep3: genesis validation (#488)
* validate asset supply

* validate swap

* genesis tests

* swap and supply unit tests

* use Require() for suite

* fix tests

* Apply suggestions from code review


Co-authored-by: Denali Marsh <denali@kava.io>
2020-05-11 12:55:09 -04:00
rhuairahrighairigh
8899a7ff04 replace some errors with panics 2020-05-11 14:55:32 +01:00
rhuairahrighairigh
976f8f632d remove todo - leave to caller to deal with panic 2020-05-08 16:10:59 +01:00
rhuairahrighairigh
4039086e8d tidy up events 2020-05-08 16:07:11 +01:00
Kevin Davis
7129e7c95b use correct terminolgy in incentive spec 2020-05-07 19:41:14 -04:00
Kevin Davis
18b6a8ce25 remove extra newline 2020-05-07 17:52:21 -04:00
Kevin Davis
e60bf54b32 clean up validator vesting spec 2020-05-07 17:52:07 -04:00
Kevin Davis
db7aaef98d cleanup cdp events 2020-05-07 17:35:42 -04:00
Kevin Davis
fd8d48e208 add committee spec 2020-05-07 16:58:46 -04:00
Kevin Davis
deef10a872 add voter address to vote event 2020-05-07 16:58:39 -04:00
Kevin Davis
c1e9a87fb3 add incentive spec 2020-05-07 13:46:48 -04:00
Kevin Davis
a295b793a9 fix: emit relevent events for incentive 2020-05-07 13:46:40 -04:00
Kevin Davis
0c49f1b089 add kavadist spec 2020-05-07 13:45:32 -04:00
Kevin Davis
dc5614b241 fix: emit inflation as coin 2020-05-07 13:45:16 -04:00
Kevin Davis
70b0f02e6d fix: use correct abci method in pricefeed spec 2020-05-07 13:44:43 -04:00
Kevin Davis
178f74c1d8 fix: delete claim after user claims it 2020-05-07 13:43:36 -04:00
Kevin Davis
c6d287a5b3 feat: add pricefeed spec 2020-05-07 11:11:10 -04:00
Denali Marsh
8ef03e4181
[HOTFIX] Fix outgoing swaps in BEP3 sims (#490)
* check available asset supply on outgoing swaps

* switch maximum, current
2020-05-06 17:29:59 -07:00
Denali Marsh
611eff93cf
[R4R] Update bep3 module account permissions (#483)
* incoming swaps trigger acc registration

* move supply increment after recipient acc validation

* use expected keepers pattern

* remove expected keepers from alias

* update bep3 macc permissions

* clean supply keeper interface

* add module account check to genesis

* remove duplicated accountkeeper
2020-05-06 13:23:13 -07:00
Denali Marsh
7a904ddd6c
[R4R] Add outgoing swaps to bep3 sims (#484)
* incoming swaps trigger acc registration

* move supply increment after recipient acc validation

* use expected keepers pattern

* remove expected keepers from alias

* add outgoing swaps to sims
2020-05-06 12:30:27 -07:00
Denali Marsh
d56ad961c0
[R4R] Enable bep3 claim txs from new addresses (#482)
* incoming swaps trigger acc registration

* move supply increment after recipient acc validation

* use expected keepers pattern

* remove expected keepers from alias

* update comment
2020-05-06 10:56:43 -07:00
Ruaridh
23a5c7b969
Add committee simulations (#431)
* first pass at genesis and msgs

* add proposal generation

* add permission generation

* add decoder

* add invariants

* add committee change proposal generator

* improve committee change proposal generation

* fix error formatting

* update sims to v0.38

* Update x/committee/keeper/invariants.go

Co-Authored-By: Denali Marsh <denali@kava.io>

* Update x/committee/keeper/invariants.go

Co-Authored-By: Denali Marsh <denali@kava.io>

* tidy up comments

* tidy up random helpers

* add committee to ImportExport test

* add member check to vote invariant

* fix comment wording

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

Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
2020-05-04 17:17:20 -04:00
Jack Zampolin
f86d0f3c3b Add changes from code review 2020-05-04 10:52:36 -07:00
Kevin Davis
471565e360
fix: add new event manager to ctx in handlers (#485) 2020-05-02 18:52:49 -04:00
Kevin Davis
8f3858509a
fix: various errors from linter (#481) 2020-05-01 14:13:29 -04:00
Federico Kunze
511e1e07ac
fix conflicts from development 2020-04-30 17:12:22 -04:00
Kevin Davis
22bba81944
Check spendable balance in cdp sims (#480)
* fix: check spendable balance

* don't log noisy result.Log

* remove dead comment
2020-04-30 17:02:42 -04:00
Federico Kunze
d8bbde78cc
build 2020-04-30 12:15:40 -04:00
Federico Kunze
1a04ffe396
fix some lint bugs 2020-04-30 11:33:10 -04:00
Federico Kunze
9743f356be
Merge branch 'master' of github.com:Kava-Labs/kava into linters 2020-04-30 10:31:20 -04:00
Kevin Davis
22315cc3ca
add committee to sims (#479)
* fix: update test for cdp breaking changes

* fix: add committee to sims
2020-04-30 10:27:37 -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
Federico Kunze
e9c16fa752
x/committee: committee gov module
Committee Gov Module
2020-04-30 09:16:33 -04:00
Kevin Davis
3cc2cc99b8
fix: enforce sorting of cdp ids when storing (#475) 2020-04-29 18:02:31 -04:00
Kevin Davis
c175e9e856
Add kava modules to TestAppImportExport (#472)
* add kava modules to TestAppImportExport
2020-04-29 10:10:41 -04:00
rhuairahrighairigh
e1cb079589 remove alias comment from godoc 2020-04-28 16:36:06 +01:00
rhuairahrighairigh
ffbeced199 apply various pr suggestions 2020-04-28 01:51:53 +01:00
rhuairahrighairigh
d1c0dd18b1 only import types pkgs within types 2020-04-28 01:28:00 +01:00
rhuairahrighairigh
307ecd54e2 remove unecessary codec tests 2020-04-28 01:26:48 +01:00
rhuairahrighairigh
447e7579a8 tidy up codec type registrations 2020-04-28 01:26:00 +01:00
rhuairahrighairigh
073cd7ebda update module to v0.38 2020-04-27 19:19:05 +01:00