types

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ModuleName = "accounts"

ModuleName is "accounts"

Variables

View Source
var ModuleCdc *codec.Codec

ModuleCdc - generic sealed codec to be used throughout this module

Functions

func SetGenesisStateInAppState

func SetGenesisStateInAppState(cdc *codec.Codec,
	appState map[string]json.RawMessage, genesisState GenesisState) map[string]json.RawMessage

set the genesis state within the expected app state

func ValidateGenesis

func ValidateGenesis(genesisState GenesisState) error

ValidateGenesis performs validation of genesis accounts. It ensures that there are no duplicate accounts in the genesis state and any provided vesting accounts are valid.

Types

type AccountKeeper

type AccountKeeper interface {
	NewAccount(sdk.Context, authexported.Account) authexported.Account
	SetAccount(sdk.Context, authexported.Account)
	IterateAccounts(ctx sdk.Context, process func(authexported.Account) (stop bool))
}

AccountKeeper defines the expected account keeper (noalias)

type GenesisAccount

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

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

	// module account fields
	ModuleName        string   `json:"module_name" yaml:"module_name"`               // name of the module account
	ModulePermissions []string `json:"module_permissions" yaml:"module_permissions"` // permissions of module account
}

GenesisAccount is a struct for account initialization used exclusively during genesis

func NewGenesisAccount

func NewGenesisAccount(acc *auth.BaseAccount) GenesisAccount

NewGenesisAccount creates a GenesisAccount instance from a BaseAccount.

func NewGenesisAccountI

func NewGenesisAccountI(acc authexported.Account) (GenesisAccount, error)

NewGenesisAccountI creates a GenesisAccount instance from an Account interface.

func NewGenesisAccountRaw

func NewGenesisAccountRaw(address sdk.AccAddress, coins,
	vestingAmount sdk.Coins, vestingStartTime, vestingEndTime int64,
	module string, permissions ...string) GenesisAccount

NewGenesisAccountRaw creates a new GenesisAccount object

func (*GenesisAccount) ToAccount

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

ToAccount converts a GenesisAccount to an Account interface

func (GenesisAccount) Validate

func (ga GenesisAccount) Validate() error

Validate checks for errors on the vesting and module account parameters

type GenesisAccounts

type GenesisAccounts []GenesisAccount

___________________________________

func (GenesisAccounts) Contains

func (gaccs GenesisAccounts) Contains(acc sdk.AccAddress) bool

genesis accounts contain an address

type GenesisState

type GenesisState GenesisAccounts

State to Unmarshal

func GetGenesisStateFromAppState

func GetGenesisStateFromAppState(cdc *codec.Codec, appState map[string]json.RawMessage) GenesisState

get the genesis state from the expected app state

func (GenesisState) Sanitize

func (gs GenesisState) Sanitize()

Sanitize sorts accounts and coin sets.

Jump to

Keyboard shortcuts

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