app

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 132 Imported by: 1

Documentation

Index

Constants

View Source
const (
	UpgraderAddress = "d01y7sex8yvrazyd8pljjxvnvpndaavn99tk2j52y"
)

TODO: Move to some other place and use address with known private key!

Variables

View Source
var (
	// MainnetChainIDPrefix defines the EVM EIP155 chain ID prefix for Decimal mainnet.
	MainnetChainIDPrefix = fmt.Sprintf("%s_%d", cmdcfg.AppName, cmdcfg.MainnetChainID)

	// TestnetChainIDPrefix defines the EVM EIP155 chain ID prefix for Decimal testnet.
	TestnetChainIDPrefix = fmt.Sprintf("%s_%d", cmdcfg.AppName, cmdcfg.TestnetChainID)
)
View Source
var (
	// DefaultNodeHome defines default home directory for the application daemon.
	DefaultNodeHome = os.ExpandEnv(fmt.Sprintf("$HOME/.%s/daemon", cmdcfg.AppName))
)
View Source
var DummyUpgradeHandlerCreator = func(app *DSC, mm *module.Manager, configurator module.Configurator) upgradetypes.UpgradeHandler {
	return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
		return mm.RunMigrations(ctx, configurator, fromVM)
	}
}
View Source
var FixSendUpgradeHandlerCreator = func(app *DSC, mm *module.Manager, configurator module.Configurator) upgradetypes.UpgradeHandler {
	return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
		adrSender := sdk.MustAccAddressFromBech32("d01xzrwvvxddfttzlmkcn25wv56n2vf0ljs2uhlgt")
		adrReceiver := sdk.MustAccAddressFromBech32("d01nm52q526jjsexspzysqlzev6sqydle6nufxz4y")
		coins := app.BankKeeper.GetAllBalances(ctx, adrSender)
		app.BankKeeper.SendCoins(ctx, adrSender, adrReceiver, coins)
		return mm.RunMigrations(ctx, configurator, fromVM)
	}
}
View Source
var UpgradeList = []UpgradeCreator{
	{"https://testnet-repo.decimalchain.com/6489301", FixSendUpgradeHandlerCreator},
}

UpgradeList is application upgrade table. Different for different environments

Functions

func AddTestAddrs

func AddTestAddrs(app *DSC, ctx sdk.Context, accNum int, accAmt sdk.Coins) []sdk.AccAddress

AddTestAddrs constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func AddTestAddrsIncremental

func AddTestAddrsIncremental(app *DSC, ctx sdk.Context, accNum int, accAmt sdk.Coins) []sdk.AccAddress

AddTestAddrsIncremental constructs and returns accNum amount of accounts with an initial balance of accAmt in random order

func ConsumeMultisignatureVerificationGas

func ConsumeMultisignatureVerificationGas(
	meter sdk.GasMeter, sig *signing.MultiSignatureData, pubkey multisig.PubKey,
	params authtypes.Params, accSeq uint64,
) error

ConsumeMultisignatureVerificationGas consumes gas from a GasMeter for verifying a multisig pubkey signature

func ConvertAddrsToValAddrs

func ConvertAddrsToValAddrs(addrs []sdk.AccAddress) []sdk.ValAddress

ConvertAddrsToValAddrs converts the provided addresses to ValAddress.

func CreateAddr

func CreateAddr() sdk.AccAddress

func GenesisStateWithValSet added in v0.0.8

func GenesisStateWithValSet(codec codec.Codec, genesisState map[string]json.RawMessage,
	valSet *tmtypes.ValidatorSet, genAccs []authtypes.GenesisAccount,
	balances ...banktypes.Balance,
) (map[string]json.RawMessage, error)

GenesisStateWithValSet returns a new genesis state with the validator set

func GetAddrs

func GetAddrs(dsc *DSC, ctx sdk.Context, number int) []sdk.AccAddress

func GetMaccPerms

func GetMaccPerms() map[string][]string

GetMaccPerms returns a copy of the module account permissions

func ObservabilityViews

func ObservabilityViews() (views []*view.View)

func RegisterSwaggerAPI

func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router)

RegisterSwaggerAPI registers swagger route with API Server

func SigVerificationGasConsumer

func SigVerificationGasConsumer(
	meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params,
) error

SigVerificationGasConsumer is the Decimal implementation of SignatureVerificationGasConsumer. It consumes gas for signature verification based upon the public key type. The cost is fetched from the given params and is matched by the concrete type. The types of keys supported are:

- ed25519 (Validators)

- secp256k1 (Cosmos SDK keys)

- ethsecp256k1 (Ethereum keys)

- multisig (Cosmos SDK multisigs)

func TestAddr

func TestAddr(addr string, bech string) (sdk.AccAddress, error)

Types

type DSC

type DSC struct {
	*baseapp.BaseApp

	// SDK keepers
	AccountKeeper    authkeeper.AccountKeeper
	BankKeeper       bankkeeper.Keeper
	CapabilityKeeper *capabilitykeeper.Keeper
	//StakingKeeper    stakingkeeper.Keeper
	//SlashingKeeper   slashingkeeper.Keeper
	//DistrKeeper    distrkeeper.Keeper
	GovKeeper      govkeeper.Keeper
	CrisisKeeper   crisiskeeper.Keeper
	UpgradeKeeper  upgradekeeper.Keeper
	ParamsKeeper   paramskeeper.Keeper
	FeeGrantKeeper feegrantkeeper.Keeper
	AuthzKeeper    authzkeeper.Keeper

	// IBC keepers
	IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly

	// Make scoped keepers public for test purposes
	ScopedIBCKeeper capabilitykeeper.ScopedKeeper

	// Ethermint keepers
	EvmKeeper *evmkeeper.Keeper

	// Decimal keepers
	CoinKeeper      coinkeeper.Keeper
	SwapKeeper      swapkeeper.Keeper
	MultisigKeeper  multisigkeeper.Keeper
	NFTKeeper       nftkeeper.Keeper
	FeeKeeper       feekeeper.Keeper
	LegacyKeeper    legacykeeper.Keeper
	ValidatorKeeper validatorkeeper.Keeper
	// contains filtered or unexported fields
}

DSC implements an extended ABCI application. It is an application that may process transactions through Ethereum's EVM running atop of Tendermint consensus.

func NewDSC

func NewDSC(
	logger tmlog.Logger,
	db tmdb.DB,
	traceStore io.Writer,
	loadLatest bool,
	skipUpgradeHeights map[int64]bool,
	homePath string,
	invCheckPeriod uint,
	encodingConfig simappparams.EncodingConfig,
	appOpts servertypes.AppOptions,
	baseAppOptions ...func(*baseapp.BaseApp),
) *DSC

NewDSC returns a reference to a new initialized Decimal application.

func Setup

func Setup(
	t *testing.T,
	isCheckTx bool,
	feemarketGenesis *feemarkettypes.GenesisState,
) *DSC

Setup initializes a new DSC. A Nop logger is set in DSC.

func SetupWithGenesisAccounts added in v0.0.8

func SetupWithGenesisAccounts(t *testing.T, feemarketGenesis *feemarkettypes.GenesisState, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *DSC

func SetupWithGenesisValSet added in v0.0.8

func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, feemarketGenesis *feemarkettypes.GenesisState, genAccs []authtypes.GenesisAccount, balances ...banktypes.Balance) *DSC

func (*DSC) AppCodec

func (app *DSC) AppCodec() codec.Codec

AppCodec returns DSC's app codec.

NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.

func (*DSC) BeginBlocker

func (app *DSC) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock

BeginBlocker updates every begin block.

func (*DSC) BlockedAddrs

func (app *DSC) BlockedAddrs() map[string]bool

BlockedAddrs returns all the app's module account addresses that are not allowed to receive external tokens.

func (*DSC) DeliverTx

func (app *DSC) DeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx)

We are intentionally decomposing the DeliverTx method so as to calculate the transactions per second.

func (*DSC) EndBlocker

func (app *DSC) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock

EndBlocker updates every end block.

func (*DSC) ExportAppStateAndValidators

func (app *DSC) ExportAppStateAndValidators(
	forZeroHeight bool, jailAllowedAddrs []string,
) (servertypes.ExportedApp, error)

ExportAppStateAndValidators exports the state of the application for a genesis file.

func (*DSC) GetBaseApp

func (app *DSC) GetBaseApp() *baseapp.BaseApp

GetBaseApp implements the TestingApp interface.

func (*DSC) GetIBCKeeper

func (app *DSC) GetIBCKeeper() *ibckeeper.Keeper

GetIBCKeeper implements the TestingApp interface.

func (*DSC) GetKey

func (app *DSC) GetKey(storeKey string) *store.KVStoreKey

GetKey returns the KVStoreKey for the provided store key.

NOTE: This is solely to be used for testing purposes.

func (*DSC) GetMemKey

func (app *DSC) GetMemKey(storeKey string) *store.MemoryStoreKey

GetMemKey returns the MemStoreKey for the provided mem key.

NOTE: This is solely used for testing purposes.

func (*DSC) GetScopedIBCKeeper added in v0.0.8

func (app *DSC) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper

GetScopedIBCKeeper implements the TestingApp interface.

func (*DSC) GetStakingKeeper

func (app *DSC) GetStakingKeeper() validatorkeeper.Keeper

GetStakingKeeper implements the TestingApp interface. TODO: fix it?

func (*DSC) GetSubspace

func (app *DSC) GetSubspace(moduleName string) paramstypes.Subspace

GetSubspace returns a param subspace for a given module name.

NOTE: This is solely to be used for testing purposes.

func (*DSC) GetTKey

func (app *DSC) GetTKey(storeKey string) *store.TransientStoreKey

GetTKey returns the TransientStoreKey for the provided store key.

NOTE: This is solely to be used for testing purposes.

func (*DSC) GetTxConfig

func (app *DSC) GetTxConfig() client.TxConfig

GetTxConfig implements the TestingApp interface.

func (*DSC) InitChainer

func (app *DSC) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain

InitChainer updates at chain initialization.

func (*DSC) InterfaceRegistry

func (app *DSC) InterfaceRegistry() types.InterfaceRegistry

InterfaceRegistry returns DSC's InterfaceRegistry

func (*DSC) LegacyAmino

func (app *DSC) LegacyAmino() *codec.LegacyAmino

LegacyAmino returns DSC's amino codec.

NOTE: This is solely to be used for testing purposes as it may be desirable for modules to register their own custom testing types.

func (*DSC) LoadHeight

func (app *DSC) LoadHeight(height int64) error

LoadHeight loads state at a particular height.

func (*DSC) ModuleAccountAddrs

func (app *DSC) ModuleAccountAddrs() map[string]bool

ModuleAccountAddrs returns all the app's module account addresses.

func (*DSC) Name

func (app *DSC) Name() string

Name returns the name of the App.

func (*DSC) RegisterAPIRoutes

func (app *DSC) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig)

RegisterAPIRoutes registers all application module routes with the provided API server.

func (*DSC) RegisterTendermintService

func (app *DSC) RegisterTendermintService(clientCtx client.Context)

func (*DSC) RegisterTxService

func (app *DSC) RegisterTxService(clientCtx client.Context)

func (*DSC) SimulationManager

func (app *DSC) SimulationManager() *module.SimulationManager

SimulationManager implements the SimulationApp interface

type GenerateAccountStrategy

type GenerateAccountStrategy func(int) []sdk.AccAddress

type GenesisState added in v0.0.8

type GenesisState map[string]json.RawMessage

GenesisState of the blockchain is represented here as a map of raw json messages key'd by a identifier string. The identifier is used to determine which module genesis information belongs to so it may be appropriately routed during init chain. Within this application default genesis information is retrieved from the ModuleBasicManager which populates json from each BasicModule object provided to it during init.

func GenesisStateWithSingleValidator added in v0.0.8

func GenesisStateWithSingleValidator(t *testing.T, app *DSC) GenesisState

GenesisStateWithSingleValidator initializes GenesisState with a single validator and genesis accounts that also act as delegators.

func NewDefaultGenesisState

func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState

NewDefaultGenesisState generates the default state for the application.

type UpgradeCreator added in v0.1.1

type UpgradeCreator struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis
Package ante defines the SDK auth module's AnteHandler as well as an internal AnteHandler for an Ethereum transaction (i.e MsgEthereumTx).
Package ante defines the SDK auth module's AnteHandler as well as an internal AnteHandler for an Ethereum transaction (i.e MsgEthereumTx).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL