Commit Graph

18 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Denali Marsh
5ce045f46f
rename hvt (#661) 2020-09-25 11:07:20 -04:00