Commit Graph

105 Commits

Author SHA1 Message Date
Kevin Davis
37be34b4d6
fix: replace is zero time check (#787) 2021-02-02 14:42:51 -07: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
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
Nick DeLuca
13c8d4e3fd
cdp withdraw takes 3 args (#696) 2020-10-19 10:57:42 -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
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
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
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
a53fbc354a
fix: enforce cdp denom matches collateral type (#638) 2020-08-27 07:21:35 -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
Nick DeLuca
86c0225174
encapsulate total principle calculation within cdp type and use (#610)
throughout codebase
2020-07-10 08:16:05 -05: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
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
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
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
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
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
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
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
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
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
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
6b478a0f95 minor refactor 2020-05-12 00:57:48 +01:00
Kevin Davis
89b63a3cba fix: simplify collateral auction logic 2020-05-11 18:35:16 -04:00
rhuairahrighairigh
7c477eb75d add cdp math fix and debugging 2020-05-11 20:48:42 +01:00
Kevin Davis
db7aaef98d cleanup cdp events 2020-05-07 17:35:42 -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
1a04ffe396
fix some lint bugs 2020-04-30 11:33:10 -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
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