2019-06-20 13:37:57 +00:00
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
2022-01-08 00:39:27 +00:00
|
|
|
"fmt"
|
2019-06-20 13:37:57 +00:00
|
|
|
"io"
|
2022-01-08 00:39:27 +00:00
|
|
|
stdlog "log"
|
2019-06-20 13:37:57 +00:00
|
|
|
"os"
|
2022-01-08 00:39:27 +00:00
|
|
|
"path/filepath"
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/baseapp"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
|
|
|
|
"github.com/cosmos/cosmos-sdk/client/rpc"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
2022-01-08 00:39:27 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/server/api"
|
|
|
|
"github.com/cosmos/cosmos-sdk/server/config"
|
|
|
|
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
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"
|
2022-01-08 00:39:27 +00:00
|
|
|
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
|
|
|
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
|
|
|
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
2019-10-04 17:55:49 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
2022-04-21 20:16:28 +00:00
|
|
|
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
|
2022-04-21 20:34:14 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/authz"
|
|
|
|
authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper"
|
|
|
|
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/bank"
|
2022-01-08 00:39:27 +00:00
|
|
|
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
|
|
|
|
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
|
|
|
"github.com/cosmos/cosmos-sdk/x/capability"
|
|
|
|
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper"
|
|
|
|
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/crisis"
|
2022-01-08 00:39:27 +00:00
|
|
|
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper"
|
|
|
|
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
2022-01-08 00:39:27 +00:00
|
|
|
distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client"
|
|
|
|
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper"
|
|
|
|
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
|
2020-04-23 16:35:58 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/evidence"
|
2022-01-08 00:39:27 +00:00
|
|
|
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"
|
|
|
|
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
|
2019-07-18 17:36:31 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/genutil"
|
2022-01-08 00:39:27 +00:00
|
|
|
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/gov"
|
2022-01-08 00:39:27 +00:00
|
|
|
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
|
|
|
|
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/mint"
|
2022-01-08 00:39:27 +00:00
|
|
|
mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper"
|
|
|
|
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/params"
|
2019-07-18 17:36:31 +00:00
|
|
|
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
|
2022-01-08 00:39:27 +00:00
|
|
|
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
|
|
|
|
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
|
|
|
|
paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/slashing"
|
2022-01-08 00:39:27 +00:00
|
|
|
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
|
|
|
|
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/staking"
|
2022-01-08 00:39:27 +00:00
|
|
|
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
|
|
|
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
2020-05-07 20:34:05 +00:00
|
|
|
"github.com/cosmos/cosmos-sdk/x/upgrade"
|
|
|
|
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
|
2022-01-08 00:39:27 +00:00
|
|
|
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
|
|
|
|
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
2022-04-21 20:16:28 +00:00
|
|
|
transfer "github.com/cosmos/ibc-go/v3/modules/apps/transfer"
|
|
|
|
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
|
|
|
|
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
|
|
|
|
ibc "github.com/cosmos/ibc-go/v3/modules/core"
|
|
|
|
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
|
|
|
|
ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client"
|
|
|
|
ibcclienttypes "github.com/cosmos/ibc-go/v3/modules/core/02-client/types"
|
|
|
|
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
|
|
|
|
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
|
|
|
|
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
|
2022-01-08 00:39:27 +00:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
|
|
tmjson "github.com/tendermint/tendermint/libs/json"
|
|
|
|
tmlog "github.com/tendermint/tendermint/libs/log"
|
|
|
|
dbm "github.com/tendermint/tm-db"
|
2022-04-21 20:16:28 +00:00
|
|
|
evmante "github.com/tharsis/ethermint/app/ante"
|
|
|
|
ethermintconfig "github.com/tharsis/ethermint/server/config"
|
|
|
|
ethermint "github.com/tharsis/ethermint/types"
|
|
|
|
"github.com/tharsis/ethermint/x/evm"
|
|
|
|
evmrest "github.com/tharsis/ethermint/x/evm/client/rest"
|
|
|
|
evmkeeper "github.com/tharsis/ethermint/x/evm/keeper"
|
|
|
|
evmtypes "github.com/tharsis/ethermint/x/evm/types"
|
|
|
|
"github.com/tharsis/ethermint/x/feemarket"
|
|
|
|
feemarketkeeper "github.com/tharsis/ethermint/x/feemarket/keeper"
|
|
|
|
feemarkettypes "github.com/tharsis/ethermint/x/feemarket/types"
|
2020-03-04 19:50:30 +00:00
|
|
|
|
2022-04-22 16:01:43 +00:00
|
|
|
"github.com/kava-labs/kava-bridge/x/bridge"
|
|
|
|
bridgekeeper "github.com/kava-labs/kava-bridge/x/bridge/keeper"
|
|
|
|
bridgetypes "github.com/kava-labs/kava-bridge/x/bridge/types"
|
|
|
|
|
2020-12-02 17:37:11 +00:00
|
|
|
"github.com/kava-labs/kava/app/ante"
|
2022-01-08 00:39:27 +00:00
|
|
|
kavaparams "github.com/kava-labs/kava/app/params"
|
2020-03-04 19:50:30 +00:00
|
|
|
"github.com/kava-labs/kava/x/auction"
|
2022-01-08 00:39:27 +00:00
|
|
|
auctionkeeper "github.com/kava-labs/kava/x/auction/keeper"
|
|
|
|
auctiontypes "github.com/kava-labs/kava/x/auction/types"
|
2020-04-27 14:55:20 +00:00
|
|
|
"github.com/kava-labs/kava/x/bep3"
|
2022-01-08 00:39:27 +00:00
|
|
|
bep3keeper "github.com/kava-labs/kava/x/bep3/keeper"
|
|
|
|
bep3types "github.com/kava-labs/kava/x/bep3/types"
|
2020-03-04 19:50:30 +00:00
|
|
|
"github.com/kava-labs/kava/x/cdp"
|
2022-01-08 00:39:27 +00:00
|
|
|
cdpkeeper "github.com/kava-labs/kava/x/cdp/keeper"
|
|
|
|
cdptypes "github.com/kava-labs/kava/x/cdp/types"
|
2020-03-10 22:29:16 +00:00
|
|
|
"github.com/kava-labs/kava/x/committee"
|
2022-01-08 00:39:27 +00:00
|
|
|
committeeclient "github.com/kava-labs/kava/x/committee/client"
|
|
|
|
committeekeeper "github.com/kava-labs/kava/x/committee/keeper"
|
|
|
|
committeetypes "github.com/kava-labs/kava/x/committee/types"
|
2022-04-21 20:16:28 +00:00
|
|
|
evmutil "github.com/kava-labs/kava/x/evmutil"
|
|
|
|
evmutilkeeper "github.com/kava-labs/kava/x/evmutil/keeper"
|
|
|
|
evmutiltypes "github.com/kava-labs/kava/x/evmutil/types"
|
2020-12-21 17:18:55 +00:00
|
|
|
"github.com/kava-labs/kava/x/hard"
|
2022-01-08 00:39:27 +00:00
|
|
|
hardkeeper "github.com/kava-labs/kava/x/hard/keeper"
|
|
|
|
hardtypes "github.com/kava-labs/kava/x/hard/types"
|
2020-04-27 14:55:20 +00:00
|
|
|
"github.com/kava-labs/kava/x/incentive"
|
2022-01-08 00:39:27 +00:00
|
|
|
incentivekeeper "github.com/kava-labs/kava/x/incentive/keeper"
|
|
|
|
incentivetypes "github.com/kava-labs/kava/x/incentive/types"
|
|
|
|
issuance "github.com/kava-labs/kava/x/issuance"
|
|
|
|
issuancekeeper "github.com/kava-labs/kava/x/issuance/keeper"
|
|
|
|
issuancetypes "github.com/kava-labs/kava/x/issuance/types"
|
2020-04-27 14:55:20 +00:00
|
|
|
"github.com/kava-labs/kava/x/kavadist"
|
2022-01-08 00:39:27 +00:00
|
|
|
kavadistclient "github.com/kava-labs/kava/x/kavadist/client"
|
|
|
|
kavadistkeeper "github.com/kava-labs/kava/x/kavadist/keeper"
|
|
|
|
kavadisttypes "github.com/kava-labs/kava/x/kavadist/types"
|
|
|
|
pricefeed "github.com/kava-labs/kava/x/pricefeed"
|
|
|
|
pricefeedkeeper "github.com/kava-labs/kava/x/pricefeed/keeper"
|
|
|
|
pricefeedtypes "github.com/kava-labs/kava/x/pricefeed/types"
|
2022-03-22 21:13:27 +00:00
|
|
|
savings "github.com/kava-labs/kava/x/savings"
|
|
|
|
savingskeeper "github.com/kava-labs/kava/x/savings/keeper"
|
|
|
|
savingstypes "github.com/kava-labs/kava/x/savings/types"
|
2021-06-08 15:19:12 +00:00
|
|
|
"github.com/kava-labs/kava/x/swap"
|
2022-01-08 00:39:27 +00:00
|
|
|
swapkeeper "github.com/kava-labs/kava/x/swap/keeper"
|
|
|
|
swaptypes "github.com/kava-labs/kava/x/swap/types"
|
2020-03-04 19:50:30 +00:00
|
|
|
validatorvesting "github.com/kava-labs/kava/x/validator-vesting"
|
2022-04-21 20:16:28 +00:00
|
|
|
validatorvestingtypes "github.com/kava-labs/kava/x/validator-vesting/types"
|
2019-06-20 13:37:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
2022-04-25 13:48:40 +00:00
|
|
|
appName = "kava"
|
2019-06-20 13:37:57 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2022-01-08 00:39:27 +00:00
|
|
|
// DefaultNodeHome default home directories for the application daemon
|
|
|
|
DefaultNodeHome string
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2022-01-08 00:39:27 +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{},
|
|
|
|
bank.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
capability.AppModuleBasic{},
|
2019-07-18 17:36:31 +00:00
|
|
|
staking.AppModuleBasic{},
|
|
|
|
mint.AppModuleBasic{},
|
|
|
|
distr.AppModuleBasic{},
|
2020-05-07 20:34:05 +00:00
|
|
|
gov.NewAppModuleBasic(
|
2022-01-08 00:39:27 +00:00
|
|
|
paramsclient.ProposalHandler,
|
|
|
|
distrclient.ProposalHandler,
|
|
|
|
upgradeclient.ProposalHandler,
|
|
|
|
upgradeclient.CancelProposalHandler,
|
|
|
|
ibcclientclient.UpdateClientProposalHandler,
|
|
|
|
ibcclientclient.UpgradeProposalHandler,
|
|
|
|
kavadistclient.ProposalHandler,
|
|
|
|
committeeclient.ProposalHandler,
|
2020-05-07 20:34:05 +00:00
|
|
|
),
|
2019-07-18 17:36:31 +00:00
|
|
|
params.AppModuleBasic{},
|
|
|
|
crisis.AppModuleBasic{},
|
|
|
|
slashing.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
ibc.AppModuleBasic{},
|
2020-05-07 20:34:05 +00:00
|
|
|
upgrade.AppModuleBasic{},
|
2020-04-23 16:35:58 +00:00
|
|
|
evidence.AppModuleBasic{},
|
2022-04-21 20:34:14 +00:00
|
|
|
authzmodule.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
transfer.AppModuleBasic{},
|
|
|
|
vesting.AppModuleBasic{},
|
2022-04-21 20:16:28 +00:00
|
|
|
evm.AppModuleBasic{},
|
|
|
|
feemarket.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
kavadist.AppModuleBasic{},
|
2019-11-29 10:55:10 +00:00
|
|
|
auction.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
issuance.AppModuleBasic{},
|
|
|
|
bep3.AppModuleBasic{},
|
2019-11-29 10:55:10 +00:00
|
|
|
pricefeed.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
swap.AppModuleBasic{},
|
|
|
|
cdp.AppModuleBasic{},
|
|
|
|
hard.AppModuleBasic{},
|
2020-03-10 22:29:16 +00:00
|
|
|
committee.AppModuleBasic{},
|
2020-04-24 15:20:34 +00:00
|
|
|
incentive.AppModuleBasic{},
|
2022-03-22 21:13:27 +00:00
|
|
|
savings.AppModuleBasic{},
|
2022-01-08 00:39:27 +00:00
|
|
|
validatorvesting.AppModuleBasic{},
|
2022-04-21 20:16:28 +00:00
|
|
|
evmutil.AppModuleBasic{},
|
2022-04-22 16:01:43 +00:00
|
|
|
bridge.AppModuleBasic{},
|
2019-07-18 17:36:31 +00:00
|
|
|
)
|
2019-09-11 22:33:20 +00:00
|
|
|
|
|
|
|
// module account permissions
|
2022-01-08 00:39:27 +00:00
|
|
|
// If these are changed, the permissions stored in accounts
|
|
|
|
// must also be migrated during a chain upgrade.
|
2019-09-11 22:33:20 +00:00
|
|
|
mAccPerms = map[string][]string{
|
2022-01-08 00:39:27 +00:00
|
|
|
authtypes.FeeCollectorName: nil,
|
|
|
|
distrtypes.ModuleName: nil,
|
|
|
|
minttypes.ModuleName: {authtypes.Minter},
|
|
|
|
stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking},
|
|
|
|
stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking},
|
|
|
|
govtypes.ModuleName: {authtypes.Burner},
|
|
|
|
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
|
2022-04-21 20:16:28 +00:00
|
|
|
evmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // used for secure addition and subtraction of balance using module account
|
|
|
|
evmutiltypes.ModuleName: nil,
|
2022-01-08 00:39:27 +00:00
|
|
|
kavadisttypes.KavaDistMacc: {authtypes.Minter},
|
|
|
|
auctiontypes.ModuleName: nil,
|
|
|
|
issuancetypes.ModuleAccountName: {authtypes.Minter, authtypes.Burner},
|
|
|
|
bep3types.ModuleName: {authtypes.Burner, authtypes.Minter},
|
|
|
|
swaptypes.ModuleName: nil,
|
|
|
|
cdptypes.ModuleName: {authtypes.Minter, authtypes.Burner},
|
|
|
|
cdptypes.LiquidatorMacc: {authtypes.Minter, authtypes.Burner},
|
|
|
|
hardtypes.ModuleAccountName: {authtypes.Minter},
|
2022-03-22 21:13:27 +00:00
|
|
|
savingstypes.ModuleAccountName: nil,
|
2022-04-22 16:01:43 +00:00
|
|
|
bridgetypes.ModuleName: {authtypes.Minter, authtypes.Burner},
|
2020-05-21 04:50:12 +00:00
|
|
|
}
|
2019-09-11 22:33:20 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2020-04-23 16:35:58 +00:00
|
|
|
// Verify app interface at compile time
|
2022-01-08 00:39:27 +00:00
|
|
|
// var _ simapp.App = (*App)(nil) // TODO
|
|
|
|
var _ servertypes.Application = (*App)(nil)
|
2020-04-23 16:35:58 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// Options bundles several configuration params for an App.
|
|
|
|
type Options struct {
|
|
|
|
SkipLoadLatest bool
|
|
|
|
SkipUpgradeHeights map[int64]bool
|
|
|
|
SkipGenesisInvariants bool
|
|
|
|
InvariantCheckPeriod uint
|
|
|
|
MempoolEnableAuth bool
|
|
|
|
MempoolAuthAddresses []sdk.AccAddress
|
2022-04-21 20:16:28 +00:00
|
|
|
EVMTrace string
|
|
|
|
EVMMaxGasWanted uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
// DefaultOptions is a sensible default Options value.
|
|
|
|
var DefaultOptions = Options{
|
|
|
|
EVMTrace: ethermintconfig.DefaultEVMTracer,
|
|
|
|
EVMMaxGasWanted: ethermintconfig.DefaultMaxTxGasWanted,
|
2020-12-02 17:37:11 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// App is the Kava ABCI application.
|
2019-06-20 17:02:29 +00:00
|
|
|
type App struct {
|
2022-01-08 00:39:27 +00:00
|
|
|
*baseapp.BaseApp
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// codec
|
|
|
|
legacyAmino *codec.LegacyAmino
|
|
|
|
appCodec codec.Codec
|
|
|
|
interfaceRegistry types.InterfaceRegistry
|
2019-06-20 13:37:57 +00:00
|
|
|
|
|
|
|
// keys to access the substores
|
2022-01-08 00:39:27 +00:00
|
|
|
keys map[string]*sdk.KVStoreKey
|
|
|
|
tkeys map[string]*sdk.TransientStoreKey
|
|
|
|
memKeys map[string]*sdk.MemoryStoreKey
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-07-26 12:11:23 +00:00
|
|
|
// keepers from all the modules
|
2022-01-08 00:39:27 +00:00
|
|
|
accountKeeper authkeeper.AccountKeeper
|
|
|
|
bankKeeper bankkeeper.Keeper
|
|
|
|
capabilityKeeper *capabilitykeeper.Keeper
|
|
|
|
stakingKeeper stakingkeeper.Keeper
|
|
|
|
mintKeeper mintkeeper.Keeper
|
|
|
|
distrKeeper distrkeeper.Keeper
|
|
|
|
govKeeper govkeeper.Keeper
|
|
|
|
paramsKeeper paramskeeper.Keeper
|
2022-04-21 20:34:14 +00:00
|
|
|
authzKeeper authzkeeper.Keeper
|
2022-01-08 00:39:27 +00:00
|
|
|
crisisKeeper crisiskeeper.Keeper
|
|
|
|
slashingKeeper slashingkeeper.Keeper
|
|
|
|
ibcKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly
|
2022-04-21 20:16:28 +00:00
|
|
|
evmKeeper *evmkeeper.Keeper
|
|
|
|
evmutilKeeper evmutilkeeper.Keeper
|
|
|
|
feeMarketKeeper feemarketkeeper.Keeper
|
2022-01-08 00:39:27 +00:00
|
|
|
upgradeKeeper upgradekeeper.Keeper
|
|
|
|
evidenceKeeper evidencekeeper.Keeper
|
|
|
|
transferKeeper ibctransferkeeper.Keeper
|
|
|
|
kavadistKeeper kavadistkeeper.Keeper
|
|
|
|
auctionKeeper auctionkeeper.Keeper
|
|
|
|
issuanceKeeper issuancekeeper.Keeper
|
|
|
|
bep3Keeper bep3keeper.Keeper
|
|
|
|
pricefeedKeeper pricefeedkeeper.Keeper
|
|
|
|
swapKeeper swapkeeper.Keeper
|
|
|
|
cdpKeeper cdpkeeper.Keeper
|
|
|
|
hardKeeper hardkeeper.Keeper
|
|
|
|
committeeKeeper committeekeeper.Keeper
|
|
|
|
incentiveKeeper incentivekeeper.Keeper
|
2022-03-22 21:13:27 +00:00
|
|
|
savingsKeeper savingskeeper.Keeper
|
2022-01-08 00:39:27 +00:00
|
|
|
|
2022-04-22 16:01:43 +00:00
|
|
|
bridgeKeeper bridgekeeper.Keeper
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// make scoped keepers public for test purposes
|
|
|
|
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
|
|
|
|
ScopedTransferKeeper capabilitykeeper.ScopedKeeper
|
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
|
2022-01-08 00:39:27 +00:00
|
|
|
|
|
|
|
// configurator
|
|
|
|
configurator module.Configurator
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
func init() {
|
|
|
|
userHomeDir, err := os.UserHomeDir()
|
|
|
|
if err != nil {
|
|
|
|
stdlog.Printf("Failed to get home dir %v", err)
|
|
|
|
}
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
DefaultNodeHome = filepath.Join(userHomeDir, ".kava")
|
|
|
|
}
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// NewApp returns a reference to an initialized App.
|
|
|
|
func NewApp(
|
|
|
|
logger tmlog.Logger,
|
|
|
|
db dbm.DB,
|
|
|
|
homePath string,
|
|
|
|
traceStore io.Writer,
|
|
|
|
encodingConfig kavaparams.EncodingConfig,
|
|
|
|
options Options,
|
|
|
|
baseAppOptions ...func(*baseapp.BaseApp),
|
|
|
|
) *App {
|
|
|
|
appCodec := encodingConfig.Marshaler
|
|
|
|
legacyAmino := encodingConfig.Amino
|
|
|
|
interfaceRegistry := encodingConfig.InterfaceRegistry
|
|
|
|
|
|
|
|
bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...)
|
2019-06-20 13:37:57 +00:00
|
|
|
bApp.SetCommitMultiStoreTracer(traceStore)
|
2022-01-08 00:39:27 +00:00
|
|
|
bApp.SetVersion(version.Version)
|
|
|
|
bApp.SetInterfaceRegistry(interfaceRegistry)
|
2019-06-20 13:37:57 +00:00
|
|
|
|
2019-09-11 22:33:20 +00:00
|
|
|
keys := sdk.NewKVStoreKeys(
|
2022-01-08 00:39:27 +00:00
|
|
|
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
|
|
|
|
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
|
|
|
|
govtypes.StoreKey, paramstypes.StoreKey, ibchost.StoreKey,
|
|
|
|
upgradetypes.StoreKey, evidencetypes.StoreKey, ibctransfertypes.StoreKey,
|
2022-04-21 20:34:14 +00:00
|
|
|
evmtypes.StoreKey, feemarkettypes.StoreKey, authzkeeper.StoreKey,
|
2022-01-08 00:39:27 +00:00
|
|
|
capabilitytypes.StoreKey, kavadisttypes.StoreKey, auctiontypes.StoreKey,
|
|
|
|
issuancetypes.StoreKey, bep3types.StoreKey, pricefeedtypes.StoreKey,
|
|
|
|
swaptypes.StoreKey, cdptypes.StoreKey, hardtypes.StoreKey,
|
2022-04-21 20:16:28 +00:00
|
|
|
committeetypes.StoreKey, incentivetypes.StoreKey, evmutiltypes.StoreKey,
|
2022-04-22 16:01:43 +00:00
|
|
|
savingstypes.StoreKey, bridgetypes.StoreKey,
|
2019-09-11 22:33:20 +00:00
|
|
|
)
|
2022-04-21 20:16:28 +00:00
|
|
|
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey)
|
2022-01-08 00:39:27 +00:00
|
|
|
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
2019-09-11 22:33:20 +00:00
|
|
|
|
2022-05-09 18:37:36 +00:00
|
|
|
app := &App{
|
2022-01-08 00:39:27 +00:00
|
|
|
BaseApp: bApp,
|
|
|
|
legacyAmino: legacyAmino,
|
|
|
|
appCodec: appCodec,
|
|
|
|
interfaceRegistry: interfaceRegistry,
|
|
|
|
keys: keys,
|
|
|
|
tkeys: tkeys,
|
|
|
|
memKeys: memKeys,
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// init params keeper and subspaces
|
2022-01-08 00:39:27 +00:00
|
|
|
app.paramsKeeper = paramskeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
legacyAmino,
|
|
|
|
keys[paramstypes.StoreKey],
|
|
|
|
tkeys[paramstypes.TStoreKey],
|
|
|
|
)
|
|
|
|
authSubspace := app.paramsKeeper.Subspace(authtypes.ModuleName)
|
|
|
|
bankSubspace := app.paramsKeeper.Subspace(banktypes.ModuleName)
|
|
|
|
stakingSubspace := app.paramsKeeper.Subspace(stakingtypes.ModuleName)
|
|
|
|
mintSubspace := app.paramsKeeper.Subspace(minttypes.ModuleName)
|
|
|
|
distrSubspace := app.paramsKeeper.Subspace(distrtypes.ModuleName)
|
|
|
|
slashingSubspace := app.paramsKeeper.Subspace(slashingtypes.ModuleName)
|
|
|
|
govSubspace := app.paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govtypes.ParamKeyTable())
|
|
|
|
crisisSubspace := app.paramsKeeper.Subspace(crisistypes.ModuleName)
|
|
|
|
kavadistSubspace := app.paramsKeeper.Subspace(kavadisttypes.ModuleName)
|
|
|
|
auctionSubspace := app.paramsKeeper.Subspace(auctiontypes.ModuleName)
|
|
|
|
issuanceSubspace := app.paramsKeeper.Subspace(issuancetypes.ModuleName)
|
|
|
|
bep3Subspace := app.paramsKeeper.Subspace(bep3types.ModuleName)
|
|
|
|
pricefeedSubspace := app.paramsKeeper.Subspace(pricefeedtypes.ModuleName)
|
|
|
|
swapSubspace := app.paramsKeeper.Subspace(swaptypes.ModuleName)
|
|
|
|
cdpSubspace := app.paramsKeeper.Subspace(cdptypes.ModuleName)
|
|
|
|
hardSubspace := app.paramsKeeper.Subspace(hardtypes.ModuleName)
|
|
|
|
incentiveSubspace := app.paramsKeeper.Subspace(incentivetypes.ModuleName)
|
2022-03-22 21:13:27 +00:00
|
|
|
savingsSubspace := app.paramsKeeper.Subspace(savingstypes.ModuleName)
|
2022-01-08 00:39:27 +00:00
|
|
|
ibcSubspace := app.paramsKeeper.Subspace(ibchost.ModuleName)
|
|
|
|
ibctransferSubspace := app.paramsKeeper.Subspace(ibctransfertypes.ModuleName)
|
2022-04-21 20:16:28 +00:00
|
|
|
feemarketSubspace := app.paramsKeeper.Subspace(feemarkettypes.ModuleName)
|
|
|
|
evmSubspace := app.paramsKeeper.Subspace(evmtypes.ModuleName)
|
2022-04-22 16:01:43 +00:00
|
|
|
bridgeSubspace := app.paramsKeeper.Subspace(bridgetypes.ModuleName)
|
2022-01-08 00:39:27 +00:00
|
|
|
|
|
|
|
bApp.SetParamStore(
|
|
|
|
app.paramsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramskeeper.ConsensusParamsKeyTable()),
|
|
|
|
)
|
|
|
|
app.capabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])
|
|
|
|
scopedIBCKeeper := app.capabilityKeeper.ScopeToModule(ibchost.ModuleName)
|
|
|
|
scopedTransferKeeper := app.capabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)
|
|
|
|
app.capabilityKeeper.Seal()
|
2019-07-18 17:36:31 +00:00
|
|
|
|
|
|
|
// add keepers
|
2022-01-08 00:39:27 +00:00
|
|
|
app.accountKeeper = authkeeper.NewAccountKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[authtypes.StoreKey],
|
2019-07-18 17:36:31 +00:00
|
|
|
authSubspace,
|
2022-04-21 20:16:28 +00:00
|
|
|
ethermint.ProtoAccount,
|
2022-01-08 00:39:27 +00:00
|
|
|
mAccPerms,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper = bankkeeper.NewBaseKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[banktypes.StoreKey],
|
2019-06-20 13:37:57 +00:00
|
|
|
app.accountKeeper,
|
2019-07-18 17:36:31 +00:00
|
|
|
bankSubspace,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.loadBlockedMaccAddrs(),
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.stakingKeeper = stakingkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[stakingtypes.StoreKey],
|
2019-07-18 17:36:31 +00:00
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
stakingSubspace,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-04-25 13:48:40 +00:00
|
|
|
app.authzKeeper = authzkeeper.NewKeeper(
|
|
|
|
keys[authzkeeper.StoreKey],
|
|
|
|
appCodec,
|
|
|
|
app.BaseApp.MsgServiceRouter(),
|
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.mintKeeper = mintkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[minttypes.StoreKey],
|
2019-07-18 17:36:31 +00:00
|
|
|
mintSubspace,
|
2022-01-08 00:39:27 +00:00
|
|
|
&app.stakingKeeper,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
authtypes.FeeCollectorName,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.distrKeeper = distrkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[distrtypes.StoreKey],
|
2019-07-18 17:36:31 +00:00
|
|
|
distrSubspace,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
&app.stakingKeeper,
|
|
|
|
authtypes.FeeCollectorName,
|
2020-04-23 16:35:58 +00:00
|
|
|
app.ModuleAccountAddrs(),
|
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.slashingKeeper = slashingkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[slashingtypes.StoreKey],
|
|
|
|
&app.stakingKeeper,
|
2019-07-18 17:36:31 +00:00
|
|
|
slashingSubspace,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.crisisKeeper = crisiskeeper.NewKeeper(
|
2019-07-18 17:36:31 +00:00
|
|
|
crisisSubspace,
|
2022-01-08 00:39:27 +00:00
|
|
|
options.InvariantCheckPeriod,
|
|
|
|
app.bankKeeper,
|
|
|
|
authtypes.FeeCollectorName,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.upgradeKeeper = upgradekeeper.NewKeeper(
|
|
|
|
options.SkipUpgradeHeights,
|
|
|
|
keys[upgradetypes.StoreKey],
|
|
|
|
appCodec,
|
|
|
|
homePath,
|
|
|
|
app.BaseApp,
|
2020-05-07 20:34:05 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.evidenceKeeper = *evidencekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[evidencetypes.StoreKey],
|
2020-04-23 16:35:58 +00:00
|
|
|
&app.stakingKeeper,
|
|
|
|
app.slashingKeeper,
|
|
|
|
)
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.ibcKeeper = ibckeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[ibchost.StoreKey],
|
|
|
|
ibcSubspace,
|
|
|
|
app.stakingKeeper,
|
|
|
|
app.upgradeKeeper,
|
|
|
|
scopedIBCKeeper,
|
2021-06-02 17:03:25 +00:00
|
|
|
)
|
2020-04-27 14:55:20 +00:00
|
|
|
|
2022-04-21 20:16:28 +00:00
|
|
|
// Create Ethermint keepers
|
|
|
|
app.feeMarketKeeper = feemarketkeeper.NewKeeper(
|
|
|
|
appCodec, keys[feemarkettypes.StoreKey], feemarketSubspace,
|
|
|
|
)
|
|
|
|
|
|
|
|
app.evmutilKeeper = evmutilkeeper.NewKeeper(
|
|
|
|
app.appCodec,
|
|
|
|
keys[evmutiltypes.StoreKey],
|
|
|
|
)
|
|
|
|
|
|
|
|
evmBankKeeper := evmutilkeeper.NewEvmBankKeeper(app.evmutilKeeper, app.bankKeeper, app.accountKeeper)
|
|
|
|
app.evmKeeper = evmkeeper.NewKeeper(
|
|
|
|
appCodec, keys[evmtypes.StoreKey], tkeys[evmtypes.TransientKey], evmSubspace,
|
|
|
|
app.accountKeeper, evmBankKeeper, app.stakingKeeper, app.feeMarketKeeper,
|
|
|
|
options.EVMTrace,
|
|
|
|
)
|
|
|
|
|
2022-02-03 01:30:05 +00:00
|
|
|
app.kavadistKeeper = kavadistkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[kavadisttypes.StoreKey],
|
|
|
|
kavadistSubspace,
|
|
|
|
app.bankKeeper,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.distrKeeper,
|
|
|
|
app.ModuleAccountAddrs(),
|
|
|
|
)
|
|
|
|
|
2022-04-22 16:01:43 +00:00
|
|
|
// BridgeKeeper must be assigned before EvmKeeper hooks are set
|
|
|
|
app.bridgeKeeper = bridgekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[bridgetypes.StoreKey],
|
|
|
|
bridgeSubspace,
|
|
|
|
app.bankKeeper,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.evmKeeper,
|
|
|
|
)
|
|
|
|
|
|
|
|
app.evmKeeper = app.evmKeeper.SetHooks(
|
|
|
|
evmkeeper.NewMultiEvmHooks(
|
|
|
|
app.bridgeKeeper.WithdrawHooks(),
|
|
|
|
app.bridgeKeeper.ConversionHooks(),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.transferKeeper = ibctransferkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[ibctransfertypes.StoreKey],
|
|
|
|
ibctransferSubspace,
|
|
|
|
app.ibcKeeper.ChannelKeeper,
|
2022-04-21 20:16:28 +00:00
|
|
|
app.ibcKeeper.ChannelKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
&app.ibcKeeper.PortKeeper,
|
2019-10-02 13:10:28 +00:00
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
scopedTransferKeeper,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
transferModule := transfer.NewAppModule(app.transferKeeper)
|
2022-04-21 20:16:28 +00:00
|
|
|
transferIBCModule := transfer.NewIBCModule(app.transferKeeper)
|
2022-01-08 00:39:27 +00:00
|
|
|
|
|
|
|
// Create static IBC router, add transfer route, then set and seal it
|
|
|
|
ibcRouter := porttypes.NewRouter()
|
2022-04-21 20:16:28 +00:00
|
|
|
ibcRouter.AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.ibcKeeper.SetRouter(ibcRouter)
|
|
|
|
|
|
|
|
app.auctionKeeper = auctionkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[auctiontypes.StoreKey],
|
2020-04-23 16:35:58 +00:00
|
|
|
auctionSubspace,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper,
|
|
|
|
app.accountKeeper,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.issuanceKeeper = issuancekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[issuancetypes.StoreKey],
|
|
|
|
issuanceSubspace,
|
[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,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper,
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bep3Keeper = bep3keeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[bep3types.StoreKey],
|
|
|
|
app.bankKeeper,
|
2020-05-06 17:56:43 +00:00
|
|
|
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,
|
2020-05-21 04:50:12 +00:00
|
|
|
app.ModuleAccountAddrs(),
|
2020-04-23 16:35:58 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.pricefeedKeeper = pricefeedkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[pricefeedtypes.StoreKey],
|
|
|
|
pricefeedSubspace,
|
|
|
|
)
|
|
|
|
swapKeeper := swapkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[swaptypes.StoreKey],
|
|
|
|
swapSubspace,
|
2021-01-21 13:52:09 +00:00
|
|
|
app.accountKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper,
|
|
|
|
)
|
|
|
|
cdpKeeper := cdpkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[cdptypes.StoreKey],
|
|
|
|
cdpSubspace,
|
2021-01-21 13:52:09 +00:00
|
|
|
app.pricefeedKeeper,
|
|
|
|
app.auctionKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper,
|
2020-08-17 17:09:02 +00:00
|
|
|
app.accountKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
mAccPerms,
|
2020-08-17 17:09:02 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
hardKeeper := hardkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[hardtypes.StoreKey],
|
|
|
|
hardSubspace,
|
Squash merge swap-acceptance branch (#956)
* add failing acceptance test for a user depositing into a pool
* implement GetAccount test helper
* implement swap.MsgDeposit for creating and adding liquidity to a pool
* update aliases, add event types, and fix typo/compiler errors in handler
test
* use only aliases names in handler test (don't use swap types -- ensures
we have run aliasgen), add assertion for even type message
* implement account and module account balance checks in handler test
* fill out handler assertions for testing keeper state and events
* update signed json representation and register swap/MsgDeposit for
proper encoding
* fill out boilerplate to get handler test to compile
* alias gen for pool
* add handling of message type; fill in deposit keeper method for
succesful compile; noop but test assertions now run up to module acc not
nil check
* add module account permissions for swap module -- fixes module account
creation; pass account keeper and supply keeper into swap keeper to
allow the ability to work with user and module accounts
* implement create pool logic for msg deposit; allows creation of a of new
pool, checking params to see if it is allowed. Initi shares are set,
and senders number of shares are stored
* Swap migrations scaffolding (#925)
* swap module scaffolding
* global swap fee
* can't think of a reason for begin blocker; removing for abci.go for now;
* test pair types; refactor pair name logic; simplify pairs validation and
fix stack overflow error
* check comparison
* use test package
* init swap module genesis
* add basic marshall tests
* remove reward apy from pairs
* fix integration helpers
* use max swap fee constant; fix validation of swap fee; add tests to
cover param validation and param set setup
* use noerror over nil
* start genesis tests
* test param set validation mirrors param validation
* add genesis tests
* remove print statement
* add subtests for genesis test cases; add extra querier test for unknown
route; add keeper params testing
* add spec
* update swagger
* find replace hard -> swap in comments
* remove unused method
* rename pairs to allowed pools; pool is more commonly used, and
allowedPool makes it more clear what swap parameter is for. In
addition, we won't conflict with Pool data structure for storing a
created pool in the store.
* remove generated link
* missed spec rename
* validate token order for allowed pools
* fix swagger
* json should be snakecase; change allowedPools to allowed_pools
* add legacy types
* add swap genesis to v0_15 migration
* add legacy types
* add swap genesis to v0_15 migration
* migration revisions
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
* keeper todos
* update keeper tests
* type todos
* update types tests
* tx deposit cli cmd
* tx deposit rest
* Swap module simulation scaffolding (#924)
* sims scaffolding
* add noop operation
* genesis revisions
* add param changes
* mvoe persistance methods to main keeper file, consolidate tests
* make helper methods private. they are tested via deposit method, and
unit testing them would make test suite brittle and refactoring
difficult
* use more clear coin variables
* code 1 is reserved, use code 2 and sequence all errors
* remove todo
* Implement deadline for swap module module message. This is implemented in
handler with a interface to easily apply to it to all messages, and
separate msg validation concerns from the keeper
* move allowed pools to params -- let pool and pool_test focus on pool domain logic, not
parameter & governance concerns
* update alias
* add unitless implementatin of constant product liquidity pool to
isolate and enapsulate liquidity logic. Swap methods interfaces are
added, but implementation not yet added
* nits and todos
* add ErrInvalidPool
* add tests for edge cases around pool depletion; add explicit panic for
edge case that results in a pool reserve being zero; handle pool
reinitialization if it is empty
* touch up comments and flush out the rest of assertions
* add data structures for keeper state storage separate from pool domain
objects, and improve structure for easier querying
* rename pool name to pool key for events
* add support for a denominated pool that uses sdk.Coins and sdk.Coin
arguments, keeping tracking of the units in the base pool. This gives
nice separation between pool logic, and coin/denom logic
* refactor keeper to use new records for storage, and implement pool
deposit using the denominated pool
* address previous PR comment - reminder for migration if changing
account permissions
* msg deposit should validate that denoms are not equal
* add godoc comments
* golint and some poolName -> poolID cleanup
* implement adding liquidity to an existing pool
* hardcode pools in sims
* touch up comment
* withdraw keeper logic
* withdraw type updates
* add withdraw msg tx handler
* initial withdraw test
* fix panic
* use new denominated pool with existing shares
* fix: check args on deposit cmd
* add slippage limit check for depositing to an existing pool
* send coins just before event emission
* check liquidity returned is greater than zero for both coins; ensure
returned number of shares are greater than zero
* add deadline to msgwithdraw
* register msgwithdraw
* scaffold msgwithdraw types test
* register the correct msg
* modify swap functions to also return the amount paid for the pool swap
fee. This will be used to calculate slippage and for event tracking
* add slippage types
* add expected withdrawal coins
* calculate slippage against expected coins
* update withdraw keeper tests
* spelling, improve comments on add liquidity math
* typo
* typo
* grammer
* typo / grammer
* remove pool_id from withdraw msg
* add slippage to tx cmd
* TestWithdraw_Partial
* nit
* add withdraw no pool, no deposit record tests
* drop event check on partial withdraw test
* fix broken link
* fix broken link
* resolve merge conflicts
* ensure swap fee can not be equal to 1; add full implementation of swap
pool methods; these implementation ensure that the pool invariant is
always greater or equal to the previous invariant
* refactor duplicated code into private swap methods
* add runtime assertion to always ensure invariant is greater or equal
to the previous invariant sub fee on swaps
* improve comments for base pool swap functions
* add swap exact input and output methods to denominated pool that wrap
the base pool interface for swapping
* comment touch ups
* more comment touchups
* fix msg deposit struct tag (#943)
* use better name for swap calculation private methods
* nits: golint
* fix misspelling in method name
* Add HARD token governance committee for Hard module (#941)
* add hard gov token committee
* revisions: update migration
* revisions: update test/data file
* initial revisions
* add TokenCommittee JSONMarshal test
* fix SetPermissions method
* remove BaseCommittee Type field
* add incentive params to allowed params
* Add SWP token governance committee for Swap module (#946)
* add swp token commitee to migration
* update test, add gen export utility method
* final revisions: add TODO
* remove slippage from withdraw to use min values for coins; add
additional validation test cases
* update alias for swap module
* add withdraw tests to handler for increased coverage; note: first pass,
improvements still yet to be made here
* refact withdraw keeper to use min amounts; panic for cases that do not
happen in normal situations
* lint fixes
* use total shares to track if pool should be deleted; add more in depth
withdraw comment
* add exact args for withdraw cmd
* extract record update methods
* update depositor share record if it exists -- do not overwrite an
existing record; ensures no loss of shares if the same address deposits
more than once
* Swap queries: deposit, pool, pools (#949)
* query deposits types
* implement deposit querier keeper methods
* query deposits CLI
* query deposits REST
* query types for pool/pools
* pool/pools querier keeper methods
* pool/pools CLI
* pool/pools REST
* basic pool/pools query tests
* basic deposit querier test
* iterate share records via owner bytes
* nit: add example for querying deposits by owner only
Co-authored-by: karzak <kjydavis3@gmail.com>
* feat: add REST tx handler for swap LP withdrawals
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-07-13 11:38:15 +00:00
|
|
|
app.accountKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper,
|
|
|
|
app.pricefeedKeeper,
|
|
|
|
app.auctionKeeper,
|
2021-06-08 15:19:12 +00:00
|
|
|
)
|
2022-04-20 11:08:57 +00:00
|
|
|
savingsKeeper := savingskeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[savingstypes.StoreKey],
|
|
|
|
savingsSubspace,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.incentiveKeeper = incentivekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[incentivetypes.StoreKey],
|
2021-07-07 13:23:06 +00:00
|
|
|
incentiveSubspace,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.bankKeeper,
|
2021-07-07 13:23:06 +00:00
|
|
|
&cdpKeeper,
|
|
|
|
&hardKeeper,
|
|
|
|
app.accountKeeper,
|
2022-01-08 00:39:27 +00:00
|
|
|
app.stakingKeeper,
|
Swap users accumulate rewards (#950)
* add swap claim type
* add store methods for swap claims
* add swap claims to genesis state
* tidy up cdp and hard hook doc comments
* add uncalled hooks to the swap keeper
* add swap rewards sync method
* add swap rewards init method
* connect swap rewards via swap hooks
* Update querier and client for swap claims (#951)
* refactor querier to dedupe code
* add swap claims querier endpoint
* add swap claim querying to rest
* add swap claim querying to cli
* add keeper method to iterate swap reward indexes
* simplify reward-factors query endpoint, add swap
* update swap hook to match latest swap branch
* rename func to not collide with latest swap branch
* Squash merge swap-acceptance branch (#956)
* add failing acceptance test for a user depositing into a pool
* implement GetAccount test helper
* implement swap.MsgDeposit for creating and adding liquidity to a pool
* update aliases, add event types, and fix typo/compiler errors in handler
test
* use only aliases names in handler test (don't use swap types -- ensures
we have run aliasgen), add assertion for even type message
* implement account and module account balance checks in handler test
* fill out handler assertions for testing keeper state and events
* update signed json representation and register swap/MsgDeposit for
proper encoding
* fill out boilerplate to get handler test to compile
* alias gen for pool
* add handling of message type; fill in deposit keeper method for
succesful compile; noop but test assertions now run up to module acc not
nil check
* add module account permissions for swap module -- fixes module account
creation; pass account keeper and supply keeper into swap keeper to
allow the ability to work with user and module accounts
* implement create pool logic for msg deposit; allows creation of a of new
pool, checking params to see if it is allowed. Initi shares are set,
and senders number of shares are stored
* Swap migrations scaffolding (#925)
* swap module scaffolding
* global swap fee
* can't think of a reason for begin blocker; removing for abci.go for now;
* test pair types; refactor pair name logic; simplify pairs validation and
fix stack overflow error
* check comparison
* use test package
* init swap module genesis
* add basic marshall tests
* remove reward apy from pairs
* fix integration helpers
* use max swap fee constant; fix validation of swap fee; add tests to
cover param validation and param set setup
* use noerror over nil
* start genesis tests
* test param set validation mirrors param validation
* add genesis tests
* remove print statement
* add subtests for genesis test cases; add extra querier test for unknown
route; add keeper params testing
* add spec
* update swagger
* find replace hard -> swap in comments
* remove unused method
* rename pairs to allowed pools; pool is more commonly used, and
allowedPool makes it more clear what swap parameter is for. In
addition, we won't conflict with Pool data structure for storing a
created pool in the store.
* remove generated link
* missed spec rename
* validate token order for allowed pools
* fix swagger
* json should be snakecase; change allowedPools to allowed_pools
* add legacy types
* add swap genesis to v0_15 migration
* add legacy types
* add swap genesis to v0_15 migration
* migration revisions
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
* keeper todos
* update keeper tests
* type todos
* update types tests
* tx deposit cli cmd
* tx deposit rest
* Swap module simulation scaffolding (#924)
* sims scaffolding
* add noop operation
* genesis revisions
* add param changes
* mvoe persistance methods to main keeper file, consolidate tests
* make helper methods private. they are tested via deposit method, and
unit testing them would make test suite brittle and refactoring
difficult
* use more clear coin variables
* code 1 is reserved, use code 2 and sequence all errors
* remove todo
* Implement deadline for swap module module message. This is implemented in
handler with a interface to easily apply to it to all messages, and
separate msg validation concerns from the keeper
* move allowed pools to params -- let pool and pool_test focus on pool domain logic, not
parameter & governance concerns
* update alias
* add unitless implementatin of constant product liquidity pool to
isolate and enapsulate liquidity logic. Swap methods interfaces are
added, but implementation not yet added
* nits and todos
* add ErrInvalidPool
* add tests for edge cases around pool depletion; add explicit panic for
edge case that results in a pool reserve being zero; handle pool
reinitialization if it is empty
* touch up comments and flush out the rest of assertions
* add data structures for keeper state storage separate from pool domain
objects, and improve structure for easier querying
* rename pool name to pool key for events
* add support for a denominated pool that uses sdk.Coins and sdk.Coin
arguments, keeping tracking of the units in the base pool. This gives
nice separation between pool logic, and coin/denom logic
* refactor keeper to use new records for storage, and implement pool
deposit using the denominated pool
* address previous PR comment - reminder for migration if changing
account permissions
* msg deposit should validate that denoms are not equal
* add godoc comments
* golint and some poolName -> poolID cleanup
* implement adding liquidity to an existing pool
* hardcode pools in sims
* touch up comment
* withdraw keeper logic
* withdraw type updates
* add withdraw msg tx handler
* initial withdraw test
* fix panic
* use new denominated pool with existing shares
* fix: check args on deposit cmd
* add slippage limit check for depositing to an existing pool
* send coins just before event emission
* check liquidity returned is greater than zero for both coins; ensure
returned number of shares are greater than zero
* add deadline to msgwithdraw
* register msgwithdraw
* scaffold msgwithdraw types test
* register the correct msg
* modify swap functions to also return the amount paid for the pool swap
fee. This will be used to calculate slippage and for event tracking
* add slippage types
* add expected withdrawal coins
* calculate slippage against expected coins
* update withdraw keeper tests
* spelling, improve comments on add liquidity math
* typo
* typo
* grammer
* typo / grammer
* remove pool_id from withdraw msg
* add slippage to tx cmd
* TestWithdraw_Partial
* nit
* add withdraw no pool, no deposit record tests
* drop event check on partial withdraw test
* fix broken link
* fix broken link
* resolve merge conflicts
* ensure swap fee can not be equal to 1; add full implementation of swap
pool methods; these implementation ensure that the pool invariant is
always greater or equal to the previous invariant
* refactor duplicated code into private swap methods
* add runtime assertion to always ensure invariant is greater or equal
to the previous invariant sub fee on swaps
* improve comments for base pool swap functions
* add swap exact input and output methods to denominated pool that wrap
the base pool interface for swapping
* comment touch ups
* more comment touchups
* fix msg deposit struct tag (#943)
* use better name for swap calculation private methods
* nits: golint
* fix misspelling in method name
* Add HARD token governance committee for Hard module (#941)
* add hard gov token committee
* revisions: update migration
* revisions: update test/data file
* initial revisions
* add TokenCommittee JSONMarshal test
* fix SetPermissions method
* remove BaseCommittee Type field
* add incentive params to allowed params
* Add SWP token governance committee for Swap module (#946)
* add swp token commitee to migration
* update test, add gen export utility method
* final revisions: add TODO
* remove slippage from withdraw to use min values for coins; add
additional validation test cases
* update alias for swap module
* add withdraw tests to handler for increased coverage; note: first pass,
improvements still yet to be made here
* refact withdraw keeper to use min amounts; panic for cases that do not
happen in normal situations
* lint fixes
* use total shares to track if pool should be deleted; add more in depth
withdraw comment
* add exact args for withdraw cmd
* extract record update methods
* update depositor share record if it exists -- do not overwrite an
existing record; ensures no loss of shares if the same address deposits
more than once
* Swap queries: deposit, pool, pools (#949)
* query deposits types
* implement deposit querier keeper methods
* query deposits CLI
* query deposits REST
* query types for pool/pools
* pool/pools querier keeper methods
* pool/pools CLI
* pool/pools REST
* basic pool/pools query tests
* basic deposit querier test
* iterate share records via owner bytes
* nit: add example for querying deposits by owner only
Co-authored-by: karzak <kjydavis3@gmail.com>
* feat: add REST tx handler for swap LP withdrawals
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* expand incentive cli query docs
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* minor update to godoc comment
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-07-13 12:35:02 +00:00
|
|
|
&swapKeeper,
|
2022-04-20 11:08:57 +00:00
|
|
|
&savingsKeeper,
|
2022-03-22 21:13:27 +00:00
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
// create committee keeper with router
|
|
|
|
committeeGovRouter := govtypes.NewRouter()
|
|
|
|
committeeGovRouter.
|
|
|
|
AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
|
|
|
|
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
|
|
|
|
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
|
|
|
|
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper))
|
|
|
|
// 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 = committeekeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[committeetypes.StoreKey],
|
|
|
|
committeeGovRouter,
|
|
|
|
app.paramsKeeper,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
)
|
2022-04-22 20:57:33 +00:00
|
|
|
// create gov keeper with router
|
|
|
|
// NOTE this must be done after any keepers referenced in the gov router (ie committee) are defined
|
|
|
|
govRouter := govtypes.NewRouter()
|
|
|
|
govRouter.
|
|
|
|
AddRoute(govtypes.RouterKey, govtypes.ProposalHandler).
|
|
|
|
AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
|
|
|
|
AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.upgradeKeeper)).
|
|
|
|
AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.ibcKeeper.ClientKeeper)).
|
2022-04-25 13:48:40 +00:00
|
|
|
AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper)).
|
|
|
|
AddRoute(kavadisttypes.RouterKey, kavadist.NewCommunityPoolMultiSpendProposalHandler(app.kavadistKeeper)).
|
2022-04-22 20:57:33 +00:00
|
|
|
AddRoute(committeetypes.RouterKey, committee.NewProposalHandler(app.committeeKeeper))
|
|
|
|
app.govKeeper = govkeeper.NewKeeper(
|
|
|
|
appCodec,
|
|
|
|
keys[govtypes.StoreKey],
|
|
|
|
govSubspace,
|
|
|
|
app.accountKeeper,
|
|
|
|
app.bankKeeper,
|
|
|
|
&app.stakingKeeper,
|
|
|
|
govRouter,
|
|
|
|
)
|
2022-01-08 00:39:27 +00:00
|
|
|
|
2019-06-20 13:37:57 +00:00
|
|
|
// register the staking hooks
|
Swap users accumulate rewards (#950)
* add swap claim type
* add store methods for swap claims
* add swap claims to genesis state
* tidy up cdp and hard hook doc comments
* add uncalled hooks to the swap keeper
* add swap rewards sync method
* add swap rewards init method
* connect swap rewards via swap hooks
* Update querier and client for swap claims (#951)
* refactor querier to dedupe code
* add swap claims querier endpoint
* add swap claim querying to rest
* add swap claim querying to cli
* add keeper method to iterate swap reward indexes
* simplify reward-factors query endpoint, add swap
* update swap hook to match latest swap branch
* rename func to not collide with latest swap branch
* Squash merge swap-acceptance branch (#956)
* add failing acceptance test for a user depositing into a pool
* implement GetAccount test helper
* implement swap.MsgDeposit for creating and adding liquidity to a pool
* update aliases, add event types, and fix typo/compiler errors in handler
test
* use only aliases names in handler test (don't use swap types -- ensures
we have run aliasgen), add assertion for even type message
* implement account and module account balance checks in handler test
* fill out handler assertions for testing keeper state and events
* update signed json representation and register swap/MsgDeposit for
proper encoding
* fill out boilerplate to get handler test to compile
* alias gen for pool
* add handling of message type; fill in deposit keeper method for
succesful compile; noop but test assertions now run up to module acc not
nil check
* add module account permissions for swap module -- fixes module account
creation; pass account keeper and supply keeper into swap keeper to
allow the ability to work with user and module accounts
* implement create pool logic for msg deposit; allows creation of a of new
pool, checking params to see if it is allowed. Initi shares are set,
and senders number of shares are stored
* Swap migrations scaffolding (#925)
* swap module scaffolding
* global swap fee
* can't think of a reason for begin blocker; removing for abci.go for now;
* test pair types; refactor pair name logic; simplify pairs validation and
fix stack overflow error
* check comparison
* use test package
* init swap module genesis
* add basic marshall tests
* remove reward apy from pairs
* fix integration helpers
* use max swap fee constant; fix validation of swap fee; add tests to
cover param validation and param set setup
* use noerror over nil
* start genesis tests
* test param set validation mirrors param validation
* add genesis tests
* remove print statement
* add subtests for genesis test cases; add extra querier test for unknown
route; add keeper params testing
* add spec
* update swagger
* find replace hard -> swap in comments
* remove unused method
* rename pairs to allowed pools; pool is more commonly used, and
allowedPool makes it more clear what swap parameter is for. In
addition, we won't conflict with Pool data structure for storing a
created pool in the store.
* remove generated link
* missed spec rename
* validate token order for allowed pools
* fix swagger
* json should be snakecase; change allowedPools to allowed_pools
* add legacy types
* add swap genesis to v0_15 migration
* add legacy types
* add swap genesis to v0_15 migration
* migration revisions
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
* keeper todos
* update keeper tests
* type todos
* update types tests
* tx deposit cli cmd
* tx deposit rest
* Swap module simulation scaffolding (#924)
* sims scaffolding
* add noop operation
* genesis revisions
* add param changes
* mvoe persistance methods to main keeper file, consolidate tests
* make helper methods private. they are tested via deposit method, and
unit testing them would make test suite brittle and refactoring
difficult
* use more clear coin variables
* code 1 is reserved, use code 2 and sequence all errors
* remove todo
* Implement deadline for swap module module message. This is implemented in
handler with a interface to easily apply to it to all messages, and
separate msg validation concerns from the keeper
* move allowed pools to params -- let pool and pool_test focus on pool domain logic, not
parameter & governance concerns
* update alias
* add unitless implementatin of constant product liquidity pool to
isolate and enapsulate liquidity logic. Swap methods interfaces are
added, but implementation not yet added
* nits and todos
* add ErrInvalidPool
* add tests for edge cases around pool depletion; add explicit panic for
edge case that results in a pool reserve being zero; handle pool
reinitialization if it is empty
* touch up comments and flush out the rest of assertions
* add data structures for keeper state storage separate from pool domain
objects, and improve structure for easier querying
* rename pool name to pool key for events
* add support for a denominated pool that uses sdk.Coins and sdk.Coin
arguments, keeping tracking of the units in the base pool. This gives
nice separation between pool logic, and coin/denom logic
* refactor keeper to use new records for storage, and implement pool
deposit using the denominated pool
* address previous PR comment - reminder for migration if changing
account permissions
* msg deposit should validate that denoms are not equal
* add godoc comments
* golint and some poolName -> poolID cleanup
* implement adding liquidity to an existing pool
* hardcode pools in sims
* touch up comment
* withdraw keeper logic
* withdraw type updates
* add withdraw msg tx handler
* initial withdraw test
* fix panic
* use new denominated pool with existing shares
* fix: check args on deposit cmd
* add slippage limit check for depositing to an existing pool
* send coins just before event emission
* check liquidity returned is greater than zero for both coins; ensure
returned number of shares are greater than zero
* add deadline to msgwithdraw
* register msgwithdraw
* scaffold msgwithdraw types test
* register the correct msg
* modify swap functions to also return the amount paid for the pool swap
fee. This will be used to calculate slippage and for event tracking
* add slippage types
* add expected withdrawal coins
* calculate slippage against expected coins
* update withdraw keeper tests
* spelling, improve comments on add liquidity math
* typo
* typo
* grammer
* typo / grammer
* remove pool_id from withdraw msg
* add slippage to tx cmd
* TestWithdraw_Partial
* nit
* add withdraw no pool, no deposit record tests
* drop event check on partial withdraw test
* fix broken link
* fix broken link
* resolve merge conflicts
* ensure swap fee can not be equal to 1; add full implementation of swap
pool methods; these implementation ensure that the pool invariant is
always greater or equal to the previous invariant
* refactor duplicated code into private swap methods
* add runtime assertion to always ensure invariant is greater or equal
to the previous invariant sub fee on swaps
* improve comments for base pool swap functions
* add swap exact input and output methods to denominated pool that wrap
the base pool interface for swapping
* comment touch ups
* more comment touchups
* fix msg deposit struct tag (#943)
* use better name for swap calculation private methods
* nits: golint
* fix misspelling in method name
* Add HARD token governance committee for Hard module (#941)
* add hard gov token committee
* revisions: update migration
* revisions: update test/data file
* initial revisions
* add TokenCommittee JSONMarshal test
* fix SetPermissions method
* remove BaseCommittee Type field
* add incentive params to allowed params
* Add SWP token governance committee for Swap module (#946)
* add swp token commitee to migration
* update test, add gen export utility method
* final revisions: add TODO
* remove slippage from withdraw to use min values for coins; add
additional validation test cases
* update alias for swap module
* add withdraw tests to handler for increased coverage; note: first pass,
improvements still yet to be made here
* refact withdraw keeper to use min amounts; panic for cases that do not
happen in normal situations
* lint fixes
* use total shares to track if pool should be deleted; add more in depth
withdraw comment
* add exact args for withdraw cmd
* extract record update methods
* update depositor share record if it exists -- do not overwrite an
existing record; ensures no loss of shares if the same address deposits
more than once
* Swap queries: deposit, pool, pools (#949)
* query deposits types
* implement deposit querier keeper methods
* query deposits CLI
* query deposits REST
* query types for pool/pools
* pool/pools querier keeper methods
* pool/pools CLI
* pool/pools REST
* basic pool/pools query tests
* basic deposit querier test
* iterate share records via owner bytes
* nit: add example for querying deposits by owner only
Co-authored-by: karzak <kjydavis3@gmail.com>
* feat: add REST tx handler for swap LP withdrawals
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* expand incentive cli query docs
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* minor update to godoc comment
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-07-13 12:35:02 +00:00
|
|
|
// NOTE: These keepers are passed by reference above, so they will contain these hooks.
|
2022-01-08 00:39:27 +00:00
|
|
|
app.stakingKeeper = *(app.stakingKeeper.SetHooks(
|
|
|
|
stakingtypes.NewMultiStakingHooks(app.distrKeeper.Hooks(), app.slashingKeeper.Hooks(), app.incentiveKeeper.Hooks())))
|
2021-01-21 13:52:09 +00:00
|
|
|
|
Swap users accumulate rewards (#950)
* add swap claim type
* add store methods for swap claims
* add swap claims to genesis state
* tidy up cdp and hard hook doc comments
* add uncalled hooks to the swap keeper
* add swap rewards sync method
* add swap rewards init method
* connect swap rewards via swap hooks
* Update querier and client for swap claims (#951)
* refactor querier to dedupe code
* add swap claims querier endpoint
* add swap claim querying to rest
* add swap claim querying to cli
* add keeper method to iterate swap reward indexes
* simplify reward-factors query endpoint, add swap
* update swap hook to match latest swap branch
* rename func to not collide with latest swap branch
* Squash merge swap-acceptance branch (#956)
* add failing acceptance test for a user depositing into a pool
* implement GetAccount test helper
* implement swap.MsgDeposit for creating and adding liquidity to a pool
* update aliases, add event types, and fix typo/compiler errors in handler
test
* use only aliases names in handler test (don't use swap types -- ensures
we have run aliasgen), add assertion for even type message
* implement account and module account balance checks in handler test
* fill out handler assertions for testing keeper state and events
* update signed json representation and register swap/MsgDeposit for
proper encoding
* fill out boilerplate to get handler test to compile
* alias gen for pool
* add handling of message type; fill in deposit keeper method for
succesful compile; noop but test assertions now run up to module acc not
nil check
* add module account permissions for swap module -- fixes module account
creation; pass account keeper and supply keeper into swap keeper to
allow the ability to work with user and module accounts
* implement create pool logic for msg deposit; allows creation of a of new
pool, checking params to see if it is allowed. Initi shares are set,
and senders number of shares are stored
* Swap migrations scaffolding (#925)
* swap module scaffolding
* global swap fee
* can't think of a reason for begin blocker; removing for abci.go for now;
* test pair types; refactor pair name logic; simplify pairs validation and
fix stack overflow error
* check comparison
* use test package
* init swap module genesis
* add basic marshall tests
* remove reward apy from pairs
* fix integration helpers
* use max swap fee constant; fix validation of swap fee; add tests to
cover param validation and param set setup
* use noerror over nil
* start genesis tests
* test param set validation mirrors param validation
* add genesis tests
* remove print statement
* add subtests for genesis test cases; add extra querier test for unknown
route; add keeper params testing
* add spec
* update swagger
* find replace hard -> swap in comments
* remove unused method
* rename pairs to allowed pools; pool is more commonly used, and
allowedPool makes it more clear what swap parameter is for. In
addition, we won't conflict with Pool data structure for storing a
created pool in the store.
* remove generated link
* missed spec rename
* validate token order for allowed pools
* fix swagger
* json should be snakecase; change allowedPools to allowed_pools
* add legacy types
* add swap genesis to v0_15 migration
* add legacy types
* add swap genesis to v0_15 migration
* migration revisions
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
* keeper todos
* update keeper tests
* type todos
* update types tests
* tx deposit cli cmd
* tx deposit rest
* Swap module simulation scaffolding (#924)
* sims scaffolding
* add noop operation
* genesis revisions
* add param changes
* mvoe persistance methods to main keeper file, consolidate tests
* make helper methods private. they are tested via deposit method, and
unit testing them would make test suite brittle and refactoring
difficult
* use more clear coin variables
* code 1 is reserved, use code 2 and sequence all errors
* remove todo
* Implement deadline for swap module module message. This is implemented in
handler with a interface to easily apply to it to all messages, and
separate msg validation concerns from the keeper
* move allowed pools to params -- let pool and pool_test focus on pool domain logic, not
parameter & governance concerns
* update alias
* add unitless implementatin of constant product liquidity pool to
isolate and enapsulate liquidity logic. Swap methods interfaces are
added, but implementation not yet added
* nits and todos
* add ErrInvalidPool
* add tests for edge cases around pool depletion; add explicit panic for
edge case that results in a pool reserve being zero; handle pool
reinitialization if it is empty
* touch up comments and flush out the rest of assertions
* add data structures for keeper state storage separate from pool domain
objects, and improve structure for easier querying
* rename pool name to pool key for events
* add support for a denominated pool that uses sdk.Coins and sdk.Coin
arguments, keeping tracking of the units in the base pool. This gives
nice separation between pool logic, and coin/denom logic
* refactor keeper to use new records for storage, and implement pool
deposit using the denominated pool
* address previous PR comment - reminder for migration if changing
account permissions
* msg deposit should validate that denoms are not equal
* add godoc comments
* golint and some poolName -> poolID cleanup
* implement adding liquidity to an existing pool
* hardcode pools in sims
* touch up comment
* withdraw keeper logic
* withdraw type updates
* add withdraw msg tx handler
* initial withdraw test
* fix panic
* use new denominated pool with existing shares
* fix: check args on deposit cmd
* add slippage limit check for depositing to an existing pool
* send coins just before event emission
* check liquidity returned is greater than zero for both coins; ensure
returned number of shares are greater than zero
* add deadline to msgwithdraw
* register msgwithdraw
* scaffold msgwithdraw types test
* register the correct msg
* modify swap functions to also return the amount paid for the pool swap
fee. This will be used to calculate slippage and for event tracking
* add slippage types
* add expected withdrawal coins
* calculate slippage against expected coins
* update withdraw keeper tests
* spelling, improve comments on add liquidity math
* typo
* typo
* grammer
* typo / grammer
* remove pool_id from withdraw msg
* add slippage to tx cmd
* TestWithdraw_Partial
* nit
* add withdraw no pool, no deposit record tests
* drop event check on partial withdraw test
* fix broken link
* fix broken link
* resolve merge conflicts
* ensure swap fee can not be equal to 1; add full implementation of swap
pool methods; these implementation ensure that the pool invariant is
always greater or equal to the previous invariant
* refactor duplicated code into private swap methods
* add runtime assertion to always ensure invariant is greater or equal
to the previous invariant sub fee on swaps
* improve comments for base pool swap functions
* add swap exact input and output methods to denominated pool that wrap
the base pool interface for swapping
* comment touch ups
* more comment touchups
* fix msg deposit struct tag (#943)
* use better name for swap calculation private methods
* nits: golint
* fix misspelling in method name
* Add HARD token governance committee for Hard module (#941)
* add hard gov token committee
* revisions: update migration
* revisions: update test/data file
* initial revisions
* add TokenCommittee JSONMarshal test
* fix SetPermissions method
* remove BaseCommittee Type field
* add incentive params to allowed params
* Add SWP token governance committee for Swap module (#946)
* add swp token commitee to migration
* update test, add gen export utility method
* final revisions: add TODO
* remove slippage from withdraw to use min values for coins; add
additional validation test cases
* update alias for swap module
* add withdraw tests to handler for increased coverage; note: first pass,
improvements still yet to be made here
* refact withdraw keeper to use min amounts; panic for cases that do not
happen in normal situations
* lint fixes
* use total shares to track if pool should be deleted; add more in depth
withdraw comment
* add exact args for withdraw cmd
* extract record update methods
* update depositor share record if it exists -- do not overwrite an
existing record; ensures no loss of shares if the same address deposits
more than once
* Swap queries: deposit, pool, pools (#949)
* query deposits types
* implement deposit querier keeper methods
* query deposits CLI
* query deposits REST
* query types for pool/pools
* pool/pools querier keeper methods
* pool/pools CLI
* pool/pools REST
* basic pool/pools query tests
* basic deposit querier test
* iterate share records via owner bytes
* nit: add example for querying deposits by owner only
Co-authored-by: karzak <kjydavis3@gmail.com>
* feat: add REST tx handler for swap LP withdrawals
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* expand incentive cli query docs
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* minor update to godoc comment
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-07-13 12:35:02 +00:00
|
|
|
app.swapKeeper = *swapKeeper.SetHooks(app.incentiveKeeper.Hooks())
|
2022-01-08 00:39:27 +00:00
|
|
|
app.cdpKeeper = *cdpKeeper.SetHooks(cdptypes.NewMultiCDPHooks(app.incentiveKeeper.Hooks()))
|
|
|
|
app.hardKeeper = *hardKeeper.SetHooks(hardtypes.NewMultiHARDHooks(app.incentiveKeeper.Hooks()))
|
2022-03-31 09:07:19 +00:00
|
|
|
app.savingsKeeper = *savingsKeeper.SetHooks(savingstypes.NewMultiSavingsHooks(app.incentiveKeeper.Hooks()))
|
Swap users accumulate rewards (#950)
* add swap claim type
* add store methods for swap claims
* add swap claims to genesis state
* tidy up cdp and hard hook doc comments
* add uncalled hooks to the swap keeper
* add swap rewards sync method
* add swap rewards init method
* connect swap rewards via swap hooks
* Update querier and client for swap claims (#951)
* refactor querier to dedupe code
* add swap claims querier endpoint
* add swap claim querying to rest
* add swap claim querying to cli
* add keeper method to iterate swap reward indexes
* simplify reward-factors query endpoint, add swap
* update swap hook to match latest swap branch
* rename func to not collide with latest swap branch
* Squash merge swap-acceptance branch (#956)
* add failing acceptance test for a user depositing into a pool
* implement GetAccount test helper
* implement swap.MsgDeposit for creating and adding liquidity to a pool
* update aliases, add event types, and fix typo/compiler errors in handler
test
* use only aliases names in handler test (don't use swap types -- ensures
we have run aliasgen), add assertion for even type message
* implement account and module account balance checks in handler test
* fill out handler assertions for testing keeper state and events
* update signed json representation and register swap/MsgDeposit for
proper encoding
* fill out boilerplate to get handler test to compile
* alias gen for pool
* add handling of message type; fill in deposit keeper method for
succesful compile; noop but test assertions now run up to module acc not
nil check
* add module account permissions for swap module -- fixes module account
creation; pass account keeper and supply keeper into swap keeper to
allow the ability to work with user and module accounts
* implement create pool logic for msg deposit; allows creation of a of new
pool, checking params to see if it is allowed. Initi shares are set,
and senders number of shares are stored
* Swap migrations scaffolding (#925)
* swap module scaffolding
* global swap fee
* can't think of a reason for begin blocker; removing for abci.go for now;
* test pair types; refactor pair name logic; simplify pairs validation and
fix stack overflow error
* check comparison
* use test package
* init swap module genesis
* add basic marshall tests
* remove reward apy from pairs
* fix integration helpers
* use max swap fee constant; fix validation of swap fee; add tests to
cover param validation and param set setup
* use noerror over nil
* start genesis tests
* test param set validation mirrors param validation
* add genesis tests
* remove print statement
* add subtests for genesis test cases; add extra querier test for unknown
route; add keeper params testing
* add spec
* update swagger
* find replace hard -> swap in comments
* remove unused method
* rename pairs to allowed pools; pool is more commonly used, and
allowedPool makes it more clear what swap parameter is for. In
addition, we won't conflict with Pool data structure for storing a
created pool in the store.
* remove generated link
* missed spec rename
* validate token order for allowed pools
* fix swagger
* json should be snakecase; change allowedPools to allowed_pools
* add legacy types
* add swap genesis to v0_15 migration
* add legacy types
* add swap genesis to v0_15 migration
* migration revisions
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
* keeper todos
* update keeper tests
* type todos
* update types tests
* tx deposit cli cmd
* tx deposit rest
* Swap module simulation scaffolding (#924)
* sims scaffolding
* add noop operation
* genesis revisions
* add param changes
* mvoe persistance methods to main keeper file, consolidate tests
* make helper methods private. they are tested via deposit method, and
unit testing them would make test suite brittle and refactoring
difficult
* use more clear coin variables
* code 1 is reserved, use code 2 and sequence all errors
* remove todo
* Implement deadline for swap module module message. This is implemented in
handler with a interface to easily apply to it to all messages, and
separate msg validation concerns from the keeper
* move allowed pools to params -- let pool and pool_test focus on pool domain logic, not
parameter & governance concerns
* update alias
* add unitless implementatin of constant product liquidity pool to
isolate and enapsulate liquidity logic. Swap methods interfaces are
added, but implementation not yet added
* nits and todos
* add ErrInvalidPool
* add tests for edge cases around pool depletion; add explicit panic for
edge case that results in a pool reserve being zero; handle pool
reinitialization if it is empty
* touch up comments and flush out the rest of assertions
* add data structures for keeper state storage separate from pool domain
objects, and improve structure for easier querying
* rename pool name to pool key for events
* add support for a denominated pool that uses sdk.Coins and sdk.Coin
arguments, keeping tracking of the units in the base pool. This gives
nice separation between pool logic, and coin/denom logic
* refactor keeper to use new records for storage, and implement pool
deposit using the denominated pool
* address previous PR comment - reminder for migration if changing
account permissions
* msg deposit should validate that denoms are not equal
* add godoc comments
* golint and some poolName -> poolID cleanup
* implement adding liquidity to an existing pool
* hardcode pools in sims
* touch up comment
* withdraw keeper logic
* withdraw type updates
* add withdraw msg tx handler
* initial withdraw test
* fix panic
* use new denominated pool with existing shares
* fix: check args on deposit cmd
* add slippage limit check for depositing to an existing pool
* send coins just before event emission
* check liquidity returned is greater than zero for both coins; ensure
returned number of shares are greater than zero
* add deadline to msgwithdraw
* register msgwithdraw
* scaffold msgwithdraw types test
* register the correct msg
* modify swap functions to also return the amount paid for the pool swap
fee. This will be used to calculate slippage and for event tracking
* add slippage types
* add expected withdrawal coins
* calculate slippage against expected coins
* update withdraw keeper tests
* spelling, improve comments on add liquidity math
* typo
* typo
* grammer
* typo / grammer
* remove pool_id from withdraw msg
* add slippage to tx cmd
* TestWithdraw_Partial
* nit
* add withdraw no pool, no deposit record tests
* drop event check on partial withdraw test
* fix broken link
* fix broken link
* resolve merge conflicts
* ensure swap fee can not be equal to 1; add full implementation of swap
pool methods; these implementation ensure that the pool invariant is
always greater or equal to the previous invariant
* refactor duplicated code into private swap methods
* add runtime assertion to always ensure invariant is greater or equal
to the previous invariant sub fee on swaps
* improve comments for base pool swap functions
* add swap exact input and output methods to denominated pool that wrap
the base pool interface for swapping
* comment touch ups
* more comment touchups
* fix msg deposit struct tag (#943)
* use better name for swap calculation private methods
* nits: golint
* fix misspelling in method name
* Add HARD token governance committee for Hard module (#941)
* add hard gov token committee
* revisions: update migration
* revisions: update test/data file
* initial revisions
* add TokenCommittee JSONMarshal test
* fix SetPermissions method
* remove BaseCommittee Type field
* add incentive params to allowed params
* Add SWP token governance committee for Swap module (#946)
* add swp token commitee to migration
* update test, add gen export utility method
* final revisions: add TODO
* remove slippage from withdraw to use min values for coins; add
additional validation test cases
* update alias for swap module
* add withdraw tests to handler for increased coverage; note: first pass,
improvements still yet to be made here
* refact withdraw keeper to use min amounts; panic for cases that do not
happen in normal situations
* lint fixes
* use total shares to track if pool should be deleted; add more in depth
withdraw comment
* add exact args for withdraw cmd
* extract record update methods
* update depositor share record if it exists -- do not overwrite an
existing record; ensures no loss of shares if the same address deposits
more than once
* Swap queries: deposit, pool, pools (#949)
* query deposits types
* implement deposit querier keeper methods
* query deposits CLI
* query deposits REST
* query types for pool/pools
* pool/pools querier keeper methods
* pool/pools CLI
* pool/pools REST
* basic pool/pools query tests
* basic deposit querier test
* iterate share records via owner bytes
* nit: add example for querying deposits by owner only
Co-authored-by: karzak <kjydavis3@gmail.com>
* feat: add REST tx handler for swap LP withdrawals
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* expand incentive cli query docs
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
* minor update to godoc comment
Co-authored-by: Nick DeLuca <nickdeluca08@gmail.com>
Co-authored-by: Denali Marsh <denali@kava.io>
Co-authored-by: denalimarsh <denalimarsh@gmail.com>
Co-authored-by: karzak <kjydavis3@gmail.com>
2021-07-13 12:35:02 +00:00
|
|
|
|
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(
|
2022-01-08 00:39:27 +00:00
|
|
|
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig),
|
|
|
|
auth.NewAppModule(appCodec, app.accountKeeper, nil),
|
|
|
|
bank.NewAppModule(appCodec, app.bankKeeper, app.accountKeeper),
|
|
|
|
capability.NewAppModule(appCodec, *app.capabilityKeeper),
|
|
|
|
staking.NewAppModule(appCodec, app.stakingKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
mint.NewAppModule(appCodec, app.mintKeeper, app.accountKeeper),
|
|
|
|
distr.NewAppModule(appCodec, app.distrKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper),
|
|
|
|
gov.NewAppModule(appCodec, app.govKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
params.NewAppModule(app.paramsKeeper),
|
|
|
|
crisis.NewAppModule(&app.crisisKeeper, options.SkipGenesisInvariants),
|
|
|
|
slashing.NewAppModule(appCodec, app.slashingKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper),
|
|
|
|
ibc.NewAppModule(app.ibcKeeper),
|
2022-04-21 20:16:28 +00:00
|
|
|
evm.NewAppModule(app.evmKeeper, app.accountKeeper),
|
|
|
|
feemarket.NewAppModule(app.feeMarketKeeper),
|
2020-05-07 20:34:05 +00:00
|
|
|
upgrade.NewAppModule(app.upgradeKeeper),
|
2020-04-23 16:35:58 +00:00
|
|
|
evidence.NewAppModule(app.evidenceKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
transferModule,
|
|
|
|
vesting.NewAppModule(app.accountKeeper, app.bankKeeper),
|
2022-04-21 20:34:14 +00:00
|
|
|
authzmodule.NewAppModule(appCodec, app.authzKeeper, app.accountKeeper, app.bankKeeper, app.interfaceRegistry),
|
2022-01-08 00:39:27 +00:00
|
|
|
kavadist.NewAppModule(app.kavadistKeeper, app.accountKeeper),
|
|
|
|
auction.NewAppModule(app.auctionKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
issuance.NewAppModule(app.issuanceKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
bep3.NewAppModule(app.bep3Keeper, app.accountKeeper, app.bankKeeper),
|
2020-04-23 16:35:58 +00:00
|
|
|
pricefeed.NewAppModule(app.pricefeedKeeper, app.accountKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
validatorvesting.NewAppModule(app.bankKeeper),
|
2021-07-15 15:35:24 +00:00
|
|
|
swap.NewAppModule(app.swapKeeper, app.accountKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
cdp.NewAppModule(app.cdpKeeper, app.accountKeeper, app.pricefeedKeeper, app.bankKeeper),
|
|
|
|
hard.NewAppModule(app.hardKeeper, app.accountKeeper, app.bankKeeper, app.pricefeedKeeper),
|
|
|
|
committee.NewAppModule(app.committeeKeeper, app.accountKeeper),
|
|
|
|
incentive.NewAppModule(app.incentiveKeeper, app.accountKeeper, app.bankKeeper, app.cdpKeeper),
|
2022-04-21 20:16:28 +00:00
|
|
|
evmutil.NewAppModule(app.evmutilKeeper, app.bankKeeper),
|
2022-03-23 14:34:23 +00:00
|
|
|
savings.NewAppModule(app.savingsKeeper, app.accountKeeper, app.bankKeeper),
|
2022-04-22 16:01:43 +00:00
|
|
|
bridge.NewAppModule(app.bridgeKeeper, app.accountKeeper),
|
2019-06-20 13:37:57 +00:00
|
|
|
)
|
|
|
|
|
2022-04-25 13:48:40 +00:00
|
|
|
// Warning: Some begin blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
2020-05-07 20:34:05 +00:00
|
|
|
app.mm.SetOrderBeginBlockers(
|
2022-01-08 00:39:27 +00:00
|
|
|
// Upgrade begin blocker runs migrations on the first block after an upgrade. It should run before any other module.
|
|
|
|
upgradetypes.ModuleName,
|
|
|
|
// Capability begin blocker runs non state changing initialization.
|
|
|
|
capabilitytypes.ModuleName,
|
|
|
|
// Committee begin blocker changes module params by enacting proposals.
|
|
|
|
// Run before to ensure params are updated together before state changes.
|
|
|
|
committeetypes.ModuleName,
|
|
|
|
minttypes.ModuleName,
|
|
|
|
distrtypes.ModuleName,
|
|
|
|
// 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.
|
|
|
|
slashingtypes.ModuleName,
|
|
|
|
evidencetypes.ModuleName,
|
|
|
|
stakingtypes.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
feemarkettypes.ModuleName,
|
|
|
|
evmtypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
kavadisttypes.ModuleName,
|
|
|
|
// Auction begin blocker will close out expired auctions and pay debt back to cdp.
|
|
|
|
// It should be run before cdp begin blocker which cancels out debt with stable and starts more auctions.
|
|
|
|
auctiontypes.ModuleName,
|
|
|
|
cdptypes.ModuleName,
|
|
|
|
bep3types.ModuleName,
|
|
|
|
hardtypes.ModuleName,
|
|
|
|
issuancetypes.ModuleName,
|
|
|
|
incentivetypes.ModuleName,
|
|
|
|
ibchost.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
// Add all remaining modules with an empty begin blocker below since cosmos 0.45.0 requires it
|
|
|
|
swaptypes.ModuleName,
|
|
|
|
vestingtypes.ModuleName,
|
|
|
|
pricefeedtypes.ModuleName,
|
|
|
|
validatorvestingtypes.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
authtypes.ModuleName,
|
|
|
|
banktypes.ModuleName,
|
|
|
|
govtypes.ModuleName,
|
|
|
|
crisistypes.ModuleName,
|
|
|
|
genutiltypes.ModuleName,
|
|
|
|
ibctransfertypes.ModuleName,
|
|
|
|
paramstypes.ModuleName,
|
2022-04-25 13:48:40 +00:00
|
|
|
authz.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
evmutiltypes.ModuleName,
|
|
|
|
savingstypes.ModuleName,
|
|
|
|
bridgetypes.ModuleName,
|
2020-05-07 20:34:05 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// Warning: Some end blockers must run before others. Ensure the dependencies are understood before modifying this list.
|
|
|
|
app.mm.SetOrderEndBlockers(
|
|
|
|
crisistypes.ModuleName,
|
|
|
|
govtypes.ModuleName,
|
|
|
|
stakingtypes.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
evmtypes.ModuleName,
|
|
|
|
// fee market module must go after evm module in order to retrieve the block gas used.
|
|
|
|
feemarkettypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
pricefeedtypes.ModuleName,
|
2022-04-21 20:16:28 +00:00
|
|
|
// Add all remaining modules with an empty end blocker below since cosmos 0.45.0 requires it
|
|
|
|
capabilitytypes.ModuleName,
|
|
|
|
incentivetypes.ModuleName,
|
|
|
|
issuancetypes.ModuleName,
|
|
|
|
minttypes.ModuleName,
|
|
|
|
slashingtypes.ModuleName,
|
|
|
|
distrtypes.ModuleName,
|
|
|
|
auctiontypes.ModuleName,
|
|
|
|
bep3types.ModuleName,
|
|
|
|
cdptypes.ModuleName,
|
|
|
|
hardtypes.ModuleName,
|
|
|
|
committeetypes.ModuleName,
|
|
|
|
upgradetypes.ModuleName,
|
|
|
|
evidencetypes.ModuleName,
|
|
|
|
kavadisttypes.ModuleName,
|
|
|
|
swaptypes.ModuleName,
|
|
|
|
vestingtypes.ModuleName,
|
|
|
|
ibchost.ModuleName,
|
|
|
|
validatorvestingtypes.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
authtypes.ModuleName,
|
|
|
|
banktypes.ModuleName,
|
|
|
|
genutiltypes.ModuleName,
|
|
|
|
ibctransfertypes.ModuleName,
|
|
|
|
paramstypes.ModuleName,
|
2022-04-25 13:48:40 +00:00
|
|
|
authz.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
evmutiltypes.ModuleName,
|
|
|
|
savingstypes.ModuleName,
|
|
|
|
bridgetypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// Warning: Some init genesis methods must run before others. Ensure the dependencies are understood before modifying this list
|
2019-09-25 19:50:03 +00:00
|
|
|
app.mm.SetOrderInitGenesis(
|
2022-01-08 00:39:27 +00:00
|
|
|
capabilitytypes.ModuleName, // initialize capabilities, run before any module creating or claiming capabilities in InitGenesis
|
|
|
|
authtypes.ModuleName, // loads all accounts, run before any module with a module account
|
|
|
|
banktypes.ModuleName,
|
|
|
|
distrtypes.ModuleName,
|
|
|
|
stakingtypes.ModuleName,
|
|
|
|
slashingtypes.ModuleName, // iterates over validators, run after staking
|
|
|
|
govtypes.ModuleName,
|
|
|
|
minttypes.ModuleName,
|
|
|
|
ibchost.ModuleName,
|
|
|
|
evidencetypes.ModuleName,
|
2022-04-21 20:34:14 +00:00
|
|
|
authz.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
ibctransfertypes.ModuleName,
|
2022-04-25 13:48:40 +00:00
|
|
|
evmtypes.ModuleName,
|
|
|
|
feemarkettypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
kavadisttypes.ModuleName,
|
|
|
|
auctiontypes.ModuleName,
|
|
|
|
issuancetypes.ModuleName,
|
2022-03-22 21:13:27 +00:00
|
|
|
savingstypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
bep3types.ModuleName,
|
|
|
|
pricefeedtypes.ModuleName,
|
|
|
|
swaptypes.ModuleName,
|
|
|
|
cdptypes.ModuleName, // reads market prices, so must run after pricefeed genesis
|
|
|
|
hardtypes.ModuleName,
|
|
|
|
incentivetypes.ModuleName, // reads cdp params, so must run after cdp genesis
|
|
|
|
committeetypes.ModuleName,
|
2022-04-22 16:01:43 +00:00
|
|
|
evmutiltypes.ModuleName,
|
|
|
|
bridgetypes.ModuleName,
|
2022-01-08 00:39:27 +00:00
|
|
|
genutiltypes.ModuleName, // runs arbitrary txs included in genisis state, so run after modules have been initialized
|
|
|
|
crisistypes.ModuleName, // runs the invariants at genesis, should run after other modules
|
2022-04-21 20:16:28 +00:00
|
|
|
// Add all remaining modules with an empty InitGenesis below since cosmos 0.45.0 requires it
|
|
|
|
vestingtypes.ModuleName,
|
|
|
|
paramstypes.ModuleName,
|
|
|
|
upgradetypes.ModuleName,
|
|
|
|
validatorvestingtypes.ModuleName,
|
2019-09-25 19:50:03 +00:00
|
|
|
)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
|
|
|
app.mm.RegisterInvariants(&app.crisisKeeper)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
|
|
|
|
|
|
|
|
app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter())
|
|
|
|
app.mm.RegisterServices(app.configurator)
|
2019-07-18 17:36:31 +00:00
|
|
|
|
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.
|
2022-01-08 00:39:27 +00:00
|
|
|
// TODO
|
|
|
|
// app.sm = module.NewSimulationManager(
|
|
|
|
// auth.NewAppModule(app.accountKeeper),
|
|
|
|
// bank.NewAppModule(app.bankKeeper, app.accountKeeper),
|
|
|
|
// gov.NewAppModule(app.govKeeper, app.accountKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
// mint.NewAppModule(app.mintKeeper),
|
|
|
|
// distr.NewAppModule(app.distrKeeper, app.accountKeeper, app.accountKeeper, app.bankKeeper, app.stakingKeeper),
|
2022-04-21 20:16:28 +00:00
|
|
|
// staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.accountKeeper, app.bankKeeper),
|
|
|
|
// evm.NewAppModule(app.evmKeeper, app.accountKeeper),
|
2022-01-08 00:39:27 +00:00
|
|
|
// slashing.NewAppModule(app.slashingKeeper, app.accountKeeper, app.stakingKeeper),
|
|
|
|
// )
|
|
|
|
// app.sm.RegisterStoreDecoders()
|
2019-09-11 22:33:20 +00:00
|
|
|
|
|
|
|
// initialize stores
|
|
|
|
app.MountKVStores(keys)
|
|
|
|
app.MountTransientStores(tkeys)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.MountMemoryStores(memKeys)
|
2019-09-11 22:33:20 +00:00
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// initialize the app
|
2022-01-08 00:39:27 +00:00
|
|
|
var fetchers []ante.AddressFetcher
|
|
|
|
if options.MempoolEnableAuth {
|
|
|
|
fetchers = append(fetchers,
|
|
|
|
func(sdk.Context) []sdk.AccAddress { return options.MempoolAuthAddresses },
|
|
|
|
app.bep3Keeper.GetAuthorizedAddresses,
|
|
|
|
app.pricefeedKeeper.GetAuthorizedAddresses,
|
|
|
|
)
|
2020-12-02 17:37:11 +00:00
|
|
|
}
|
2022-04-21 20:16:28 +00:00
|
|
|
|
|
|
|
anteOptions := ante.HandlerOptions{
|
|
|
|
AccountKeeper: app.accountKeeper,
|
|
|
|
BankKeeper: app.bankKeeper,
|
|
|
|
EvmKeeper: app.evmKeeper,
|
|
|
|
IBCKeeper: app.ibcKeeper,
|
|
|
|
FeeMarketKeeper: app.feeMarketKeeper,
|
|
|
|
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
|
|
|
|
SigGasConsumer: evmante.DefaultSigVerificationGasConsumer,
|
|
|
|
MaxTxGasWanted: options.EVMMaxGasWanted,
|
|
|
|
AddressFetchers: fetchers,
|
|
|
|
}
|
|
|
|
|
|
|
|
antehandler, err := ante.NewAnteHandler(anteOptions)
|
2022-01-08 00:39:27 +00:00
|
|
|
if err != nil {
|
|
|
|
panic(fmt.Sprintf("failed to create antehandler: %s", err))
|
|
|
|
}
|
|
|
|
|
2020-12-02 17:37:11 +00:00
|
|
|
app.SetAnteHandler(antehandler)
|
2022-01-08 00:39:27 +00:00
|
|
|
app.SetInitChainer(app.InitChainer)
|
|
|
|
app.SetBeginBlocker(app.BeginBlocker)
|
2019-06-20 13:37:57 +00:00
|
|
|
app.SetEndBlocker(app.EndBlocker)
|
|
|
|
|
2019-07-18 17:36:31 +00:00
|
|
|
// load store
|
2022-01-08 00:39:27 +00:00
|
|
|
if !options.SkipLoadLatest {
|
|
|
|
if err := app.LoadLatestVersion(); err != nil {
|
|
|
|
panic(fmt.Sprintf("failed to load latest version: %s", err))
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
app.ScopedIBCKeeper = scopedIBCKeeper
|
|
|
|
app.ScopedTransferKeeper = scopedTransferKeeper
|
2019-06-25 13:29:56 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
return app
|
2020-02-13 00:49:32 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// BeginBlocker contains app specific logic for the BeginBlock abci call.
|
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
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// EndBlocker contains app specific logic for the EndBlock abci call.
|
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
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// InitChainer contains app specific logic for the InitChain abci call.
|
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
|
2022-01-08 00:39:27 +00:00
|
|
|
if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
2022-04-25 13:48:40 +00:00
|
|
|
// Store current module versions in kava-10 to setup future in-place upgrades.
|
|
|
|
// During in-place migrations, the old module versions in the store will be referenced to determine which migrations to run.
|
|
|
|
app.upgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap())
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
return app.mm.InitGenesis(ctx, app.appCodec, genesisState)
|
2019-06-20 13:37:57 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// LoadHeight loads the app state for a particular height.
|
2019-06-20 17:02:29 +00:00
|
|
|
func (app *App) LoadHeight(height int64) error {
|
2022-01-08 00:39:27 +00:00
|
|
|
return app.LoadVersion(height)
|
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 {
|
2022-01-08 00:39:27 +00:00
|
|
|
modAccAddrs[authtypes.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
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// InterfaceRegistry returns the app's InterfaceRegistry.
|
|
|
|
func (app *App) InterfaceRegistry() types.InterfaceRegistry {
|
|
|
|
return app.interfaceRegistry
|
|
|
|
}
|
|
|
|
|
|
|
|
// SimulationManager implements the SimulationApp interface.
|
|
|
|
func (app *App) SimulationManager() *module.SimulationManager {
|
|
|
|
return app.sm
|
|
|
|
}
|
|
|
|
|
|
|
|
// RegisterAPIRoutes registers all application module routes with the provided API server.
|
|
|
|
func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
|
|
|
|
clientCtx := apiSvr.ClientCtx
|
|
|
|
|
|
|
|
// Register legacy REST routes
|
|
|
|
rpc.RegisterRoutes(clientCtx, apiSvr.Router)
|
2022-04-21 20:16:28 +00:00
|
|
|
evmrest.RegisterTxRoutes(clientCtx, apiSvr.Router)
|
2022-01-08 00:39:27 +00:00
|
|
|
ModuleBasics.RegisterRESTRoutes(clientCtx, apiSvr.Router)
|
|
|
|
RegisterLegacyTxRoutes(clientCtx, apiSvr.Router)
|
|
|
|
|
|
|
|
// Register GRPC Gateway routes
|
|
|
|
tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
|
|
|
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
|
|
|
ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
|
|
|
|
2022-02-01 16:32:17 +00:00
|
|
|
// Swagger API configuration is ignored
|
2022-01-08 00:39:27 +00:00
|
|
|
}
|
2020-05-21 04:50:12 +00:00
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// RegisterTxService implements the Application.RegisterTxService method.
|
|
|
|
// It registers transaction related endpoints on the app's grpc server.
|
|
|
|
func (app *App) RegisterTxService(clientCtx client.Context) {
|
|
|
|
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
|
2020-05-21 04:50:12 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// RegisterTendermintService implements the Application.RegisterTendermintService method.
|
|
|
|
// It registers the standard tendermint grpc endpoints on the app's grpc server.
|
|
|
|
func (app *App) RegisterTendermintService(clientCtx client.Context) {
|
|
|
|
tmservice.RegisterTendermintService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.interfaceRegistry)
|
2019-09-11 22:33:20 +00:00
|
|
|
}
|
|
|
|
|
2022-01-08 00:39:27 +00:00
|
|
|
// loadBlockedMaccAddrs returns a map indicating the blocked status of each module account address
|
|
|
|
func (app *App) loadBlockedMaccAddrs() map[string]bool {
|
|
|
|
modAccAddrs := app.ModuleAccountAddrs()
|
|
|
|
kavadistMaccAddr := app.accountKeeper.GetModuleAddress(kavadisttypes.ModuleName)
|
|
|
|
for addr := range modAccAddrs {
|
|
|
|
// Set the kavadist module account address as unblocked
|
|
|
|
if addr == kavadistMaccAddr.String() {
|
|
|
|
modAccAddrs[addr] = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return modAccAddrs
|
2020-04-23 16:35:58 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
}
|