0g-chain/app/app.go

596 lines
21 KiB
Go
Raw Normal View History

2019-06-20 13:37:57 +00:00
package app
import (
"io"
"os"
2020-04-30 14:23:41 +00:00
dbm "github.com/tendermint/tm-db"
2019-06-20 13:37:57 +00:00
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
2019-06-20 13:37:57 +00:00
bam "github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/simapp"
2019-06-20 13:37:57 +00:00
sdk "github.com/cosmos/cosmos-sdk/types"
2019-07-18 17:36:31 +00:00
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
2019-06-20 13:37:57 +00:00
"github.com/cosmos/cosmos-sdk/x/auth"
2019-10-04 17:55:49 +00:00
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
2019-06-20 13:37:57 +00:00
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/crisis"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/evidence"
2019-07-18 17:36:31 +00:00
"github.com/cosmos/cosmos-sdk/x/genutil"
2019-06-20 13:37:57 +00:00
"github.com/cosmos/cosmos-sdk/x/gov"
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/params"
2019-07-18 17:36:31 +00:00
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
2019-06-20 13:37:57 +00:00
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
2019-07-18 17:36:31 +00:00
"github.com/cosmos/cosmos-sdk/x/supply"
2020-05-07 20:34:05 +00:00
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
2020-03-04 19:50:30 +00:00
"github.com/kava-labs/kava/app/ante"
2020-03-04 19:50:30 +00:00
"github.com/kava-labs/kava/x/auction"
"github.com/kava-labs/kava/x/bep3"
2020-03-04 19:50:30 +00:00
"github.com/kava-labs/kava/x/cdp"
"github.com/kava-labs/kava/x/committee"
2020-12-21 17:18:55 +00:00
"github.com/kava-labs/kava/x/hard"
"github.com/kava-labs/kava/x/incentive"
"github.com/kava-labs/kava/x/issuance"
"github.com/kava-labs/kava/x/kavadist"
2020-03-04 19:50:30 +00:00
"github.com/kava-labs/kava/x/pricefeed"
validatorvesting "github.com/kava-labs/kava/x/validator-vesting"
2019-06-20 13:37:57 +00:00
)
const (
2019-07-18 17:36:31 +00:00
appName = "kava"
2019-07-02 20:06:16 +00:00
Bech32MainPrefix = "kava"
Bip44CoinType = 459 // see https://github.com/satoshilabs/slips/blob/master/slip-0044.md
2019-06-20 13:37:57 +00:00
)
var (
2019-07-18 17:36:31 +00:00
// default home directories for expected binaries
2019-06-20 17:08:58 +00:00
DefaultCLIHome = os.ExpandEnv("$HOME/.kvcli")
DefaultNodeHome = os.ExpandEnv("$HOME/.kvd")
2019-07-18 17:36:31 +00:00
2019-07-19 14:06:33 +00:00
// ModuleBasics manages simple versions of full app modules. It's used for things such as codec registration and genesis file verification.
2019-07-18 17:36:31 +00:00
ModuleBasics = module.NewBasicManager(
genutil.AppModuleBasic{},
auth.AppModuleBasic{},
2019-10-02 13:10:28 +00:00
validatorvesting.AppModuleBasic{},
2019-07-18 17:36:31 +00:00
bank.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distr.AppModuleBasic{},
2020-05-07 20:34:05 +00:00
gov.NewAppModuleBasic(
paramsclient.ProposalHandler, distr.ProposalHandler, committee.ProposalHandler,
upgradeclient.ProposalHandler,
),
2019-07-18 17:36:31 +00:00
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
2020-05-07 20:34:05 +00:00
upgrade.AppModuleBasic{},
2019-07-18 17:36:31 +00:00
supply.AppModuleBasic{},
evidence.AppModuleBasic{},
2019-11-29 10:55:10 +00:00
auction.AppModuleBasic{},
cdp.AppModuleBasic{},
pricefeed.AppModuleBasic{},
committee.AppModuleBasic{},
[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-28 02:54:00 +00:00
bep3.AppModuleBasic{},
kavadist.AppModuleBasic{},
incentive.AppModuleBasic{},
issuance.AppModuleBasic{},
2020-12-21 17:18:55 +00:00
hard.AppModuleBasic{},
2019-07-18 17:36:31 +00:00
)
2019-09-11 22:33:20 +00:00
// module account permissions
mAccPerms = map[string][]string{
2019-10-02 13:10:28 +00:00
auth.FeeCollectorName: nil,
distr.ModuleName: nil,
mint.ModuleName: {supply.Minter},
staking.BondedPoolName: {supply.Burner, supply.Staking},
staking.NotBondedPoolName: {supply.Burner, supply.Staking},
gov.ModuleName: {supply.Burner},
validatorvesting.ModuleName: {supply.Burner},
auction.ModuleName: nil,
cdp.ModuleName: {supply.Minter, supply.Burner},
cdp.LiquidatorMacc: {supply.Minter, supply.Burner},
bep3.ModuleName: {supply.Minter, supply.Burner},
[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-28 02:54:00 +00:00
kavadist.ModuleName: {supply.Minter},
issuance.ModuleAccountName: {supply.Minter, supply.Burner},
hard.ModuleAccountName: {supply.Minter},
2019-09-11 22:33:20 +00:00
}
// module accounts that are allowed to receive tokens
allowedReceivingModAcc = map[string]bool{
distr.ModuleName: true,
}
2019-09-11 22:33:20 +00:00
)
2019-07-18 17:36:31 +00:00
// Verify app interface at compile time
var _ simapp.App = (*App)(nil)
// AppOptions bundles several configuration params for an App.
// The zero value can be used as a sensible default.
type AppOptions struct {
SkipLoadLatest bool
SkipUpgradeHeights map[int64]bool
InvariantCheckPeriod uint
MempoolEnableAuth bool
MempoolAuthAddresses []sdk.AccAddress
}
// App represents an extended ABCI application
2019-06-20 17:02:29 +00:00
type App struct {
2019-06-20 13:37:57 +00:00
*bam.BaseApp
cdc *codec.Codec
invCheckPeriod uint
// keys to access the substores
2019-09-11 22:33:20 +00:00
keys map[string]*sdk.KVStoreKey
tkeys map[string]*sdk.TransientStoreKey
2019-06-20 13:37:57 +00:00
2019-07-26 12:11:23 +00:00
// keepers from all the modules
accountKeeper auth.AccountKeeper
bankKeeper bank.Keeper
supplyKeeper supply.Keeper
stakingKeeper staking.Keeper
slashingKeeper slashing.Keeper
mintKeeper mint.Keeper
distrKeeper distr.Keeper
govKeeper gov.Keeper
crisisKeeper crisis.Keeper
2020-05-07 20:34:05 +00:00
upgradeKeeper upgrade.Keeper
paramsKeeper params.Keeper
evidenceKeeper evidence.Keeper
vvKeeper validatorvesting.Keeper
auctionKeeper auction.Keeper
cdpKeeper cdp.Keeper
pricefeedKeeper pricefeed.Keeper
committeeKeeper committee.Keeper
[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-28 02:54:00 +00:00
bep3Keeper bep3.Keeper
kavadistKeeper kavadist.Keeper
incentiveKeeper incentive.Keeper
issuanceKeeper issuance.Keeper
2020-12-21 17:18:55 +00:00
hardKeeper hard.Keeper
2019-07-18 17:36:31 +00:00
// the module manager
mm *module.Manager
2019-09-11 22:33:20 +00:00
// simulation manager
sm *module.SimulationManager
2019-06-20 13:37:57 +00:00
}
2019-06-20 17:02:29 +00:00
// NewApp returns a reference to an initialized App.
func NewApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts AppOptions, baseAppOptions ...func(*bam.BaseApp)) *App {
2019-06-20 13:37:57 +00:00
cdc := MakeCodec()
bApp := bam.NewBaseApp(appName, logger, db, auth.DefaultTxDecoder(cdc), baseAppOptions...)
bApp.SetCommitMultiStoreTracer(traceStore)
2019-07-18 17:36:31 +00:00
bApp.SetAppVersion(version.Version)
2019-06-20 13:37:57 +00:00
2019-09-11 22:33:20 +00:00
keys := sdk.NewKVStoreKeys(
bam.MainStoreKey, auth.StoreKey, staking.StoreKey,
supply.StoreKey, mint.StoreKey, distr.StoreKey, slashing.StoreKey,
2020-05-07 20:34:05 +00:00
gov.StoreKey, params.StoreKey, upgrade.StoreKey, evidence.StoreKey,
validatorvesting.StoreKey, auction.StoreKey, cdp.StoreKey, pricefeed.StoreKey,
bep3.StoreKey, kavadist.StoreKey, incentive.StoreKey, issuance.StoreKey, committee.StoreKey,
2020-12-21 17:18:55 +00:00
hard.StoreKey,
2019-09-11 22:33:20 +00:00
)
2019-09-25 19:00:44 +00:00
tkeys := sdk.NewTransientStoreKeys(params.TStoreKey)
2019-09-11 22:33:20 +00:00
2019-06-20 17:02:29 +00:00
var app = &App{
2019-07-18 17:36:31 +00:00
BaseApp: bApp,
cdc: cdc,
invCheckPeriod: appOpts.InvariantCheckPeriod,
2019-09-11 22:33:20 +00:00
keys: keys,
tkeys: tkeys,
2019-06-20 13:37:57 +00:00
}
2019-07-18 17:36:31 +00:00
// init params keeper and subspaces
app.paramsKeeper = params.NewKeeper(app.cdc, keys[params.StoreKey], tkeys[params.TStoreKey])
2019-07-18 17:36:31 +00:00
authSubspace := app.paramsKeeper.Subspace(auth.DefaultParamspace)
bankSubspace := app.paramsKeeper.Subspace(bank.DefaultParamspace)
stakingSubspace := app.paramsKeeper.Subspace(staking.DefaultParamspace)
mintSubspace := app.paramsKeeper.Subspace(mint.DefaultParamspace)
distrSubspace := app.paramsKeeper.Subspace(distr.DefaultParamspace)
slashingSubspace := app.paramsKeeper.Subspace(slashing.DefaultParamspace)
2019-09-11 22:33:20 +00:00
govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable())
evidenceSubspace := app.paramsKeeper.Subspace(evidence.DefaultParamspace)
2019-07-18 17:36:31 +00:00
crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace)
2019-11-29 10:55:10 +00:00
auctionSubspace := app.paramsKeeper.Subspace(auction.DefaultParamspace)
cdpSubspace := app.paramsKeeper.Subspace(cdp.DefaultParamspace)
pricefeedSubspace := app.paramsKeeper.Subspace(pricefeed.DefaultParamspace)
[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-28 02:54:00 +00:00
bep3Subspace := app.paramsKeeper.Subspace(bep3.DefaultParamspace)
kavadistSubspace := app.paramsKeeper.Subspace(kavadist.DefaultParamspace)
incentiveSubspace := app.paramsKeeper.Subspace(incentive.DefaultParamspace)
issuanceSubspace := app.paramsKeeper.Subspace(issuance.DefaultParamspace)
2020-12-21 17:18:55 +00:00
hardSubspace := app.paramsKeeper.Subspace(hard.DefaultParamspace)
2019-07-18 17:36:31 +00:00
// add keepers
2019-06-20 13:37:57 +00:00
app.accountKeeper = auth.NewAccountKeeper(
app.cdc,
2019-09-11 22:33:20 +00:00
keys[auth.StoreKey],
2019-07-18 17:36:31 +00:00
authSubspace,
auth.ProtoBaseAccount,
)
2019-06-20 13:37:57 +00:00
app.bankKeeper = bank.NewBaseKeeper(
app.accountKeeper,
2019-07-18 17:36:31 +00:00
bankSubspace,
app.BlacklistedAccAddrs(),
)
2019-07-18 17:36:31 +00:00
app.supplyKeeper = supply.NewKeeper(
2019-06-20 13:37:57 +00:00
app.cdc,
2019-09-11 22:33:20 +00:00
keys[supply.StoreKey],
2019-07-18 17:36:31 +00:00
app.accountKeeper,
app.bankKeeper,
mAccPerms,
)
2019-06-20 13:37:57 +00:00
stakingKeeper := staking.NewKeeper(
app.cdc,
2019-09-11 22:33:20 +00:00
keys[staking.StoreKey],
2019-07-18 17:36:31 +00:00
app.supplyKeeper,
stakingSubspace,
)
2019-07-18 17:36:31 +00:00
app.mintKeeper = mint.NewKeeper(
app.cdc,
2019-09-11 22:33:20 +00:00
keys[mint.StoreKey],
2019-07-18 17:36:31 +00:00
mintSubspace,
&stakingKeeper,
app.supplyKeeper,
auth.FeeCollectorName,
)
2019-06-20 13:37:57 +00:00
app.distrKeeper = distr.NewKeeper(
app.cdc,
2019-09-11 22:33:20 +00:00
keys[distr.StoreKey],
2019-07-18 17:36:31 +00:00
distrSubspace,
&stakingKeeper,
app.supplyKeeper,
2019-09-11 22:33:20 +00:00
auth.FeeCollectorName,
app.ModuleAccountAddrs(),
)
2019-06-20 13:37:57 +00:00
app.slashingKeeper = slashing.NewKeeper(
app.cdc,
2019-09-11 22:33:20 +00:00
keys[slashing.StoreKey],
2019-07-18 17:36:31 +00:00
&stakingKeeper,
slashingSubspace,
)
2019-07-18 17:36:31 +00:00
app.crisisKeeper = crisis.NewKeeper(
crisisSubspace,
app.invCheckPeriod,
2019-07-18 17:36:31 +00:00
app.supplyKeeper,
auth.FeeCollectorName,
)
2020-05-07 20:34:05 +00:00
app.upgradeKeeper = upgrade.NewKeeper(
appOpts.SkipUpgradeHeights,
2020-05-07 20:34:05 +00:00
keys[upgrade.StoreKey],
app.cdc,
)
// create evidence keeper with router
evidenceKeeper := evidence.NewKeeper(
app.cdc,
keys[evidence.StoreKey],
evidenceSubspace,
&app.stakingKeeper,
app.slashingKeeper,
)
evidenceRouter := evidence.NewRouter()
evidenceKeeper.SetRouter(evidenceRouter)
app.evidenceKeeper = *evidenceKeeper
// create committee keeper with router
2020-03-23 14:32:50 +00:00
committeeGovRouter := gov.NewRouter()
committeeGovRouter.
AddRoute(gov.RouterKey, gov.ProposalHandler).
AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
AddRoute(upgrade.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper))
2020-03-23 14:32:50 +00:00
// Note: the committee proposal handler is not registered on the committee router. This means committees cannot create or update other committees.
// Adding the committee proposal handler to the router is possible but awkward as the handler depends on the keeper which depends on the handler.
app.committeeKeeper = committee.NewKeeper(
app.cdc,
keys[committee.StoreKey],
committeeGovRouter,
app.paramsKeeper,
)
// create gov keeper with router
2019-07-18 17:36:31 +00:00
govRouter := gov.NewRouter()
govRouter.
AddRoute(gov.RouterKey, gov.ProposalHandler).
AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
2020-03-23 14:32:50 +00:00
AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
2020-05-07 20:34:05 +00:00
AddRoute(upgrade.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)).
2020-03-23 14:32:50 +00:00
AddRoute(committee.RouterKey, committee.NewProposalHandler(app.committeeKeeper))
2019-06-20 13:37:57 +00:00
app.govKeeper = gov.NewKeeper(
app.cdc,
2019-09-11 22:33:20 +00:00
keys[gov.StoreKey],
2019-07-18 17:36:31 +00:00
govSubspace,
app.supplyKeeper,
&stakingKeeper,
govRouter,
)
2019-10-02 13:10:28 +00:00
app.vvKeeper = validatorvesting.NewKeeper(
app.cdc,
keys[validatorvesting.StoreKey],
app.accountKeeper,
app.bankKeeper,
app.supplyKeeper,
&stakingKeeper,
)
2019-11-29 10:55:10 +00:00
app.pricefeedKeeper = pricefeed.NewKeeper(
app.cdc,
keys[pricefeed.StoreKey],
pricefeedSubspace,
)
app.auctionKeeper = auction.NewKeeper(
app.cdc,
keys[auction.StoreKey],
app.supplyKeeper,
auctionSubspace,
)
Cdp accumulators (#751) * Add 'InterestFactor' to CDP type (#734) * update cdp type to include interest factor * fix build * Add cdp accumulator methods (#735) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * Add sync cdp interest method (#737) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * remove old fee functions * add method to synchronize cdp interest * add multi-cdp tests * add test with many blocks * add test for interest getter * address review comments * calculate time difference then convert to seconds * fix: update collateral index when syncing interest * fix: differentiate between case when apy is zero and all fees are being rounded to zero * fix: round time difference properly * update cdp genesis state and migrations (#738) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * remove old fee functions * add method to synchronize cdp interest * add multi-cdp tests * add test with many blocks * add test for interest getter * update cdp genesis state and migrations * address review comments * calculate time difference then convert to seconds * fix: update collateral index when syncing interest * fix: differentiate between case when apy is zero and all fees are being rounded to zero * fix: simplify add/remove/update collateral index * update genesis state to include total principal amounts * update migration * Delete kava-4-cdp-state-block-500000.json * Add cdp liquidations by external keeper (#750) * feat: split liquidations between external keepers and automated begin blocker * address review comments * USDX incentive accumulators (#752) * feat: split liquidations between external keepers and automated begin blocker * wip: refactor usdx minting incentives to use accumulators/hooks * wip: refactor usdx minting claim object * feat: use accumulators/hooks for usdx minting rewards * fix: get tests passing * fix: don't create claim objects unless that cdp type is eligable for rewards * add begin blocker * update client * cleanup comments/tests * update querier * address review comments * fix: check for division by zero * address review comments * run hook before interest is synced * Remove savings rate (#764) * remove savings rate * remove savings rate from debt param * update migrations * address review comments * Add usdx incentives calculation test (#765) * add usdx incentive calculation test * update reward calculation * add allowable error to test criteria * Update x/incentive/keeper/rewards_test.go Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> * fix: remove old fields from test genesis state Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com> Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2021-01-18 19:12:37 +00:00
cdpKeeper := cdp.NewKeeper(
2019-11-29 10:55:10 +00:00
app.cdc,
keys[cdp.StoreKey],
cdpSubspace,
app.pricefeedKeeper,
app.auctionKeeper,
app.supplyKeeper,
[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-28 02:54:00 +00:00
app.accountKeeper,
mAccPerms,
)
[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-28 02:54:00 +00:00
app.bep3Keeper = bep3.NewKeeper(
app.cdc,
keys[bep3.StoreKey],
app.supplyKeeper,
app.accountKeeper,
[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-28 02:54:00 +00:00
bep3Subspace,
app.ModuleAccountAddrs(),
)
hardKeeper := hard.NewKeeper(
app.cdc,
keys[hard.StoreKey],
hardSubspace,
app.accountKeeper,
app.supplyKeeper,
&stakingKeeper,
app.pricefeedKeeper,
app.auctionKeeper,
)
[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-28 02:54:00 +00:00
app.kavadistKeeper = kavadist.NewKeeper(
app.cdc,
keys[kavadist.StoreKey],
kavadistSubspace,
app.supplyKeeper,
)
app.incentiveKeeper = incentive.NewKeeper(
app.cdc,
keys[incentive.StoreKey],
incentiveSubspace,
app.supplyKeeper,
Cdp accumulators (#751) * Add 'InterestFactor' to CDP type (#734) * update cdp type to include interest factor * fix build * Add cdp accumulator methods (#735) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * Add sync cdp interest method (#737) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * remove old fee functions * add method to synchronize cdp interest * add multi-cdp tests * add test with many blocks * add test for interest getter * address review comments * calculate time difference then convert to seconds * fix: update collateral index when syncing interest * fix: differentiate between case when apy is zero and all fees are being rounded to zero * fix: round time difference properly * update cdp genesis state and migrations (#738) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * remove old fee functions * add method to synchronize cdp interest * add multi-cdp tests * add test with many blocks * add test for interest getter * update cdp genesis state and migrations * address review comments * calculate time difference then convert to seconds * fix: update collateral index when syncing interest * fix: differentiate between case when apy is zero and all fees are being rounded to zero * fix: simplify add/remove/update collateral index * update genesis state to include total principal amounts * update migration * Delete kava-4-cdp-state-block-500000.json * Add cdp liquidations by external keeper (#750) * feat: split liquidations between external keepers and automated begin blocker * address review comments * USDX incentive accumulators (#752) * feat: split liquidations between external keepers and automated begin blocker * wip: refactor usdx minting incentives to use accumulators/hooks * wip: refactor usdx minting claim object * feat: use accumulators/hooks for usdx minting rewards * fix: get tests passing * fix: don't create claim objects unless that cdp type is eligable for rewards * add begin blocker * update client * cleanup comments/tests * update querier * address review comments * fix: check for division by zero * address review comments * run hook before interest is synced * Remove savings rate (#764) * remove savings rate * remove savings rate from debt param * update migrations * address review comments * Add usdx incentives calculation test (#765) * add usdx incentive calculation test * update reward calculation * add allowable error to test criteria * Update x/incentive/keeper/rewards_test.go Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> * fix: remove old fields from test genesis state Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com> Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2021-01-18 19:12:37 +00:00
&cdpKeeper,
&hardKeeper,
app.accountKeeper,
&stakingKeeper,
)
app.issuanceKeeper = issuance.NewKeeper(
app.cdc,
keys[issuance.StoreKey],
issuanceSubspace,
app.accountKeeper,
app.supplyKeeper,
)
2019-06-20 13:37:57 +00:00
// register the staking hooks
2019-07-18 17:36:31 +00:00
// NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks
2019-06-20 13:37:57 +00:00
app.stakingKeeper = *stakingKeeper.SetHooks(
staking.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks(), app.incentiveKeeper.Hooks()))
2019-07-18 17:36:31 +00:00
Cdp accumulators (#751) * Add 'InterestFactor' to CDP type (#734) * update cdp type to include interest factor * fix build * Add cdp accumulator methods (#735) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * Add sync cdp interest method (#737) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * remove old fee functions * add method to synchronize cdp interest * add multi-cdp tests * add test with many blocks * add test for interest getter * address review comments * calculate time difference then convert to seconds * fix: update collateral index when syncing interest * fix: differentiate between case when apy is zero and all fees are being rounded to zero * fix: round time difference properly * update cdp genesis state and migrations (#738) * remame fees to interest * add accumulate interest method * add basic test * add note * address review comments * update tests * remove old fee functions * add method to synchronize cdp interest * add multi-cdp tests * add test with many blocks * add test for interest getter * update cdp genesis state and migrations * address review comments * calculate time difference then convert to seconds * fix: update collateral index when syncing interest * fix: differentiate between case when apy is zero and all fees are being rounded to zero * fix: simplify add/remove/update collateral index * update genesis state to include total principal amounts * update migration * Delete kava-4-cdp-state-block-500000.json * Add cdp liquidations by external keeper (#750) * feat: split liquidations between external keepers and automated begin blocker * address review comments * USDX incentive accumulators (#752) * feat: split liquidations between external keepers and automated begin blocker * wip: refactor usdx minting incentives to use accumulators/hooks * wip: refactor usdx minting claim object * feat: use accumulators/hooks for usdx minting rewards * fix: get tests passing * fix: don't create claim objects unless that cdp type is eligable for rewards * add begin blocker * update client * cleanup comments/tests * update querier * address review comments * fix: check for division by zero * address review comments * run hook before interest is synced * Remove savings rate (#764) * remove savings rate * remove savings rate from debt param * update migrations * address review comments * Add usdx incentives calculation test (#765) * add usdx incentive calculation test * update reward calculation * add allowable error to test criteria * Update x/incentive/keeper/rewards_test.go Co-authored-by: Kevin Davis <karzak@users.noreply.github.com> * fix: remove old fields from test genesis state Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com> Co-authored-by: Ruaridh <rhuairahrighairidh@users.noreply.github.com>
2021-01-18 19:12:37 +00:00
app.cdpKeeper = *cdpKeeper.SetHooks(cdp.NewMultiCDPHooks(app.incentiveKeeper.Hooks()))
app.hardKeeper = *hardKeeper.SetHooks(hard.NewMultiHARDHooks(app.incentiveKeeper.Hooks()))
2019-09-11 22:33:20 +00:00
// create the module manager (Note: Any module instantiated in the module manager that is later modified
// must be passed by reference here.)
2019-07-18 17:36:31 +00:00
app.mm = module.NewManager(
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx),
auth.NewAppModule(app.accountKeeper),
bank.NewAppModule(app.bankKeeper, app.accountKeeper),
2019-09-11 22:33:20 +00:00
crisis.NewAppModule(&app.crisisKeeper),
2019-07-18 17:36:31 +00:00
supply.NewAppModule(app.supplyKeeper, app.accountKeeper),
gov.NewAppModule(app.govKeeper, app.accountKeeper, app.supplyKeeper),
2019-07-18 17:36:31 +00:00
mint.NewAppModule(app.mintKeeper),
slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper),
distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.supplyKeeper, app.stakingKeeper),
2019-09-11 22:33:20 +00:00
staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
2020-05-07 20:34:05 +00:00
upgrade.NewAppModule(app.upgradeKeeper),
evidence.NewAppModule(app.evidenceKeeper),
2019-10-02 13:10:28 +00:00
validatorvesting.NewAppModule(app.vvKeeper, app.accountKeeper),
auction.NewAppModule(app.auctionKeeper, app.accountKeeper, app.supplyKeeper),
cdp.NewAppModule(app.cdpKeeper, app.accountKeeper, app.pricefeedKeeper, app.supplyKeeper),
pricefeed.NewAppModule(app.pricefeedKeeper, app.accountKeeper),
bep3.NewAppModule(app.bep3Keeper, app.accountKeeper, app.supplyKeeper),
[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-28 02:54:00 +00:00
kavadist.NewAppModule(app.kavadistKeeper, app.supplyKeeper),
incentive.NewAppModule(app.incentiveKeeper, app.accountKeeper, app.supplyKeeper, app.cdpKeeper),
2020-04-27 18:19:05 +00:00
committee.NewAppModule(app.committeeKeeper, app.accountKeeper),
issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.supplyKeeper),
2020-12-21 17:18:55 +00:00
hard.NewAppModule(app.hardKeeper, app.supplyKeeper, app.pricefeedKeeper),
2019-06-20 13:37:57 +00:00
)
2019-07-18 17:36:31 +00:00
// During begin block slashing happens after distr.BeginBlocker so that
// there is nothing left over in the validator fee pool, so as to keep the
// CanWithdrawInvariant invariant.
// Auction.BeginBlocker will close out expired auctions and pay debt back to cdp.
// So it should be run before cdp.BeginBlocker which cancels out debt with stable and starts more auctions.
2020-05-07 20:34:05 +00:00
app.mm.SetOrderBeginBlockers(
upgrade.ModuleName, mint.ModuleName, distr.ModuleName, slashing.ModuleName,
validatorvesting.ModuleName, kavadist.ModuleName, auction.ModuleName, committee.ModuleName, cdp.ModuleName,
bep3.ModuleName, hard.ModuleName, issuance.ModuleName, incentive.ModuleName,
2020-05-07 20:34:05 +00:00
)
2019-07-18 17:36:31 +00:00
app.mm.SetOrderEndBlockers(crisis.ModuleName, gov.ModuleName, staking.ModuleName, pricefeed.ModuleName)
2019-07-18 17:36:31 +00:00
2019-09-25 19:50:03 +00:00
app.mm.SetOrderInitGenesis(
auth.ModuleName, // loads all accounts - should run before any module with a module account
validatorvesting.ModuleName, distr.ModuleName,
2019-09-25 19:50:03 +00:00
staking.ModuleName, bank.ModuleName, slashing.ModuleName,
gov.ModuleName, mint.ModuleName, evidence.ModuleName,
pricefeed.ModuleName, cdp.ModuleName, hard.ModuleName, auction.ModuleName,
bep3.ModuleName, kavadist.ModuleName, incentive.ModuleName, committee.ModuleName, issuance.ModuleName,
supply.ModuleName, // calculates the total supply from account - should run after modules that modify accounts in genesis
crisis.ModuleName, // runs the invariants at genesis - should run after other modules
genutil.ModuleName, // genutils must occur after staking so that pools are properly initialized with tokens from genesis accounts.
2019-09-25 19:50:03 +00:00
)
2019-07-18 17:36:31 +00:00
app.mm.RegisterInvariants(&app.crisisKeeper)
app.mm.RegisterRoutes(app.Router(), app.QueryRouter())
2019-09-11 22:33:20 +00:00
// create the simulation manager and define the order of the modules for deterministic simulations
//
// NOTE: This is not required for apps that don't use the simulator for fuzz testing
// transactions.
app.sm = module.NewSimulationManager(
auth.NewAppModule(app.accountKeeper),
2019-10-02 13:10:28 +00:00
validatorvesting.NewAppModule(app.vvKeeper, app.accountKeeper),
2019-09-11 22:33:20 +00:00
bank.NewAppModule(app.bankKeeper, app.accountKeeper),
supply.NewAppModule(app.supplyKeeper, app.accountKeeper),
gov.NewAppModule(app.govKeeper, app.accountKeeper, app.supplyKeeper),
2019-09-11 22:33:20 +00:00
mint.NewAppModule(app.mintKeeper),
distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.supplyKeeper, app.stakingKeeper),
2019-09-11 22:33:20 +00:00
staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper),
pricefeed.NewAppModule(app.pricefeedKeeper, app.accountKeeper),
cdp.NewAppModule(app.cdpKeeper, app.accountKeeper, app.pricefeedKeeper, app.supplyKeeper),
auction.NewAppModule(app.auctionKeeper, app.accountKeeper, app.supplyKeeper),
bep3.NewAppModule(app.bep3Keeper, app.accountKeeper, app.supplyKeeper),
[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-28 02:54:00 +00:00
kavadist.NewAppModule(app.kavadistKeeper, app.supplyKeeper),
incentive.NewAppModule(app.incentiveKeeper, app.accountKeeper, app.supplyKeeper, app.cdpKeeper),
committee.NewAppModule(app.committeeKeeper, app.accountKeeper),
issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.supplyKeeper),
2020-12-21 17:18:55 +00:00
hard.NewAppModule(app.hardKeeper, app.supplyKeeper, app.pricefeedKeeper),
2019-09-11 22:33:20 +00:00
)
app.sm.RegisterStoreDecoders()
// initialize stores
app.MountKVStores(keys)
app.MountTransientStores(tkeys)
2019-07-18 17:36:31 +00:00
// initialize the app
app.SetInitChainer(app.InitChainer)
2019-06-20 13:37:57 +00:00
app.SetBeginBlocker(app.BeginBlocker)
var antehandler sdk.AnteHandler
if appOpts.MempoolEnableAuth {
var getAuthorizedAddresses ante.AddressFetcher = func(sdk.Context) []sdk.AccAddress { return appOpts.MempoolAuthAddresses }
antehandler = ante.NewAnteHandler(app.accountKeeper, app.supplyKeeper, auth.DefaultSigVerificationGasConsumer, app.bep3Keeper.GetAuthorizedAddresses, app.pricefeedKeeper.GetAuthorizedAddresses, getAuthorizedAddresses)
} else {
antehandler = ante.NewAnteHandler(app.accountKeeper, app.supplyKeeper, auth.DefaultSigVerificationGasConsumer)
}
app.SetAnteHandler(antehandler)
2019-06-20 13:37:57 +00:00
app.SetEndBlocker(app.EndBlocker)
2019-07-18 17:36:31 +00:00
// load store
if !appOpts.SkipLoadLatest {
2019-09-11 22:33:20 +00:00
err := app.LoadLatestVersion(app.keys[bam.MainStoreKey])
2019-06-20 13:37:57 +00:00
if err != nil {
tmos.Exit(err.Error())
2019-06-20 13:37:57 +00:00
}
}
return app
}
// custom tx codec
func MakeCodec() *codec.Codec {
var cdc = codec.New()
2019-09-11 22:33:20 +00:00
2019-07-18 17:36:31 +00:00
ModuleBasics.RegisterCodec(cdc)
2019-10-04 17:55:49 +00:00
vesting.RegisterCodec(cdc)
2019-06-20 13:37:57 +00:00
sdk.RegisterCodec(cdc)
codec.RegisterCrypto(cdc)
2019-09-11 22:33:20 +00:00
codec.RegisterEvidences(cdc)
return cdc.Seal()
2019-06-20 13:37:57 +00:00
}
// SetBech32AddressPrefixes sets the global prefix to be used when serializing addresses to bech32 strings.
2019-06-25 13:29:56 +00:00
func SetBech32AddressPrefixes(config *sdk.Config) {
config.SetBech32PrefixForAccount(Bech32MainPrefix, Bech32MainPrefix+sdk.PrefixPublic)
config.SetBech32PrefixForValidator(Bech32MainPrefix+sdk.PrefixValidator+sdk.PrefixOperator, Bech32MainPrefix+sdk.PrefixValidator+sdk.PrefixOperator+sdk.PrefixPublic)
config.SetBech32PrefixForConsensusNode(Bech32MainPrefix+sdk.PrefixValidator+sdk.PrefixConsensus, Bech32MainPrefix+sdk.PrefixValidator+sdk.PrefixConsensus+sdk.PrefixPublic)
}
// SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets.
func SetBip44CoinType(config *sdk.Config) {
config.SetCoinType(Bip44CoinType)
}
2019-06-20 13:37:57 +00:00
// application updates every end block
2019-06-20 17:02:29 +00:00
func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
2019-07-18 17:36:31 +00:00
return app.mm.BeginBlock(ctx, req)
2019-06-20 13:37:57 +00:00
}
// application updates every end block
2019-06-20 17:02:29 +00:00
func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
2019-07-18 17:36:31 +00:00
return app.mm.EndBlock(ctx, req)
2019-06-20 13:37:57 +00:00
}
2019-06-20 17:28:21 +00:00
// custom logic for app initialization
2019-07-18 17:36:31 +00:00
func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
2019-06-20 13:37:57 +00:00
var genesisState GenesisState
2019-07-18 17:36:31 +00:00
app.cdc.MustUnmarshalJSON(req.AppStateBytes, &genesisState)
return app.mm.InitGenesis(ctx, genesisState)
2019-06-20 13:37:57 +00:00
}
// load a particular height
2019-06-20 17:02:29 +00:00
func (app *App) LoadHeight(height int64) error {
2019-09-11 22:33:20 +00:00
return app.LoadVersion(height, app.keys[bam.MainStoreKey])
2019-06-20 13:37:57 +00:00
}
2019-07-18 17:36:31 +00:00
// ModuleAccountAddrs returns all the app's module account addresses.
func (app *App) ModuleAccountAddrs() map[string]bool {
modAccAddrs := make(map[string]bool)
for acc := range mAccPerms {
2019-09-11 22:33:20 +00:00
modAccAddrs[supply.NewModuleAddress(acc).String()] = true
2019-07-18 17:36:31 +00:00
}
2019-06-20 13:37:57 +00:00
2019-07-18 17:36:31 +00:00
return modAccAddrs
2019-06-20 13:37:57 +00:00
}
2019-09-11 22:33:20 +00:00
// BlacklistedAccAddrs returns all the app's module account addresses black listed for receiving tokens.
func (app *App) BlacklistedAccAddrs() map[string]bool {
blacklistedAddrs := make(map[string]bool)
for acc := range mAccPerms {
blacklistedAddrs[supply.NewModuleAddress(acc).String()] = !allowedReceivingModAcc[acc]
}
return blacklistedAddrs
}
2019-09-11 22:33:20 +00:00
// Codec returns the application's sealed codec.
func (app *App) Codec() *codec.Codec {
return app.cdc
}
// SimulationManager implements the SimulationApp interface
func (app *App) SimulationManager() *module.SimulationManager {
return app.sm
}
2019-09-11 22:33:20 +00:00
// GetMaccPerms returns a mapping of the application's module account permissions.
func GetMaccPerms() map[string][]string {
perms := make(map[string][]string)
for k, v := range mAccPerms {
perms[k] = v
}
return perms
}