Commit Graph

1185 Commits

Author SHA1 Message Date
Derrick Lee
f52a581ea9
Add GetSynchronizedClaim and swap adapter (#1386)
* Add source adapters to keeper, implement GetSynchronizedClaim

* Iterate acc shares sorted

* Add swap adapter, update tests to use swap claimtype

* Add swap adapter test

* Add tests for non-empty pools

* Iterate over source ids instead of sorted keys
2022-11-14 17:55:10 -08:00
Derrick Lee
c2061f626e
Add Initialize/Synchronize Claim methods (#1383)
* Add init/sync claim methods

* Add todo

* Make GetSynchronizedClaim method todo

* Remove GetSynchronizedClaim

Work moved to different task

* Update GetRewardIndexesOfClaimType method
2022-11-10 11:05:11 -08:00
Reece Williams
4b6f1e6b57
Upgrade IBC to v3.4.0 (Adds memo support to fungible token transfers) (#1387) 2022-11-09 11:57:03 -07:00
Levi Schoen
ca9b6d084a bundle internal testnet genesis for use in ci pipeline 2022-11-08 14:14:38 -08:00
Robert Pirtle
fcfcd36740
add total supply queries for earn, savings, liquid (#1384)
* add total supply endpoint to x/liquid

* add test of x/liquid total supply query

* refactor x/savings test

* add total supply endpoint for x/savings (w/ test)

* add total supply endpoint for x/earn

* handle converting bkava to underlying staked amount

* aggregate bkava underlying values in x/earn

* aggregate underlying value of bkava in x/savings
2022-11-08 12:43:26 -05:00
Ruaridh
2abb2ce606
Add source adapter interface definition (#1377)
* add source adapter interface definition

* add more context to method names

* return a map to reduce chance of wrong order
2022-11-07 22:07:19 +00:00
Derrick Lee
4a3002b09c
Add incentive RewardIndexes types and state methods (#1381)
* Add TypedRewardIndexes type

* Add RewardIndexes to genesis

* Update iteration method names, GetKeyFromSourceID method
2022-11-04 17:08:51 -07:00
Derrick Lee
df1c2ffc34
Add AccrualTime type and state methods (#1379)
* Add methods for reward accrual time

* Add accrual time methods

* Add claim type to IterateAllRewardAccrualTimes callback method

* Use new AccrualTime proto type for state methods, add to genesis

* Add GetAllRewardAccrualTimes doc

* Add accrual times to genesis methods

* Remove DecodeKeyPrefix

* Update acrual time iterate method naming

* Update Iterate claims naming

* Use method for sourceID key conversion
2022-11-04 16:21:05 -07:00
Robert Pirtle
4087941691
remove all yaml tags from proto definitions (#1382)
the yaml tags are not needed as they are generated automatically from the
json tags.

additionally fixed proto formatting error requiring doc comments on enum
values (for x/incentive claim type enum).
2022-11-03 14:49:53 -04:00
Draco
583711789d
update evmutil specs (#1356) 2022-11-03 08:16:16 -07:00
Ruaridh
07661b17f9
Update readme for kava 11 (#1374)
* remove old tagline

* update install instructions to point to docs
2022-11-03 08:15:45 -07:00
Nick DeLuca
6a12f2a9c9
Update to IAVL v0.19.4 to fix panic on fastnode flag switch (#1380)
Fixes a panic with fast node is switched off
2022-11-03 08:12:41 -07:00
Ruslan Akhtariev
99b20342d5
Update to IBC 3.3.1, Cosmos SDK 0.45.10, and Tendermint 0.34.22 (#1373)
Co-authored-by: Ruslan Akhtariev <ruslanakhtariev@Ruslans-MacBook-Air.local>
2022-11-02 15:59:55 -07:00
Robert Pirtle
05fcdafe98
Document kavadist infra rewards in the module spec (#1369) 2022-11-02 13:26:41 -04:00
Derrick Lee
90735e29ed
Add incentive claim state methods (#1375)
* Add Claim proto types

* Add new claim keys

* Add claim state method tests

* Add claims to genesis

* Re-add GetType for USDX claim

* Add doc comments to key methods

* Add Claim validate test

* Update claimType to BigEndian binary encoding
2022-11-02 08:34:33 -07:00
Derrick Lee
45fc1a7643
Add generic Claim type (#1371) 2022-10-27 17:45:32 -07:00
Nick DeLuca
96279b66bc
update ethermint for account type fix (#1368)
Port of ethermint side fix from #1367
2022-10-24 19:39:50 -07:00
Ruaridh
c3a85c869a
install gen-doc (go 1.18 disables go get installs) (#1364) 2022-10-24 13:24:32 -07:00
Nick DeLuca
5110fea008
Update Protos (#1362)
* Update third party protos for tendermint, cosmos updates

* fix proto gen scripts for go 1.18

* update ibc go swagger for v3.3.0

* update generated files

* update swagger

* update grpc and protobuf deps
2022-10-24 11:06:39 -07:00
Nick DeLuca
52fc29952e
remove legacy committee migration (#1360)
Co-authored-by: Draco <draco@dracoli.com>
2022-10-21 13:02:55 -07:00
Nick DeLuca
f1c37725cc
kavadist - ensure that fund module account exists on init genesis (#1361)
Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
Co-authored-by: drklee3 <derrick@dlee.dev>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
2022-10-21 13:02:32 -07:00
Nick DeLuca
df5861e7ab
bump ibc to v3.3.0 -- fix for base denoms with slashes (#1358) 2022-10-20 14:39:07 -07:00
Derrick Lee
73bc32a183
Add incentive earn tests with real keepers (#1354)
* Update incentive test to use beginblocker instead manual accumulation

* Update integration test suite

* Add base integration test, wip staking reward calculation

* Get actual staking reward amounts from BeginBlocker events, calculate expected indexes

* Simplify event parsing

* Add initial earn accum test with real keepers

* Add the rest of the accum integration tests with real keepers

* Check if delegation rewards are zero before transferring

* Update staking integration test to use updated methods
2022-10-19 16:13:37 -07:00
Ruaridh
17b6b74d75
Add tally handler tests (#1349)
* add vote power counting tests and test suite

* add vote outcome tests
2022-10-19 12:26:14 -07:00
Nick DeLuca
0c0cd49cb5
Update to cosmos 0.45.9 (#1355)
* Update to cosmos 0.45.9, tendermint 0.34.21, iavl 0.19.3 and include
dragonberry isc20 replace

* update ci & docker to go 1.18

* config updates for iavl changes and broadcast mode flag

* ensure fast node is disable if config value is not set in order to
avoid fast node upgrade for nodes that do not update their app.toml

* update to new circle ci image instead of using legacy image

* fix cosmos-sdk tag

* update cosmos-sdk to fix breaking WithdrawDelegationRewards regression
2022-10-19 11:11:17 -07:00
Derrick Lee
e8242ace80
fix: Use correct share values for earn incentive hooks (#1347)
* Call earn hooks with correct share values

User's shares instead of total vault shares

* Use different amounts for different accounts

* Add claim test with staking claims

* Remove logging statements

* Remove log

* Pass suite.T() to mock earn hooks

* Use begin blocker for staking reward distribution

* Remove unused beginblocker

* Remove log
2022-10-12 14:35:09 -07:00
Derrick Lee
aa2fedaf78
Only return bkava tokens when value_in_staked_tokens is true (#1348) 2022-10-11 14:38:49 -07:00
Nick DeLuca
7847f3ee7b
Tally Handler Fixes (#1342)
* reassign after addition since values are not modified in place

* fix incorrect logic; add bkava when there is no error
2022-10-08 20:37:36 -06:00
Derrick Lee
e6fc0135aa
Fix /incentive/apy pricefeed denom conversion (#1340)
* Update APYs endpoint to correctly rewrite incentive denoms to pricefeed ids

* Wrap pricefeed err
2022-10-08 02:35:15 +01:00
Ruaridh
a39c413a82
Add Vested Delegated API endpoint (#1327)
* add empty grpc endpoint

* add basic implementation

* remove unbonding from returned balance

* fix test typo

* resolve todo, use better method from staking mod
2022-10-05 15:56:39 -07:00
Nick DeLuca
55284aa575
Fix high gas usage for coin conversions (#1331)
* use an infinite gas meter during evm call operations, then consume
evm reported gas used

* consume gas after failure check -- provide best feedback first
2022-10-05 16:27:06 -06:00
Derrick Lee
be7242d86d
Add /incentive/apy query endpoint (#1328)
* Add /incentive/apy query endpoint

* Add APY calculation using usd value

* Fix maths for adding bkava incentive rewards

Signed-off-by: drklee3 <derrick@dlee.dev>

* Fix apy calculation with community tax, remove infra tax

* Fix pricefeed market mismatches, fix division by zero

* Remove unused kavadist expected keeper

Signed-off-by: drklee3 <derrick@dlee.dev>
2022-10-05 11:39:50 -07:00
Derrick Lee
4c879bc4fb
Add Earn deposits value_in_staked_tokens query parameter (#1325)
* Add earn deposits query param to return individual vaults value as ukava

* Add value_in_staked_tokens param handler to specific vault query

* Use separate ukava coins when querying deposits in ukava

Avoid usd of sdk.Coins.Add() as those will aggregate ukava amounts
2022-10-03 16:37:29 -07:00
Ruaridh
c773d874ae
Disable savings incentives (#1320)
* allow nil hooks by using keeper methods

* disable calls to incentive from savings

* disable claim msg to prevent calls to sync claim
2022-09-29 21:18:06 +01:00
Derrick Lee
6626915ca8
Return empty coins instead of error when query x/hard total supplied and total borrowed (#1319) 2022-09-29 13:28:10 -06:00
Kevin Davis
b0932f7062
Implement infrastructure proposal (#1306)
* update params

* stub out methods

* delete legacy migration test

* feat: add infrastructure inflation and payouts

* fix: load same module account blocked addrs in kavadist as app

* fix: testing edge case where period starts and ends same block

* fix: add store key for infra params, update newparams function

* fix: testing edge case where period starts and ends in same block

* add test for basic infra minting

* add test for stand-alone core, partner rewards

* fix: set time elapsed in each case

* add e2e test for infra rewards

* fix: use standard method for naming infra params key
2022-09-29 13:27:40 -06:00
Kevin Davis
ef874f9913
feat: add proposals for community pool deposits/withdrawals (#1304)
* feat: community pool deposit/withdraw proposals

* fix: check community pool balance in tests

* add new msg type definitions

* add msg methods and tests

* add module and keeper skeleton

* add deposit and withdraw methods (no delegation)

* untested depsit/withdraw with delegation methods

* add cli cmds

* fix cli argument parsing

* add tests for delegate/undelegate msgs

* emit un/delegate events

* add godoc comments

* tally handler with liquid staking support

* clean up

* update for liquid keeper changes

* Exclude non-bkava denoms from aggregate underlying ukava calculation

* wip Add claim

* Add distr keeper and claiming

* Add claim test

* Update claim test with failures

* wip Add staking rewards

* -S

Fix savings to earn incentive methods

* Use a single accural time for all earn incentives

* Add additional required liquid methods

* Update genesis to only include 1 accrual time for earn

* Revert "Update genesis to only include 1 accrual time for earn"

This reverts commit cc7e35347298681c0c8a4a0b9bf9b9b296c25531.

* Revert "Use a single accural time for all earn incentives"

This reverts commit aeb49c4622d4e3d99dc6421c8830932b1b546be9.

* Update tests with incentive distribution

* Add earn to incentive rewards query

* add earn cli tx

* Update claim example to use ukava large

* add proposal to gov router

* fix example tx formating

* add proposal handlers to gov app module

* fix: define gov router after earn keeper

* fix: correct proposal type

* remove outdated comment

* refactor withdraw so that fee pool is allows adjusted by the actual withdraw amount

* fix: lint proto file

* use non blocked module account instead of dist acc

* add fund mod account to app, enable receiving

* update to new withdraw interface

* add human readable apy test cases

* remove duplicate changes from previous merge

* remove deprecated io/ioutil package

* standardize proposal type as a pointer
(also matches sdk)

* minior comments and formatting

* use withdraw amount in router msgs

Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
Co-authored-by: Draco <draco@dracoli.com>
Co-authored-by: drklee3 <derrick@dlee.dev>
Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2022-09-29 18:01:06 +01:00
Derrick Lee
6ef9bab67d
Add liquid staking reward redistribution via incentive (#1308)
* wip Add claim

* Add distr keeper and claiming

* Add claim test

* Update claim test with failures

* wip Add staking rewards

* -S

Fix savings to earn incentive methods

* Use a single accural time for all earn incentives

* Add additional required liquid methods

* Update genesis to only include 1 accrual time for earn

* Revert "Update genesis to only include 1 accrual time for earn"

This reverts commit cc7e35347298681c0c8a4a0b9bf9b9b296c25531.

* Revert "Use a single accural time for all earn incentives"

This reverts commit aeb49c4622d4e3d99dc6421c8830932b1b546be9.

* Update tests with incentive distribution

* Add earn to incentive rewards query

* add earn cli tx

* Update claim example to use ukava large

* Use underlying ukava to determine proportional reward amount

* Rename liquid methods to reflect derivative value

* Add tests for derivative values

* Return error to panic in BeginBlocker

Co-authored-by: karzak <kjydavis3@gmail.com>
2022-09-28 13:20:01 -07:00
Derrick Lee
ac96bb9c18
Revert per-module incentive claim denom multipliers (#1312)
* Revert "Support per-module incentive claim denom multipliers (#1300)"

This reverts commit c20c954917.

* Re-add validate error
2022-09-27 19:46:14 -07:00
Ruaridh
9519690324
Add Combined Earn and Liquid msgs (#1305)
* add new msg type definitions

* add msg methods and tests

* add module and keeper skeleton

* add deposit and withdraw methods (no delegation)

* untested depsit/withdraw with delegation methods

* add cli cmds

* fix cli argument parsing

* add tests for delegate/undelegate msgs

* emit un/delegate events

* add godoc comments
2022-09-28 03:28:57 +01:00
Draco
314f733cb8
Tally handler with liquid staking support (#1307)
* tally handler with liquid staking support

* clean up

* update for liquid keeper changes

* switch to tagged cosmos-sdk for tallying updates

Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
2022-09-27 11:49:50 -04:00
Derrick Lee
b68685af32
Exclude non-bkava denoms from aggregate underlying ukava calculation (#1311) 2022-09-25 15:26:46 -07:00
Derrick Lee
c20c954917
Support per-module incentive claim denom multipliers (#1300)
* Add module name to multiplier

* Add claim test to use correct multiplier

* Add separate test for GetMultiplierByDenom

* Add 0 length lockup for earn to params test

* Add additional tests for genesis and params
2022-09-23 09:53:26 -07:00
Derrick Lee
50fdebe657
Add liquid bkava support to savings (#1309)
* Add savings support for bkava deposits

* Update savings tests with valid validator

* Add invalid bkava deposit test

* Remove test logs

* Add bkava withdraw test
2022-09-23 09:38:45 -07:00
Derrick Lee
651de460ca
Add weighted bkava support for earn incentives (#1299)
* Add bkava handler for earn incentives

* Add bkava accum tests

* Add bkava denoms in index state

* Set storeTimeEquals to default value

* Add supply expected keepers

* Add tests for proportional adjustment

* Add liquid keeper to incentive keeper

* Use weighted reward periods for bkava

* Add liquid keeper to tests

* Add Accumulate override rewards period with deccoins

* Adjust test to handle sub unit coins

* Add liquid keeper to test

* Fix div by zero for proportional rewards

* Update test for actual expected values

* Update expected indexes to be same for different vaults

* Allow no stored time for vaults that have no indexes or state

* Add test for partial bkava deposit

* Add math check to test

* Deterministically iterate over bkava denoms

* Remove unused expected liquid method GetAllDerivativeDenoms
2022-09-23 09:38:22 -07:00
Derrick Lee
26a4b93588
Add base earn incentives (#1292)
* Add incentive types

* Add earn state methods

* Update earn incentives

* Update unit test NewKeeper to include earn keeper

* Fix sharesOwned typo

* Shares not used for AfterVaultDepositCreated

* Add earn to init genesis

* Pass earn keeper to incentive keeper

* Add sdk.Msg impl, disable legacy migrations

* Disable migrations

* Update incentive earn sync test

* Add earn to client and querier

* Add accum and init tests

* Add additional earn tests

* Fill in fakeEarnKeeper methods to fix tests

* Add earn reward periods to params, begin blocker earn reward

* Add earn to query

* Update genesis_test with missing DefaultMultiRewardPeriods parameter

* Remove disable of migration package

* Fix proto type comments

* Remove unused migration state

* Add legacytx.LegacyMsg compile time interface check

* add earn state validation to genesis validation

Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
2022-09-22 11:26:08 -07:00
Derrick Lee
9fb64b1f11
Add specific /vaults/bkava and /deposits query handler to get aggregated bkava amounts (#1293)
* Use custom aggregate handler for querying 'bkava' vault

* Add 3rd bkava vault

* Add special kava deposit handlers

* Separate bkava logic to parent deposits handler

* Rename single vault/account queries

* Remove all deposits queries

* Include empty vaults in /vaults query

* Respond with empty values when querying account deposits with no deposits

* return ukava value in bkava vault queries

* remove refernce to specific staked token denom

* return ukava value in bkava deposit queries

Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
2022-09-20 19:52:40 +01:00
Derrick Lee
ed116b24ba
Add derivative denom and kava value methods to liquid (#1303)
* Add IsDerivativeDenom and GetKavaForDerivatives methods to liquid

* Add test case containing 2 different bkava denoms

* Add doc to GetKavaForDerivatives

* Remove logging statements, use keeper logger

* Fix nil err use

* Return error from GetKavaForDerivatives

* Re-add ParseLiquidStakingTokenDenom

* Add ParseLiquidStakingTokenDenom tests

* Use DenomSeparator instead of str

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

Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2022-09-19 08:51:39 -07:00
Denali Marsh
ceaed3f0e1
liquid staking (#1273)
* proto types

* proto generated types

* liquidstaking top level files: module, genesis

* liquidstaking types

* liquidstaking keeper

* liquidstaking client/cli

* add liquidstaking to app, simapp

* implement mint derivative

* set up liquidstaking keeper test suite

* test mint derivative

* rename module to liquid

* rename proto types, app.go to liquid

* use sdk.Coin instead of shares

* mint liquid tokens to delegator

* burn derivative tokens to receive delegation

* use conversion method instead of type cast

* simplify delegation transfer logic

* broaden delegation transfer tests

* simplify transfer delegation method
This removes a source of rounding errors

* move derivative denom to keeper config

* check for invalid coins in msg validation

* block 0share transfers to avoid handling edge case

* refactor MintDerivative to test calculations

* simplify burn method so shares and tokens equal

* convert TransferShares back to old design
this makes handling vesting tokens easier

* fix missed merge conflict

* remove deprecated constants

* tidy up msg.go

* add msg tests

* remove unused store key

* fix msg event sender

* remove unused params

* tidy up documentation and errors

* remove unused mocks

* remove unused keepers from AppModule

* tidy up msg return values
keeper return values to be used in router msgs

* reinstate unintentionally removed interface check

* catch invalid input for MnitDerivative
clear up test TODOs

* clear up InitGenesis TODO

* Update x/liquid/client/cli/tx.go

Co-authored-by: Derrick Lee <derrick@dlee.dev>

* Update x/liquid/client/cli/tx.go

Co-authored-by: Derrick Lee <derrick@dlee.dev>

* show error logs in devnet

* unblock mod account so it can receive dist rewards

* catch zero amout msgs early

* minor cli fixes

Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
Co-authored-by: Derrick Lee <derrick@dlee.dev>
2022-09-15 23:00:32 +01:00
Derrick Lee
ded692d2f4
Add savings strategy (#1290)
* Add basic savings strategy

Supports ukava

* Use clearer error message for ErrInvalidVaultStrategy

* Add invariants

* Separate specific vault/all vaults query, update depositor inconsistencies

* Update swagger

* Use single bkava AllowedVault for all bkava variants

* Do not use allowedVault.Denom for value

* Fix vault balance query

* Update query to list bkava vaults

* Add vaults query doc

* Update grpc query test with no supply

* Add earn hooks

* Handle errors

* Update outdated doc comments, make getAllowedVault_Raw private

* Fix outdated comments, lints

* Fix comment maths

* Use AccAddressFromBech32 to validate message addresses
2022-09-12 10:50:35 -07:00