app

package
v0.10.14 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: MPL-2.0 Imports: 75 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultCLIHome      = os.ExpandEnv("$HOME/.bnbcli")
	DefaultNodeHome     = os.ExpandEnv("$HOME/.bnbchaind")
	Bech32PrefixAccAddr string
)

default home directories for expected binaries

View Source
var (
	Codec         = MakeCodec()
	ServerContext = config.NewDefaultContext()
)
View Source
var (
	// each genesis validators will self delegate 10000e8 native tokens to become a validator
	DefaultSelfDelegationToken = sdk.NewCoin(types.NativeTokenSymbol, 10000e8)
	// we put 20% of the total supply to the stake pool
	DefaultMaxBondedTokenAmount int64 = types.NativeTokenTotalSupply
	// set default unbonding duration to 7 days
	DefaultUnbondingTime = 60 * 60 * 24 * 7 * time.Second
	// default max validators to 21
	DefaultMaxValidators uint16 = 21

	// min gov deposit
	DefaultGovMinDesposit = sdk.Coins{sdk.NewCoin(types.NativeTokenSymbol, 1000e8)}
)
View Source
var (
	DefaultCacheSize  = 20000
	DefaultMaxSurvive = 10
)
View Source
var DefaultKeyPass = "12345678"

DefaultKeyPass only for private test net

Functions

func BinanceAppGenState

func BinanceAppGenState(cdc *wire.Codec, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)

AppGenState sets up the app_state and appends the cool app state

func BinanceAppInit

func BinanceAppInit() server.AppInit

func MakeCodec

func MakeCodec() *wire.Codec

MakeCodec creates a custom tx codec.

func NewSentryApplication

func NewSentryApplication(logger log.Logger, _ db.DB, _ io.Writer) abci.Application

func PersistentPreRunEFn

func PersistentPreRunEFn(context *config.BinanceChainContext) func(*cobra.Command, []string) error

PersistentPreRunEFn returns a PersistentPreRunE function for cobra that initailizes the passed in context with a properly configured logger and config object

func SetUpgradeConfig

func SetUpgradeConfig(upgradeConfig *config.UpgradeConfig)

SetUpgradeConfig will overwrite default upgrade config

Types

type BinanceChain

type BinanceChain struct {
	*baseapp.BaseApp
	Codec *wire.Codec

	// keepers
	CoinKeeper    bank.Keeper
	DexKeeper     *dex.DexKeeper
	AccountKeeper auth.AccountKeeper
	TokenMapper   tokens.Mapper
	ValAddrCache  *ValAddrCache

	// keeper to process param store and update
	ParamHub *param.Keeper
	// contains filtered or unexported fields
}

BinanceChain is the BNBChain ABCI application

func NewBinanceChain

func NewBinanceChain(logger log.Logger, db dbm.DB, traceStore io.Writer, baseAppOptions ...func(*baseapp.BaseApp)) *BinanceChain

NewBinanceChain creates a new instance of the BinanceChain.

func (*BinanceChain) AccountHandler

func (app *BinanceChain) AccountHandler(chainApp types.ChainApp, req abci.RequestQuery, path []string) *abci.ResponseQuery

func (*BinanceChain) BeginBlocker

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

func (*BinanceChain) CheckTx

func (app *BinanceChain) CheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx)

func (*BinanceChain) Commit

func (app *BinanceChain) Commit() (res abci.ResponseCommit)

func (*BinanceChain) DeliverTx

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

Implements ABCI

func (*BinanceChain) EndBlocker

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

func (*BinanceChain) ExportAppStateAndValidators

func (app *BinanceChain) ExportAppStateAndValidators() (appState json.RawMessage, validators []tmtypes.GenesisValidator, err error)

ExportAppStateAndValidators exports blockchain world state to json.

func (*BinanceChain) GetCodec

func (app *BinanceChain) GetCodec() *wire.Codec

GetCodec returns the app's Codec.

func (*BinanceChain) GetContextForCheckState

func (app *BinanceChain) GetContextForCheckState() sdk.Context

GetContextForCheckState gets the context for the check state.

func (*BinanceChain) GetRouter

func (app *BinanceChain) GetRouter() baseapp.Router

GetRouter returns the app's Router.

func (*BinanceChain) PreDeliverTx

func (app *BinanceChain) PreDeliverTx(req abci.RequestDeliverTx) (res abci.ResponseDeliverTx)

PreDeliverTx implements extended ABCI for concurrency PreCheckTx would perform decoding, signture and other basic verification

func (*BinanceChain) Query

func (app *BinanceChain) Query(req abci.RequestQuery) (res abci.ResponseQuery)

Query performs an abci query.

func (*BinanceChain) RegisterQueryHandler

func (app *BinanceChain) RegisterQueryHandler(prefix string, handler types.AbciQueryHandler)

RegisterQueryHandler registers an abci query handler, implements ChainApp.RegisterQueryHandler.

func (*BinanceChain) WriteRecoveryChunk

func (app *BinanceChain) WriteRecoveryChunk(hash abci.SHA256Sum, chunk *abci.AppStateChunk, isComplete bool) (err error)

type GenesisAccount

type GenesisAccount struct {
	Name          string         `json:"name"`
	Address       sdk.AccAddress `json:"address"`
	ConsensusAddr crypto.Address `json:"consensus_addr"` // only validator's account has this address
}

GenesisAccount doesn't need pubkey or sequence

func NewGenesisAccount

func NewGenesisAccount(aa *types.AppAccount, consensusAddr crypto.Address) GenesisAccount

NewGenesisAccount -

func (*GenesisAccount) ToAppAccount

func (ga *GenesisAccount) ToAppAccount() (acc *types.AppAccount)

convert GenesisAccount to AppAccount

type GenesisState

type GenesisState struct {
	Tokens       []tokens.GenesisToken   `json:"tokens"`
	Accounts     []GenesisAccount        `json:"accounts"`
	DexGenesis   dex.Genesis             `json:"dex"`
	ParamGenesis paramtypes.GenesisState `json:"param"`
	StakeData    stake.GenesisState      `json:"stake"`
	GovData      gov.GenesisState        `json:"gov"`
	GenTxs       []json.RawMessage       `json:"gentxs"`
}

type SentryApplication

type SentryApplication struct {
	abci.BaseApplication
	Codec *wire.Codec
	// contains filtered or unexported fields
}

func (*SentryApplication) BeginBlock

func (*SentryApplication) CheckTx

func (*SentryApplication) Info

func (app *SentryApplication) Info(req abci.RequestInfo) (resInfo abci.ResponseInfo)

func (*SentryApplication) InitChain

func (app *SentryApplication) InitChain(req abci.RequestInitChain) (res abci.ResponseInitChain)

func (*SentryApplication) ReCheckTx

func (app *SentryApplication) ReCheckTx(req abci.RequestCheckTx) (res abci.ResponseCheckTx)

type SentryConfig

type SentryConfig struct {
	CacheSize  int
	MaxSurvive int
}

type ValAddrCache

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

func NewValAddrCache

func NewValAddrCache(stakeKeeper stake.Keeper) *ValAddrCache

func (*ValAddrCache) ClearCache

func (vac *ValAddrCache) ClearCache()

func (*ValAddrCache) GetAccAddr

func (vac *ValAddrCache) GetAccAddr(ctx sdk.Context, consAddr sdk.ConsAddress) sdk.AccAddress

func (*ValAddrCache) GetDistributionAddr added in v0.10.4

func (vac *ValAddrCache) GetDistributionAddr(ctx sdk.Context, consAddr sdk.ConsAddress) sdk.AccAddress

func (*ValAddrCache) SetAccAddr

func (vac *ValAddrCache) SetAccAddr(consAddr sdk.ConsAddress, accAddr sdk.AccAddress)

func (*ValAddrCache) SetDistributionAddr added in v0.10.4

func (vac *ValAddrCache) SetDistributionAddr(consAddr sdk.ConsAddress, accAddr sdk.AccAddress)

Directories

Path Synopsis
pub
sub

Jump to

Keyboard shortcuts

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