Commit Graph

773 Commits

Author SHA1 Message Date
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
Kevin Davis
068e12380e
Update README.md 2020-12-07 17:53:52 -07: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
Kevin Davis
9472c09b91
patch keys parse command (#700) 2020-11-13 17:29:30 -05: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
Ruaridh
36a32d7962
Automate docker build and upload (#703)
* add basic master builds

* fix branch name

* tidy up

* update to work from master
2020-10-30 18:38:30 +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
e333fe8c40
update readme for kava-4 (#693) 2020-10-16 15:42:44 -04:00
Kevin Davis
9654f9d086
fix: set from address in cli context (#695) 2020-10-16 15:42:09 -04:00
Nick DeLuca
6a0cc6c49d
swagger: fix bep3 supply query typo (#694) 2020-10-16 12:27:47 -04:00
Nick DeLuca
dfb3b89c56
update url and add pagination parameters to harvest deposits and claims (#692)
endpoints
2020-10-16 10:40:36 -04:00
Denali Marsh
20280c7247
update swagger (#690) 2020-10-16 10:10:58 -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
9a389e0a0f
update binance/staking -> binance/earn (#688) 2020-10-13 10:51:58 -04:00
Denali Marsh
5fdf23a2ba
fix claim query: owner && depositType (#687) 2020-10-13 10:37:46 -04:00
karzak
69eacdddb0 add v0.11.0 commit hash to migration doc 2020-10-12 13:20:22 -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