Commit Graph

148 Commits

Author SHA1 Message Date
Nick DeLuca
102cc0fff3
Community Pool Staking Rewards Implementation & Improvements (#1742)
* add new field upgrade_time_set_staking_rewards_per_second with intention
of integrating into the disable inflation logic to set an initial
staking reward time

* when the disable inflation upgrade time occurs, set the staking rewards
per second to the value specified by the new
upgrade_time_set_staking_rewards_per_second.  This will allow a decoupled
implementation between the ugprade switching logic, and the core
functionality of paying staking rewards from the pool

* add staking rewards state to community keeper and community module
genesis that is required to calculate and track staking reward payouts
accross blocks

* add implementation of staking reward payouts

* remove unused error

* touch up tests and add a test case that fully tests behavior when pool
is drained

* add function comments

* refactor and pull out main calculation to private pure function with
no dependence on keeper

* zero out default parameters -- these are too chain specific to have
useful defaults

* small touch ups on comments, test cases

* use correct Int from sdkmath, not old sdk types; update protonet genesis
for new parmater

* fix copy pasta comment

* use bond denom from staking keeper instead of referncing ukava directly

* add staking reward state for valid genesis

* update kvtool genesis for new params and rewards state
2023-10-03 08:41:54 -07:00
Ruaridh
bc260d8091
feat(community): add switchover param (#1704)
* add community params type

* add get/set params methods

* add community genesis state type

* add community init/export genesis

* add querier methods for params

* add query cli cmd

* update changelog

* update protonet genesis

* Add `RewardsPerSecond` param to `x/community` module (#1707)

* Add RewardsPerSecond param to community

* Update rewards per second param to int

* Add rewards_per_second to protonet genesis

* Use default rewards per second of 744191

* Include value if negative in Validate error

* Rename RewardsPerSecond param to StakingRewardsPerSecond

* Add changelog entry

* Add param migration, update consensus version to 2

* Update proto docs

* Update staking_rewards_per_second param name in protonet genesis (#1730)

* Update godoc

Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>

* add genesis state tests

* document what 0 upgrade time means

* update kvtool to include new params

---------

Co-authored-by: drklee3 <derrick@dlee.dev>
Co-authored-by: Robert Pirtle <Astropirtle@gmail.com>
2023-09-22 09:05:12 -07:00
Robert Pirtle
f4b8bf8f07
feat(evmutil): implement MsgConvertCosmosCoinFromERC20 (#1609)
* first pass at convert cosmos coin -> evm msg

* test ConvertCosmosCoinFromERC20 method

* test message server for MsgConvertCosmosCoinFromERC20

* update spec to include MsgConvertCosmosCoinFromERC20

* update changelog

* add CLI command for convert-cosmos-coin-from-erc20

* add test of removed/re-enable denom for convert
2023-06-02 14:26:51 -07:00
Robert Pirtle
d988330d7f
feat(evmutil): add MsgConvertCosmosCoinFromERC20 proto (#1608)
* add MsgConvertCosmosCoinFromERC20 proto & Msg impl

* test MsgConvertCosmosCoinFromERC20 validation

* register msg codec in this PR 😅
2023-06-02 12:36:59 -07:00
Robert Pirtle
d500cd1236
feat(evmutil): Add DeployedCosmosCoinContracts query (#1605)
* add QueryDeployedCosmosCoinContracts proto

* also implement protobuf marshaler for InternalEVMAddress

* setup iteration & collection for deployed addrs

* rewrite grpc query tests

* support querying for all deployed contracts

* support querying by cosmos denom

* fix & test pagination

* remove unused iteration methods

* add CLI query command

* update changelog

* update spec

* add InternalEVMAddress.MarshalJSON test
2023-06-02 11:23:52 -07:00
Robert Pirtle
d4cbc759f8
update new names, NativeCoin -> CosmosCoin (#1596)
* rename contract NativeCoin -> CosmosCoin

* rename all entities NativeCoin -> CosmosCoin

* update changelog

* update protonet genesis.json
2023-05-23 12:32:27 -07:00
Robert Pirtle
61c3aa090b
feat(evmutil): add proto for MsgConvertNativeCoinToERC20 (#1595)
* add proto for MsgConvertNativeCoinToERC20

* implement Msg types & unit test validation
2023-05-23 11:01:45 -07:00
Robert Pirtle
ff709d73e1
feat(evmutil): add allow list for evm-convertible sdk denoms (#1590)
* add proto for allowed sdk denoms -> evm conversion

* add validation for AllowedNativeCoinERC20Token

* add validation for AllowedNativeCoinERC20Tokens

* add AllowedNativeDenoms into params & genesis

* add evmutil Params.Validate() test

* fix eip712 ante test

* update changelog

* update internal testnet genesis.json

* update state & param specs

updates to the sections describing functionality will be updated once
that functionality actually exists... :)

* update field decimal -> decimals

field now matches erc20 spec

* add validation decimals will cast to uint8

* add v2 store migration for evmutil

* create & register evmutil migrations

* adds migrator to evmutil's keeper
* sets up Migrate1To2 migration
* registers migration in module
* updates GetParams to properly handle historic block queries

* add unit test for GetParams with historic store
2023-05-19 16:01:46 -07:00
drklee3
95d9fb9aca
feat: add CommunityCDPWithdrawCollateralPermission (#1568)
* Add CommunityCDPWithdrawCollateralPermission

* Add changelog entry

* Move permission Allow func closer to its other cdp friend
2023-04-20 17:13:02 -07:00
drklee3
31eae1c6d7
feat: add community cdp withdraw collateral proposal (#1567)
* Initial proposal types

* Add withdraw cdp proposal handler

* Add codec registration for proposal type

* Update CommunityCDPWithdrawCollateralProposal name

* Rename CommunityCDPWithdrawCollateralProposal

* Add changelog entry

* Add proposal registration, unit tests

* Register CommunityCDPWithdrawCollateralProposal proposal type codec
2023-04-20 16:08:53 -07:00
Robert Pirtle
14a0860ddb
feat: add CommunityCDPRepayDebtPermission (#1566)
* feat: add CommunityCDPRepayDebtPermission

When granted, the new permission allows a committee to submit a
CommunityCDPRepayDebtProposal to lower principal owed on a cdp
owned by the x/community module.

* update changelog

* update protonet genesis.json
2023-04-20 14:42:11 -07:00
Robert Pirtle
c5f414e6a5
feat: add community cdp repay debt proposal (#1565)
* add CommunityPoolCDPRepayDebtProposal proto & type

* add cdpKeeper to x/community's keeper

* add handler for CommunityPoolCDPRepayDebtProposal

* more test cases

* rename CommunityPoolCDP -> CommunityCDP

the proposal does not interact with the vanilla community pool

* fix & test stringer

* update changelog
2023-04-20 14:13:16 -07:00
Robert Pirtle
8c1c29a03a
feat: add CommunityPoolLendWithdrawalPermission (#1562)
* feat: add CommunityPoolLendWithdrawalPermission

* update kvtool to master branch

* register with PubProposal legacy amino codec

* register missing legacy amino codec PubProposal
2023-04-18 12:31:43 -07:00
drklee3
56f697fba6
feat: overwrite x/distribution /community_pool endpoint to include x/community balance (#1563)
* Add query path rewrites

* Add test for new x/community endpoint

* Update doc for RegisterAPIRouteRewrites

* Add changelog entry

* Add changelog entry link
2023-04-17 12:54:13 -07:00
drklee3
ecb0af6c68
fix: remove denom path parameters from hard grpc query url (#1519) 2023-03-27 16:39:56 -07:00
drklee3
35c848dce6
Add incentive grpc query service (#1503)
* Add incentive grpc query service

* Register query server

* Add grpc query test

* Add grpc query test

* Fix proto lints

* Fix missing savings field, update tests

* Update proto docs

* Use consts for query reward types

* Add owner to queryRewards err

* Add empty reward type to be valid
2023-03-21 15:47:21 -07:00
Robert Pirtle
b26e12a579
remove legacy-community-pool query (#1459) 2023-01-26 10:47:03 -08:00
Robert Pirtle
0d38ce77a1
replace x/kavamint with x/mint (#1452)
* replace x/kavamint with x/mint

* replace x/mint with x/kavamint in internal testnet

* delete all x/kavamint code (#1453)
2023-01-26 09:50:27 -07:00
Ruaridh
4b8e224f6a
Revert incentive refactor commits (#1433)
* Revert "Add incentive migrations for earn rewards (#1406)"

This reverts commit 937e5f339f.

* Revert "Use different accumulator for earn (#1395)"

This reverts commit cf009647e6.

* Revert "Add base earn incentive accumulator (#1393)"

This reverts commit 44a90a8ef9.

* Revert "Add generic incentive `AccumulateRewards` method (#1392)"

This reverts commit dce631d3de.

* Revert "Add GetSynchronizedClaim and swap adapter (#1386)"

This reverts commit f52a581ea9.

* Revert "Add Initialize/Synchronize Claim methods (#1383)"

This reverts commit c2061f626e.

* Revert "Add source adapter interface definition (#1377)"

This reverts commit 2abb2ce606.

* Revert "Add incentive RewardIndexes types and state methods (#1381)"

This reverts commit 4a3002b09c.

* Revert "Add AccrualTime type and state methods (#1379)"

This reverts commit df1c2ffc34.

* Revert "Add incentive claim state methods (#1375)"

This reverts commit 90735e29ed.

* Revert "Add generic Claim type (#1371)"

This reverts commit 45fc1a7643.

* Regerate protos and minor revert fixes
2022-12-22 01:08:16 +00:00
Robert Pirtle
8eb9e1d4a1
Add LegacyCommunityPool query to x/community (#1432)
* add proto for LegacyCommunityPool query

* add distribution keeper to community keeper

* implement LegacyCommunityPool query

* add cli cmd for legacy-community-pool
2022-12-19 13:56:46 -08:00
Robert Pirtle
1555c99f1b
Proto & types for x/community lend proposals (#1423)
* add proto for x/community lend proposals

* add proposal type validation w/ tests
2022-12-09 15:07:49 -08:00
Robert Pirtle
f37321839b
add x/kavamint & x/community modules (#1400)
* add `x/kavamint` module (#1376)

* stub out the x/kavamint module

* mint staking rewards in x/kavamint BeginBlocker

* calculate cumulative inflation from x/kavamint

* cleanup, abstract bond denom, grpc query tests

* store & use previous block time to calculate mints

* move test suite to testutil

* add test of x/kavamint BeginBlocker

* cleanup & comments from @DracoLi review

* fix x/incentive integration test

* remove rest client grpc test

* add x/kavamint module spec

* track previous block time in genesis

* suggested cleanup from PR review

* bugfix incorrect module account check

* add x/community module (#1388)

* add x/community module

* refactor and setup fund-community-pool tx

* remove unused features (params, genesis state)

* test x/community query and message

* update with master branch deps

* updates from review

* indicate deprecated methods on module (still needed to fulfill interface)
* remove legacy querier
* derive msg Route() and Type() from sdk.MsgTypeURL(&msg)

* use module name for message Route()

* mint community pool inflation in x/kavamint (#1389)

* mint community pool inflation in x/kavamint

* refactor x/kavamint abci inflation test

* test inflation from x/kavamint

* default kavamint rates to 0%

* rename kavamint account name variables

* panic if genesis kavamint previous block time not set

* emit event on kavamint begin blocker

* add kavamint year of inflation sanity check test

* update fund_community_pool message event

* add x/community spec

* refactor inflation accumulation into single func

* use new comm pool in kavadist multispend proposal (#1403)

the x/community module houses the new community pool. this commit
points the CommunityPoolMultiSpendProposal at the new community pool
so that multispend proposals can continue to be processed once original
fee pool funds are move to x/community

* updates from proto lint changes

* update earn proposals to use new community pool

originally the CommunityPoolDepositProposal & CommunityPoolWithdrawProposal
used the vanilla community pool fee pool. this commit updates them both
to use the new x/community module account.

* spec formatting update

* add x/community & x/kavamint to internal testnet genesis

* increase test coverage of x/kavamint

* increase test coverage of x/community

* use string type for sdk.Dec proto fields; disable generation of getters
for genesis and params (and other store objects)

* follow sdk conventions for params endpoint naming

* add kavamint to swagger; update swagger & proto docs

* remove legacy querier; touch up module to match others

* reduce max minting rate; refactor genesis to allow nil/zero block time;
repace proto stringers and remove getters; keep sdk.Dec values strings
in protos; increase validation of sdk.Dec values in params; increase
coverage; add module account permission checks; ensure import and export
of genesis does not change state

* fix scaling of rate values -- should be yearly rates

* revert key change

* fix typo in test name

* fix regression in running tests -- rename method

Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
2022-12-09 13:24:35 -08:00
Derrick Lee
dce631d3de
Add generic incentive AccumulateRewards method (#1392)
* Add generic accumulator

* Add MultiRewardPeriodOfClaimType type to params

* Add adapters wrapper

* Add MultiRewardPeriodsOfClaimType to params

* Add multireward period to genesis test

* Rename MultiRewardPeriodOfClaimType to TypedMultiRewardPeriod

* Use source adapters wrapper
2022-11-29 13:59:11 -08:00
Derrick Lee
30eb83d896
Capture multiple path segments for earn /vaults/{denom=**} query (#1391) 2022-11-18 10:53:59 -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
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
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
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
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
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
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
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
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
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
Derrick Lee
8593d26c24
Add private Earn vault with allowed depositors (#1289)
* Add IsPrivateVault and AllowedDepositors to types

* Check if account is allowed to deposit
2022-09-12 10:29:35 -07:00
Derrick Lee
b38cd850df
Update Earn requests and responses to use multiple strategies (#1284)
* Add multiple strategies to params, queries, txs

* Check deposit/withdraw strategy if supported by vault

* Add note for deposit strategy

* Add strategy type to messages

* Update swagger docs, ignore ethermint proto linting errors

* Update strategy test, move single strategy support to strategytype

* Simplify NewStrategyTypeFromString
2022-09-12 09:43:59 -07:00
Derrick Lee
b5e162a930
Update Earn vaults to use sdk.Dec shares (#1283)
* Change vault supply to shares

* Update deposit shares

* Use shares instead of supplied

* Update tests, fix share calculation

* Pass hard and savings keeper as pointer to earn keeper

* Update remaining failing test

* Add different share price test, fix comment for share price

* Add shares amount to events

* Additional share tests, use share to asset conversion for withdraw amount

* Update VaultTotalValue test

* Use sdk.Dec for vault shares instead of sdk.Int

* Add test for expensive 20:1 shares

* Update ConvertToShares comment for division, remove redundant test

* Add vault share tests
2022-09-12 09:23:26 -07:00
Draco Li
2b123bf007
Add EIP712 ante (#1267)
* add eip712 ante

* minor cleanup

* eip712 integration test with bridge conversion

* fix issues

* update bridge module

* merge bridge module convert logic

* update eip712 tests & update deps

* remove v17 migrations

* remove v17 migrations

* fix genesis test

* fix erc20 to coin tx

* remove eth check

* clean up imports

* remove

* fix evmutil cli

* remove bridge comments

* address feedback

* rename mint method

* add transfer checks for locking & unlocking funds

* fix gas

* increase gas even more

* fix amount check

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

Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2022-08-23 13:04:40 -04:00
Derrick Lee
82e2f26e14
Add Earn grpc query service and cli query commands (#1279)
* Add query methods

* Add TotalDeposited rpc query

* All accounts and all denoms query wip

* Add query deposits

* Remove IsDenomSupported strategy method

This is not necessary and is already set in params allowed vaults

* Add Vaults, TotalDeposited queries

* Deposits query tests and fixes

* proto lints

* Add earn swagger docs

* Add cli query cmds

* Update init-new-chain.sh with usdx strategy and funds

* Add denom url query path for vaults

* Return a list of coins for each depositor instead of multiple deposit entries
2022-07-28 09:50:59 -07:00
Derrick Lee
88d4868316
Implement Hard strategy for Earn vaults (#1278)
* Simplify strategies to lend and savings

* Add hard and savings keepers

* Add ctx to strategy interface, fill in lend strategy

* Rename lend strategy to hard

* Fix hard deposit query, fix withdraw bank send

* Fix misleading borrow instead of withdraw for hard

* Remove liquidateall strategy method

* Withdraw tests

* Add hard gs to testutil suite

* Update withdraw tests with working hard strategy, clean strategy interface methods

* Check allowed denom for strategy

* Update GetVaultTotalValue doc note

* Update error wrap message for unsupported denom

* Remove unnecessary viewvault keeper

* Withdraw amount from account value, not supplied value

* Test value > supplied withdraw

* Use dec when dividing for withdrawAmountPercent

* Use the correct store prefix for vault shares

* Update swap references to earn

* Simplify vault shares, use a single share for all coins per address
2022-07-28 09:39:57 -07:00
Derrick Lee
ae181604ff
Add basic Earn module vault deposit/withdraw (#1277)
* Add basic earn types and interfaces

* Add VaultStrategy type

* Update params with allowedVaults, deposit/withdraw msgs

* Fill in Deposit method, add keeper methods

* Add testutil, params, codec

* Add withdraw

* emit vault events

* Implement vault viewer methods

* Update doc comments, strategies

* Add earn cli query/tx commands

* Add successfull balance withdraw tests

* Add ukava vault to dev genesis

* Add vault keeper method doc comments

* Update stablecoin strategy to only accept usdx

* Vault state tests

* VaultTotalSupplied tests

* msg server test
2022-07-20 16:14:43 -07:00
Derrick Lee
68315e1636
Add basic empty Earn module (#1274)
* Add empty earn appmodule

* Fix earn name references

* Rebuild proto

* Add earn to app
2022-07-20 15:57:56 -07:00
Draco Li
c511c56560
Add EVM Support (#1215)
* ibc v3 upgrade

* ibc no longer uses confio

* add proofs proto for ibc/v3

* wip add ethermint module

* update cosmos to 0.45.0

* add ethermint proto & bug fixes

* remove todo

* update docs

* fix a number of bugs

* minor comments update

* fix breaking tests

* Wrap bank keeper for EVM to convert decimals (#1154)

* Add bankkeeper wrapper for evm

* Remove agas from init-new-chain.sh, use ukava for evm_denom

* Fix sdk.Coins conversion, require min 1 coin amount

* Remove gas from init script

idk how this happened lol

* Remove debug logging stmt

* Restore original init ukava amounts

* Fix inplace coins conversion

* Use evmtypes.BankKeeper interface insteadof banktypes

* Add TestGetBalance

* Add doc comments, remove temp actualAmt vars

actualAmt vars replaced with inline calls to make it more clear that the
converted value is being used, as opposed to accidentally reusing the
raw EVM amt.

* Add TestSetBalance

* Add TestIdempotentConversion

* Panic if converted coin from EVM is 0

This happens if a value is less than 1ukava

* Deep copy coins instead of in place modification

* Update test coins amount

* Add panic tests for small EVM amounts

* Use evmtypes.BankKeeper as NewEVMBankKeeper param

* Tidy test setup

* ensure sdk config is set when creating new apps

* Respond EVM bank keeper GetBalance with SpendableCoins

Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>

* further speed up docker builds

* feat: restore previous keys add defaults, add eth flag (#1172)

* feat: restore previous keys add defaults, add eth flag

* remove outdated comment

* fix: remove redundant flag default

* evm bank keeper with akava handling

* fix issues

* add remaining tests

* add emv module to app

* add missing imports

* clean up comments

* wip akava keeper

* evm keeper

* fix genesis import

* reduce module permissions

* add bank keeper tests

* cleanup tests

* genesis tests

* change defaults

* add eth faucet key & fix issues

* switch to kava ethermint

* add a lot of tests

* add balances invariant

* add evm tests

* Remove panic if Swagger disabled in config (#1155) (#1183)

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

* add invariant to catch any akava balance > 1 ukava

* clarify name of balances invariant

* connect invariants to app

* fix evmbankkeeper akava issues

* add spec for evmutil

* remove zero balance accounts from state

* minor adustments

* update to ethermint 0.10.0

* fix eth ante

* add missing godoc comment

* Update x/evmutil/spec/01_concepts.md

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

* Update x/evmutil/spec/01_concepts.md

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

* Update ethermint to v0.12 (#1203)

* update to ethermint v0.12.2

* use app.Options for new evm options

* fix missed references to app.Options

* use ethermint branch while waiting on upstream fix

* evm migrations for tesnet alpha 2 (#1206)

* update to ethermint v0.12.2

* use app.Options for new evm options

* fix missed references to app.Options

* use ethermint branch while waiting on upstream fix

* add upgrade handler for evm-alpha testnet 2

* v17 migration setup + evm modules

* refactor migrate states

* x/feemarket migration

* v17 migrations setup + evm modules migration (#1210)

* v17 migration setup + evm modules

* refactor migrate states

* update gen time

* fix: update genesis time in test output

Co-authored-by: karzak <kjydavis3@gmail.com>

* add savings module to app blockers

Co-authored-by: Derrick Lee <derrick@dlee.dev>
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2022-04-21 16:16:28 -04:00
Denali Marsh
72e8f2f40f
Add savings to incentive genesis (#1205)
* define and generate proto types

* implement savings claim msg + test

* implement savings claim + test

* register msg and add store keys

* implement savings claim keeper methods

* update function comment

* define and generate proto types, update types dir

* update gen state with savings + test

* update legacy test data for ci test

* update proto types numbering

* update params proto types numbering
2022-04-04 15:01:48 -05:00