Commit Graph

38 Commits

Author SHA1 Message Date
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
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
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
Draco Li
0c7e357f10
Remove x/bridge & setup migration skeletion (#1295)
* 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

* kava-11 upgrade-handler + evmutil migrations

* add savings & earn module

* committee migration draft

* use ethermint with migrations

* fix evm migration issues

* remove bridge module

* remove savings module

* remove bridge module

* update ethermint

* enable stability migration

* fix store issues

* fix committee migration issues

* fix committee cli examples

* remove unneeded inplace migrations
2022-09-01 16:20:37 -04: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
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
Ruaridh
62ab9f506a
Include small improvements from v0.17.x releases in master (#1265)
* add interface type checks for antehandlers

* add initial height option to test app
2022-06-06 11:07:31 -05: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
8540a5c06f
Savings module scaffold (#1188)
* module files

* proto types

* types and generated proto types

* keeper

* client scaffold

* add savings module to app

* remove placeholder types file

* implement rest and add to module

* update comments

* remove unused imports from proto files

* remove abci

* remove refs to other modules

* remove endblocker call

* genesis init test for module account
2022-03-22 22:13:27 +01:00
Ruaridh
ffef832d45
Upgrade to sdk v0.44.5 and add IBC (#1106)
- Upgrade cosmos-sdk to v0.44.5 from v0.39.2
- Add Legacy Tx Endpoint for backwards compatibility
- Add IBC v1.2.3 Support

Co-authored-by: DracoLi <draco@dracoli.com>
Co-authored-by: drklee3 <derrick@dlee.dev>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: Draco Li <draco@kava.io>
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
Co-authored-by: Denali Marsh <denali@kava.io>
2022-01-07 17:39:27 -07:00
Kevin Davis
8d0bb5a5b0
feat: add invariant check command (#1009)
* add genesis file invariant assertion command

* fix: use correct cmd function name

* update migration guide to add invariant check
2021-08-26 17:53:46 -05:00
Ruaridh
d56bb77231
Incentive Test Refactors (#908)
* organise testing committee gen state

* remove repeated test app initialization

* minor fixes from linter in tests

* move more setup to SetupApp

* split up KeeperTestSuite for each reward type

* simplify KeeperTestSuite

* simplify PayoutKeeperSuite

* simplify DelegatorRewardSuite

* simplify SupplyRewardsSuite

* simplify BorrowRewardsSuite

* simplify USDXRewardsSuite

* add auth genesis builder for easier test setup

* migrate all incentive tests to auth builder

* add incentive genesis builder for easier setup
migrate hard incentive tests

* migrate all tests to incentive builder

* add hard genesis builder

* small tidy ups

* deduplicate initialTime from borrow tests

* deduplicate initialtTime from supply tests

* deduplicate initialTime from usdx and keeper tests

* deduplicate initialTime in delgator tests

* deduplicate genesis time in payout test

* deduplicate test app initialization

* make authGenesisBuilder available for all modules

* remove unused pricefeed setup

* export incentive genesis builder

* remove commented out test cases

* migrate cdp test to new test state builders

* migrate vv payout tests to use new builders
2021-06-10 14:35:44 +01:00
Denali Marsh
9d9b169e6a
Swap module scaffolding and params (#922)
* swap module scaffolding

* global swap fee

* can't think of a reason for begin blocker; removing for abci.go for now;

* test pair types; refactor pair name logic; simplify pairs validation and
fix stack overflow error

* check comparison

* use test package

* init swap module genesis

* add basic marshall tests

* remove reward apy from pairs

* fix integration helpers

* use max swap fee constant; fix validation of swap fee; add tests to
cover param validation and param set setup

* use noerror over nil

* start genesis tests

* test param set validation mirrors param validation

* add genesis tests

* remove print statement

* add subtests for genesis test cases; add extra querier test for unknown
route; add keeper params testing

* add spec

* update swagger

* find replace hard -> swap in comments

* remove unused method

* rename pairs to allowed pools; pool is more commonly used, and
allowedPool makes it more clear what swap parameter is for.  In
addition, we won't conflict with Pool data structure for storing a
created pool in the store.

* remove generated link

* missed spec rename

* validate token order for allowed pools

* fix swagger

* json should be snakecase; change allowedPools to allowed_pools

Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
2021-06-08 08:19:12 -07:00
Denali Marsh
a4bbea1ec4
update 'harvest' -> 'hard' (#746) 2020-12-21 18:18:55 +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
14df6ad410
feat: add function to initialize test app with chain-id (#682) 2020-10-06 14:25:05 -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
Denali Marsh
5ce045f46f
rename hvt (#661) 2020-09-25 11:07:20 -04:00
Kevin Davis
fe38c4aa43
harvest v1 (#658)
* wip: and types and keeper methods

* add keeper tests

* add client

* add spec and events

* respond to review comments

* apply suggestions from review

* feat: add test for validator vesting case

* use int64 for multiplier type

* remove incentive changes
2020-09-21 17:08:43 -04:00
Kevin Davis
e14466547d
Issuance module (#599)
* wip: issuance module

* add keeper and module methods

* add begin blocker

* add client

* update events

* add simulations

* ignore v0.8 migration tests for now

* ignore migration tests in ci

* add test suite

* update spec to match implementation details

* add unblock method

* address review comments

* fix typos
2020-08-17 13:09:02 -04:00
Kevin Davis
790753f156
BEP3: support multiple assets (#616)
* wip: refactor to allow multiple bep3 assets

* update tests

* sims: validate asset before claiming

* move asset supply to params

* update tests

* fix sims

* fix tests

* wip: add migration from v0.9 -> v0.10 bep3

* fix build and migration tests

* nit: rename file

* move asset supply out of params

* update committee tests

* fix sims

* address review comments

* address review comments

* address review comments
2020-08-17 11:06:59 -04:00
Federico Kunze
769f3271f9
app: upgrade module 2020-05-07 16:34:05 -04:00
Federico Kunze
fe72a24aa0
update format 2020-04-30 10:23:41 -04:00
rhuairahrighairigh
6c3d525f0f Merge branch 'master' into ro-emergency-gov-module 2020-04-27 15:55:20 +01:00
Kevin Davis
1ef9bd331b
USDX incentives implementation (#399)
* USDX incentives implementation (#399)
* feat: upgrade to cosmos-sdk v0.38

Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: John Maheswaran <jmaheswaran@users.noreply.github.com>
Co-authored-by: John Maheswaran <john@kava.io>
2020-04-24 11:20:34 -04:00
Federico Kunze
a573625df8
[R4R] bump SDK version to v0.38.3 (#421)
* bump SDK version to v0.38.3

Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: Kevin Davis <kjydavis3@gmail.com>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: rhuairahrighairigh <ruaridh.odonnell@gmail.com>
2020-04-23 12:35:58 -04:00
Kevin Davis
82f637649c
[R4R] Testnet-5k proposal (#404)
* R4R: BEP3 module (#370)

* bep3 module scaffold from cosmos/scaffold

* Populated types, keeper with HTLT msgs, module params, and scaffolding for keys, and genesis

* added KavaHTLT struct, UpdateHTLT struct, resolved compilation errors

* refactored kavaHTLT struct <-> msgs

* Implemented params, refactored UpdateKavaHTLT to UpdateKHTLT interface

* Updated keeper with byTimeIndex methods

* HTLT creation flow

* adjustments in prep for repo config updates

* App moudle updated for bep3, MsgCreateHTLT tested, HTLT keeper methods tested

* Updated bep3 params to match spec

* tests for MsgRefundHTLT, MsgDepositHTLT, MsgClaimHTLT

* AddHtlt cli cmd, queryHtlts cmd, added conversion funcs for binance -> cosmos types, refactored MsgCreateHTLT from binance.AccAddress to sdk.AccAddress

* working edits related to bep3-deputy compatibility

* removed binance-chain go sdk dependency

* updated msg ValidateBasic() return to sdk.Error type

* implement MsgCalculateSwapID

* added MsgCalculateSwapID test, updated randomNumberHash type to []byte

* removed binance type conversions

* msg codec registration

* clean /types directory

* CLI cmds:create htlt, query htlt

* update keeper logic

* handle MsgCreateHTLT

* implement htlt type, msg types

* implement global chain types

* update querier

* added go-ethereum to go mod

* refactor QuerySwap to QueryHTLT

* update HTLTMsg to MsgCreateHTLT

* implemented htlt deposit

* add token transfer to MsgCreateHTLT

* implement refund, claim client txs

* add refund/claim cmds to tx cmd

* commiting go.sum for build

* implemented keeper claim logic

* add RandomNumberHash to create-htlt event

* implement refund keeper logic

* AddHTLT updated to CreateHTLT

* added params keeper

* updated params to single chain, added sample genesis file

* implemented htlt keeper param checks

* removed go-ethereum dependency

* updated go.sum

* housekeeping on keeper tests

* updated cli tx cmds

* ran go.tidy

* remove links from module readme

* updated coin construction in tests

* added expectedIncome checks in ValidateBasic()

* made ValidateAsset() more robust

* update param format for tests

* added basic HTLTByTime index

* implement abci, fix expectedIncome validation

* byTime index updated to blocks, added swap ID & expiration block to htlt

* added not-expired check to HTLT claims

* cross-chain mint/burn logic, htlt string type refactored to []byte

* fix bnb_deputy_address param

* remove abci panic

* cmn.HexBytes, byTime index iteration update, claim-mint logic update

* update genesis example

* general codebase cleaning

* renamed HTLT to AtomicSwap

* staging for PR

* updated naming conventions

* refactor + revisions

* removed code related to deposits & swap block index

* added timestamp validation comment

* post-refactor housekeeping

* post refactor housekeeping (keeper)

* remove GenesisAtomicSwap type

* refactor asset supply logic

* BeginBlocker expires swaps automatically

* param asset.limit type updated to sdk.Int

* remove claimed swaps from block index

* fix DefaultDeputyAddress

* removed BaseSwap

* revisions

* total genesis coins

* updated tx examples

* Automatically update fees for risky cdps (#381)

* wip: sketch implementation

* adding initial function to calcuate risky fees for cdps

* adding todo comment to fix the function arguments

* changing the function arguments

* adding multiplication, print error, change types

* get the number of periods, add comments and questios for code review

* adding specification notes

* removing old comment

* replace collateral with collateral denom

* remove todo and clarify comment

* Update x/cdp/keeper/fees.go

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update x/cdp/keeper/fees.go

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update go.sum

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update x/cdp/keeper/fees.go

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update x/cdp/keeper/fees.go

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update x/cdp/keeper/fees.go

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update x/cdp/abci.go

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* updating fees

* error handling and propogation

* fix collat denom variable

* fix build issues, error, variable names, parameter type

* Update x/cdp/abci.go

Use `err` as name instead of `e`

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update x/cdp/keeper/fees.go

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* fixing error variable name

* changing call to method to compute risky cdps fees

* changing the calcualation to select risky cdps to be based on normalized ratio

* adding skeleton for test methods, adding skeleton helper function for creating cdps for use in tests

* fixing function call to helper method

* fix assignment, calling function that returns two variables instead of one

* adding comment and fixing call to create cdps

* adding create cdps function and updating / fixing the test. one of the expected tests is failing, need to figure out why that is. added a todo question to note it

* logging the cdp object before and after updating. it seems that the fees are not set / written before or after

* adding interim changed

* updated

* fixing normalized ratio

* code cleanup

* changing print of accumulated fees

* removing debug code

* remove completed todo

* remove old variable

* remove spewing print statement

* remove dead todo

* adding note about prices for future

* remove dead code

* try to fix test

* fix types

* fix types

* fix context in call

* changing back as new version breaks a test

* fix

* cleanup, removing logging and old code

* remove dead code

* removing changes to cdp test

* Update x/cdp/keeper/fees.go

Remove old comment as suggested

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update x/cdp/spec/04_begin_block.md

Fix typo as suggested

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

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

* Add Savings Rate (#365)

* fix: ensure cdp module accounts created at gensis

* feat: add savings rate

* chore: update alias

* fix: update default test param values

* chore: update spec for savings rate

* fix: add distribution time to genesis state

* fix: iterate over accounts using callback function

* feat: use seprate mod account for savings rate

* fix: remove mod account coins from total supply

* address review comments

* fix: genesis function initialization

* fix: update alias

* add comment about maintaining module account list

* feat: add genesis example

* R4R: bep3 module upgrades (#388)

* bep3 module scaffold from cosmos/scaffold

* Populated types, keeper with HTLT msgs, module params, and scaffolding for keys, and genesis

* added KavaHTLT struct, UpdateHTLT struct, resolved compilation errors

* refactored kavaHTLT struct <-> msgs

* Implemented params, refactored UpdateKavaHTLT to UpdateKHTLT interface

* Updated keeper with byTimeIndex methods

* HTLT creation flow

* adjustments in prep for repo config updates

* App moudle updated for bep3, MsgCreateHTLT tested, HTLT keeper methods tested

* Updated bep3 params to match spec

* tests for MsgRefundHTLT, MsgDepositHTLT, MsgClaimHTLT

* AddHtlt cli cmd, queryHtlts cmd, added conversion funcs for binance -> cosmos types, refactored MsgCreateHTLT from binance.AccAddress to sdk.AccAddress

* working edits related to bep3-deputy compatibility

* removed binance-chain go sdk dependency

* updated msg ValidateBasic() return to sdk.Error type

* implement MsgCalculateSwapID

* added MsgCalculateSwapID test, updated randomNumberHash type to []byte

* removed binance type conversions

* msg codec registration

* clean /types directory

* CLI cmds:create htlt, query htlt

* update keeper logic

* handle MsgCreateHTLT

* implement htlt type, msg types

* implement global chain types

* update querier

* added go-ethereum to go mod

* refactor QuerySwap to QueryHTLT

* update HTLTMsg to MsgCreateHTLT

* implemented htlt deposit

* add token transfer to MsgCreateHTLT

* implement refund, claim client txs

* add refund/claim cmds to tx cmd

* commiting go.sum for build

* implemented keeper claim logic

* add RandomNumberHash to create-htlt event

* implement refund keeper logic

* AddHTLT updated to CreateHTLT

* added params keeper

* updated params to single chain, added sample genesis file

* implemented htlt keeper param checks

* removed go-ethereum dependency

* updated go.sum

* housekeeping on keeper tests

* updated cli tx cmds

* ran go.tidy

* remove links from module readme

* updated coin construction in tests

* added expectedIncome checks in ValidateBasic()

* made ValidateAsset() more robust

* update param format for tests

* added basic HTLTByTime index

* implement abci, fix expectedIncome validation

* byTime index updated to blocks, added swap ID & expiration block to htlt

* added not-expired check to HTLT claims

* cross-chain mint/burn logic, htlt string type refactored to []byte

* fix bnb_deputy_address param

* remove abci panic

* cmn.HexBytes, byTime index iteration update, claim-mint logic update

* update genesis example

* general codebase cleaning

* renamed HTLT to AtomicSwap

* staging for PR

* updated naming conventions

* refactor + revisions

* removed code related to deposits & swap block index

* added timestamp validation comment

* post-refactor housekeeping

* post refactor housekeeping (keeper)

* remove GenesisAtomicSwap type

* refactor asset supply logic

* BeginBlocker expires swaps automatically

* param asset.limit type updated to sdk.Int

* remove claimed swaps from block index

* fix DefaultDeputyAddress

* removed BaseSwap

* revisions

* total genesis coins

* updated tx examples

* timestamp to unix

* add past timestamp limit

* update random number byte encoding

* add recipient_other_chain to AtomicSwap

* add TODO for timestamp arg parsing

* generate secure random numbers

* update tx cli

* keeper tests

* add bnb token

* bep3 params test set up, test CreateAtomicSwap

* swap table tests

* Revert "bep3 params test set up, test CreateAtomicSwap"

This reverts commits containing tests.

* use tmtime.Now()

* Kava distribution module (#387)

* wip: kavadist module structure

* feat: implement minting logic

* wip: sketch module

* wip: module level code

* wip: bug fixes

* wip: add tests

* wip: resolve todos and tidy

* fix: remove unused file

* address review comments

* fix: update genesis for guide (#394)

* add kava_dist to sample genesis file (#396)

* R4R: BEP3 module test suite (#395)

* refactor secure rng

* refactor common tests, implement keeper tests

* implement asset tests

* implement params, querier tests

* implement keeper swap tests

* refactor import naming conventions

* implement core types tests

* improve keeper swap tests

* implement genesis types test

* implement params test + revisions

* implement duplicate swap test

* implement duplicate swap ID test

* R4R: BEP3 additional features + module test suite (#397)

* update and reorder errors

* implement swap deletion block delay

* add swap deletion block delay, set up tests

* add secure random number gen

* implement AtomicSwapLongtermStorage index

* fix syntax error

* abci test updates

* implement handler test

* implement core genesis tests

* update asset supply logic

* implement functional asset supply

* pretty print atomic swaps

* requested revisions

* fix test suite post merge

* implement and integrate asset supply tests

* update import genesis, add storage duration param

* implement swap deletion ABCI test

* go mod tidy

* remove duplicated interface assertion

* add new bep3 param to contrib genesis file

* remove btc from supported assets

* revisions: LongtermStorageDuration param

* revisions: suite ctx, fix genesis, update contrib

* implement AssetSupply type, store key, keeper

* integrate supply and swaps; genesis, tests

* remove legacy comments

* requested revisions

* update alias

* Swagger Rest Automating Testing With Dredd  (#390)

* swagger testing and mods

* fixed a test

* fixed withdraw address

* adding script to start the chain

* fixed val rewards test

* fix outstanding rewards test

* fixed rewards

* hooks skeleton

* adding test file and hooks

* updates on the hooks working

* now creates a transaction and sends to the chain via rest api successfully

* small fix - now works

* 34 tests now passing successfully

* fix print statement error

* instructions on how to run the tests

* changing function names when to run the hooks

* adding instructions on how to setup and run the dredd tests

* removing large error output file

* removing binary file

* removing more output logging files

* creating a vote on a proposal to send to the blockchain

* adding instructions on how to setup chain

* adding function to get account number and sequence number

* adding send msg to blockchain method

* posting vote tx to blockchain - successfully prepares and sends vote to endpoint but endpoint returns 'inactive proposal with id'

* successfully depositing 600 stake to a proposal

* successfully depositing onto a proposal and then voting on it

* got another governance test working now after submitting a vote to the blockchain

* updating instructions on how to run

* fixed another voting test

* fixed deposits test

* fixed another gov test

* fix print line

* fix circle ci build issue with println

* improving instructions on how to build and run the hooks and dredd tests

* improving instructions on how to build and run the hooks and dredd tests

* finally fixed param change governance proposal test

* trying to unskip tests wip

* fixed gov/proposals test

* fixed another test

* fixed a slashing test

* fixed another redelegation test

* fixed another unbonding delegation test

* fixed more staking tests

* fixed another staking test

* fixed another test

* fixed more tests. 50 now passing, 15 failing

* fixed mislabeled variable

* managed to fix unjail test

* fixed bank acct transfers test

* change certain types from number to string to match the output, typo fix

* another typo fix

* fixed delegation test

* finally figured out and fixed the latest blocks types mismatch - fixed the test

* fixed staking delegators validators test

* removed and noted unimplemented tests from yaml file. fixed blocks height test

* fixed transcations test

* adding functionality to send transfer of coins to blockchain, and to send delegations

* updating the yaml to line up with a valid message format

* added delegation method

* adding test results showing 57 are now passing and only 5 failing

* remove test yaml file from pull req

* testing file updates

* adding test memo

* added undelegation hook method - fixed unbonding delegation test

* fixed the get tx from hash test

* adding not if you encounter validator set is different errors how to fix. 59 tests now passsing, 3 failing

* adding test results showing 59 passing, 3 failing

* finally fixed encode test - 60 tests now passing only 2 failing

* adding test results 60 passing 1 failing

* more test updates

* finally fixed decode test - 61 tests now passing only 1 failing

* test results 61 tests passing 1 failing

* remove dead code

* all 62 tests are now passingga swagger.yaml  0 failing

* used for testing and generating transactions and testing hooks

* updating run instructions

* more instructions updates

* updating the test file

* adding note on reading from a file

* refactoring code and cleanup

* refactoring getting the keybase

* code cleanup for address, keyname methods, remove unused code

* more code cleanup around addresses

* updating the instructions on how to run the dredd tests

* adding comment

* adding additional requirements to the go.mod dependency file

* remove hardcoded home directory, read using os golang library

* increase timeout in example run script

* remove hardcoded home directory

* reordering commands to get rid of errors if key directory is deleted

* changing to use temporary directory

* updating dredd timeout time

* finally managed to get the script wroking using a temporary directory instead of the default

* adding notes and comments

* changing to use a temp directory instead of default directory

* remove un-needed file

* rename debugging tools folder

* adding instructions to install dredd and npm

* Update swagger-ui/startchain.sh

Send output to dev null not to console

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* Update swagger-ui/startchain.sh

Send output to dev null not to console

Co-Authored-By: Kevin Davis <karzak@users.noreply.github.com>

* adding new version of test.go to setup the chain

* adding todo to update instructions for new workflow

* updating script to start and setup the chain

* updating the transaction hash test

* update the start chain script to setup the chain correctly

* add the script to stop the chain and the rest server

* updated the instructions for the new workflow so that all the tests pass the first time

* updated the instructions on how to run the tests

* update instructions for printing logs or not

* updating the startchain script to add messages when starting the rest server and preparing transactions

* adding print messages when stop chain is completed

* updating test results to just include test output and not the debug log statements

* cleaning up the messages that are printed to the user

* moving files to their own directory

* build go test file and remove previous binary

* move instructions

* updating instructions now that test file is auto built

* building, running dredd tests, propagating error code, shut down blockchain all in one script

* fix object type to array type for block latests

* cleaning up the script

* rename script as it now does all the setup, test running, shutdown, and cleanup

* update instructions for new workflow

* adding a shell script to call from the makefile

* adding a make command to build and run all the dredd tests

* update instructions to run using make

* updated code review comment

* minor update to instructions

* update remove file command so doesn't print an error if the file has already been deleted

* renaming folder and test

* adjust code comment

* removing example test results

* updating instructions to remove reference to the test results

* remove old hooks file

* remove obsolete code comment

* remove swagger file, will change references to the other one

* remove shell script, will now use the one called from make instead

* renaming as underscore messes up go build

* clean up script, fix return code issues

* cleanup output file

* fix object to array issue

* add comments to explain functionality

* use variables for kvd home and kvcli home, check for errors

* change the kvcli home directory. need to take this from command line

* take kvcli from command line parameter to golang file

* take kvcli directory from command line parameter

Co-authored-by: John Maheswaran <john@kava.io>
Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>

* R4R: Update BEP3 rest endpoints + format example requests (#402)

* update and reorder errors

* implement swap deletion block delay

* add swap deletion block delay, set up tests

* add secure random number gen

* implement AtomicSwapLongtermStorage index

* fix syntax error

* abci test updates

* implement handler test

* implement core genesis tests

* update asset supply logic

* implement functional asset supply

* pretty print atomic swaps

* requested revisions

* fix test suite post merge

* implement and integrate asset supply tests

* update import genesis, add storage duration param

* implement swap deletion ABCI test

* go mod tidy

* remove duplicated interface assertion

* add new bep3 param to contrib genesis file

* remove btc from supported assets

* revisions: LongtermStorageDuration param

* revisions: suite ctx, fix genesis, update contrib

* implement AssetSupply type, store key, keeper

* integrate supply and swaps; genesis, tests

* remove legacy comments

* requested revisions

* update alias

* rest queries

* implement BEP3 REST txs

* draft rest server readme + example json files

* tested all swap rest examples

* implement query swaps rest endpoint

* feat: update genesis examples

* fix: use post instead of put (#405)

Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: John Maheswaran <jmaheswaran@users.noreply.github.com>
Co-authored-by: John Maheswaran <john@kava.io>
2020-03-27 22:54:00 -04:00
rhuairahrighairigh
f2e4956d88 hook into app to get integration tests running 2020-03-10 22:29:16 +00:00
Kevin Davis
9b1bf55be7
R4R: Move liquidator functions to cdp module (#280)
* wip: tpyes and keeper methods

* wip: iterators

* wip: types and keeper methods

* wip: add msgs

* wip: client methods

* wip: rebase develop

* wip: types tests

* wip: keeper tests, small fixes

* wip: add cdp tests

* wip: deposit tests

* wip: keeper tests

* wip: tests and module methods

* feat: error when fetching expired price

* feat: conversion factor for external assets

* feat: debt floor for new cdps

* feat: save deposits on export genesis

* feat: ensure messages implement msg

* feat: index deposits by status

* fix: stray comment

* wip: address review comments

* address review comments

* wip: move liquidation to cdp module

* wip: handle liquidations directly

* wip: use new auction interface

* feat: auction collateral in cdp begin block

* feat: update param validation

* feat: surplus and debt auctions

* address review comments

* address review comments

* fix: auction multiple deposits

* clean up netting function
2020-01-15 15:19:33 +01:00
Kevin Davis
d849d690e5
R4R: CDP types and methods (#275)
* wip: tpyes and keeper methods

* wip: iterators

* wip: types and keeper methods

* wip: add msgs

* wip: client methods

* wip: rebase develop

* wip: types tests

* wip: keeper tests, small fixes

* wip: add cdp tests

* wip: deposit tests

* wip: keeper tests

* wip: tests and module methods

* feat: error when fetching expired price

* feat: conversion factor for external assets

* feat: debt floor for new cdps

* feat: save deposits on export genesis

* feat: ensure messages implement msg

* feat: index deposits by status

* fix: stray comment

* wip: address review comments

* address review comments
2020-01-12 16:35:34 +01:00
Ruaridh
e1c11d411a Update Auction Module (#276)
* rough auction type refactor

* replace endTime type

* split keeper file up

* update store methods

* move store methods to keeper.go

* move nextAuctionID from params to genState

* simplify auction type to not use pointers

* add basic auction tests

* update endblocker test

* add payout to depositors feature

* add more tests

* move index updates to Get/Set for more safety

* remove slightly unecessary ID type

* remove unused message types

* feat: add spec, update redundant type names

* stop sending zero coins

* use only one coins field in MsgPlaceBid

* remove uncessary Auction interface methods

* give auction types more accurate names

* remove vuepress comments from spec

* minor spec updates

* update doc comments

* add params validation

* code cleanup, address review comments

* resolve minor TODOs

* sync spec with code

Co-authored-by: Kevin Davis <karzak@users.noreply.github.com>
2020-01-12 16:12:22 +01:00
rhuairahrighairigh
2152bb4ed2 rename test helper func 2019-12-07 00:12:07 +00:00
rhuairahrighairigh
1295dfbffc update liquidator tests 2019-12-06 23:49:47 +00:00
rhuairahrighairigh
4662123105 add check balance method to TestApp 2019-12-05 13:51:46 +00:00
rhuairahrighairigh
ce2b2e2213 update cdp keeper tests 2019-12-03 14:35:27 +00:00
rhuairahrighairigh
6f3cb815a2 add TestApp 2019-12-03 14:33:20 +00:00