app

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2019 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultKeyPass contains key password for genesis transactions
	DefaultKeyPass = "12345678"
)

Variables

View Source
var (
	DefaultLCDHome  = os.ExpandEnv("$HOME/.hashgardlcd")
	DefaultNodeHome = os.ExpandEnv("$HOME/.hashgard")
	DefaultCLIHome  = os.ExpandEnv("$HOME/.hashgardcli")
)

default home directories for expected binaries

View Source
var (
	// bonded tokens given to genesis validators/accounts
	FreeFermionsAcc = sdk.NewIntWithDecimal(150, 18)

	StakeDenom = "agard"
)

Functions

func CollectStdTxs

func CollectStdTxs(cdc *codec.Codec, moniker string, genTxsDir string, genDoc tmtypes.GenesisDoc) (
	appGenTxs []auth.StdTx, persistentPeers string, err error)

CollectStdTxs processes and validates application's genesis StdTxs and returns the list of appGenTxs, and persistent peers required to generate genesis.json.

func HashgardAppGenStateJSON

func HashgardAppGenStateJSON(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) (appState json.RawMessage, err error)

HashgardAppGenState but with JSON

func HashgardValidateGenesisState

func HashgardValidateGenesisState(genesisState GenesisState) error

HashgardValidateGenesisState ensures that the genesis state obeys the expected invariants TODO: No validators are both bonded and jailed (#2088) TODO: Error if there is a duplicate validator (#1708) TODO: Ensure all state machine parameters are in genesis (#1704)

func MakeCodec

func MakeCodec() *codec.Codec

MakeCodec creates a new codec and registers all the necessary types with the codec.

Types

type BankHooks added in v0.6.0

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

func NewBankHooks added in v0.6.0

func NewBankHooks(boxHooks box.Hooks, issueHooks issue.Hooks, accHooks acc.Hooks) BankHooks

func (BankHooks) CanSend added in v0.6.0

func (bankHooks BankHooks) CanSend(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) (bool, sdk.Error)

nolint

func (BankHooks) CheckMustMemoAddress added in v0.7.0

func (bankHooks BankHooks) CheckMustMemoAddress(ctx sdk.Context, toAddr sdk.AccAddress, memo string) (bool, sdk.Error)

type GenesisAccount

type GenesisAccount struct {
	Address       sdk.AccAddress `json:"address"`
	Coins         sdk.Coins      `json:"coins"`
	Sequence      uint64         `json:"sequence_number"`
	AccountNumber uint64         `json:"account_number"`

	// vesting account fields
	OriginalVesting  sdk.Coins `json:"original_vesting"`  // total vesting coins upon initialization
	DelegatedFree    sdk.Coins `json:"delegated_free"`    // delegated vested coins at time of delegation
	DelegatedVesting sdk.Coins `json:"delegated_vesting"` // delegated vesting coins at time of delegation
	StartTime        int64     `json:"start_time"`        // vesting start time (UNIX Epoch time)
	EndTime          int64     `json:"end_time"`          // vesting end time (UNIX Epoch time)
}

nolint

func NewDefaultGenesisAccount

func NewDefaultGenesisAccount(addr sdk.AccAddress) GenesisAccount

func NewGenesisAccount

func NewGenesisAccount(acc *auth.BaseAccount) GenesisAccount

func NewGenesisAccountI

func NewGenesisAccountI(acc auth.Account) GenesisAccount

func (*GenesisAccount) ToAccount

func (ga *GenesisAccount) ToAccount() auth.Account

convert GenesisAccount to auth.BaseAccount

type GenesisState

type GenesisState struct {
	Accounts         []GenesisAccount          `json:"accounts"`
	AccMustMemoData  acc.GenesisState          `json:"must-memo-addresses"`
	AuthData         auth.GenesisState         `json:"auth"`
	BankData         bank.GenesisState         `json:"bank"`
	StakingData      staking.GenesisState      `json:"staking"`
	MintData         mint.GenesisState         `json:"mint"`
	DistributionData distribution.GenesisState `json:"distribution"`
	SlashingData     slashing.GenesisState     `json:"slashing"`
	GovData          gov.GenesisState          `json:"gov"`
	ExchangeData     exchange.GenesisState     `json:"exchange"`
	IssueData        issue.GenesisState        `json:"issue"`
	RecordData       record.GenesisState       `json:"record"`
	BoxData          box.GenesisState          `json:"box"`
	CrisisData       crisis.GenesisState       `json:"crisis"`
	GenTxs           []json.RawMessage         `json:"gentxs"`
}

State to Unmarshal

func HashgardAppGenState

func HashgardAppGenState(cdc *codec.Codec, genDoc tmtypes.GenesisDoc, appGenTxs []json.RawMessage) (genesisState GenesisState, err error)

Create the core parameters for genesis initialization for hashgard note that the pubkey input is this machines pubkey

func NewDefaultGenesisState

func NewDefaultGenesisState() GenesisState

NewDefaultGenesisState generates the default state for hashgard.

func NewGenesisState

func NewGenesisState(
	accounts []GenesisAccount,
	accMustMemoData acc.GenesisState,
	authData auth.GenesisState,
	bankData bank.GenesisState,
	stakingData staking.GenesisState,
	mintData mint.GenesisState,
	distributionData distribution.GenesisState,
	govData gov.GenesisState,
	slashingData slashing.GenesisState,
	exchangeData exchange.GenesisState,
	issueData issue.GenesisState,
	recordData record.GenesisState,
	boxData box.GenesisState,
	crisisData crisis.GenesisState,
) GenesisState

func (GenesisState) Sanitize added in v0.3.1

func (gs GenesisState) Sanitize()

Sanitize sorts accounts and coin sets.

type HashgardApp

type HashgardApp struct {
	*bam.BaseApp
	// contains filtered or unexported fields
}

Extended ABCI application

func NewHashgardApp

func NewHashgardApp(logger log.Logger, db dbm.DB, traceStore io.Writer,
	loadLatest bool,
	invCheckPeriod uint,
	baseAppOptions ...func(*bam.BaseApp)) *HashgardApp

NewHashgardApp returns a reference to an initialized HashgardApp.

func (*HashgardApp) BeginBlocker

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

application updates every end block

func (*HashgardApp) EndBlocker

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

application updates every end block nolint: unparam

func (*HashgardApp) ExportAppStateAndValidators

func (app *HashgardApp) ExportAppStateAndValidators(forZeroHeight bool, jailWhiteList []string) (
	appState json.RawMessage, validators []tmtypes.GenesisValidator, err error)

export the state of hashgard for a genesis file

func (*HashgardApp) LoadHeight

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

load a particular height

type StakingHooks

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

StakingHooks contains combined distribution and slashing hooks needed for the staking module.

func NewStakingHooks

func NewStakingHooks(dh distribution.Hooks, sh slashing.Hooks) StakingHooks

func (StakingHooks) AfterDelegationModified added in v0.3.0

func (h StakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (StakingHooks) AfterValidatorBeginUnbonding added in v0.3.0

func (h StakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (StakingHooks) AfterValidatorBonded added in v0.3.0

func (h StakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (StakingHooks) AfterValidatorCreated added in v0.3.0

func (h StakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

nolint

func (StakingHooks) AfterValidatorRemoved added in v0.3.0

func (h StakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (StakingHooks) BeforeDelegationCreated added in v0.3.0

func (h StakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (StakingHooks) BeforeDelegationRemoved added in v0.3.0

func (h StakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (StakingHooks) BeforeDelegationSharesModified added in v0.3.0

func (h StakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (StakingHooks) BeforeValidatorModified added in v0.3.0

func (h StakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

func (StakingHooks) BeforeValidatorSlashed added in v0.3.0

func (h StakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

Jump to

Keyboard shortcuts

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