vmauth

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

Implements account keeper with vm storage inside to allow work with accounts from VM.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccResToBytes

func AccResToBytes(acc AccountResource) []byte

Convert account resource to bytes.

func AddrToPathAddr

func AddrToPathAddr(addr []byte) []byte

Bytes to libra compability.

func GetAccountCmd

func GetAccountCmd(cdc *codec.Codec) *cobra.Command

GetAccountCmd returns a query account that will display the state of the account at a given address.

func GetResPath

func GetResPath() []byte

Get resource path.

func GetSignerAcc

func GetSignerAcc(ctx sdk.Context, ak VMAccountKeeper, addr sdk.AccAddress) (exported.Account, sdk.Result)

GetSignerAcc returns an account for a given address that is expected to sign a transaction.

func NewQuerier

func NewQuerier(keeper VMAccountKeeper) sdk.Querier

creates a querier for auth REST endpoints

Types

type AccountResource

type AccountResource struct {
	Balances       []DNCoin     // coins.
	WithdrawEvents *EventHandle // receive events handler.
	DepositEvents  *EventHandle // sent events handler.
	EventGenerator uint64       // event generator.
}

Balances of account in case of standard lib.

func AccResFromAccount

func AccResFromAccount(acc exported.Account, source *AccountResource) AccountResource

Convert acc to account resource.

func BytesToAccRes

func BytesToAccRes(bz []byte) AccountResource

Unmarshall bytes to account.

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

___________________________ app module object

func NewAppModule

func NewAppModule(accountKeeper VMAccountKeeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock

func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)

module begin-block

func (AppModule) EndBlock

module end-block

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

module export genesis

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

module init-genesis

func (AppModule) Name

func (AppModule) Name() string

module name

func (AppModule) NewHandler

func (AppModule) NewHandler() sdk.Handler

module handler

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

module querier

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

module querier route name

func (AppModule) RegisterInvariants

func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

register invariants

func (AppModule) Route

func (AppModule) Route() string

module message route name

type AppModuleBasic

type AppModuleBasic struct{}

app module basics object

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis() json.RawMessage

default genesis state

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

get the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

get the root tx command of this module

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

module name

func (AppModuleBasic) RegisterCodec

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

register module codec

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

register rest routes

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

module validate genesis

type DNCoin

type DNCoin struct {
	Denom []byte  // coin denom
	Value sdk.Int // coin value
}

type EventHandle

type EventHandle struct {
	Count uint64
	Key   []byte
}

Event handle for account.

type VMAccountKeeper

type VMAccountKeeper struct {
	*auth.AccountKeeper
	// contains filtered or unexported fields
}

Implements account keeper with vm storage support.

func NewVMAccountKeeper

func NewVMAccountKeeper(cdc *codec.Codec, key sdk.StoreKey, paramstore params.Subspace, vmKeeper common_vm.VMStorage, proto func() exported.Account) VMAccountKeeper

Create new account vm keeper.

func (VMAccountKeeper) GetAccount

func (keeper VMAccountKeeper) GetAccount(ctx sdk.Context, addr sdk.AccAddress) exported.Account

Get account from storage.

func (VMAccountKeeper) GetAllAccounts

func (keeper VMAccountKeeper) GetAllAccounts(ctx sdk.Context) []exported.Account

GetAllAccounts returns all accounts in the accountKeeper. as it's not calling anywhere, as it seems, we can ignore vm storage for now. todo: process all vm storage accounts and compare with standard accounts.

func (VMAccountKeeper) RemoveAccount

func (keeper VMAccountKeeper) RemoveAccount(ctx sdk.Context, acc exported.Account)

Removes an account from storage. NOTE: this will cause supply invariant violation if called

func (VMAccountKeeper) SetAccount

func (keeper VMAccountKeeper) SetAccount(ctx sdk.Context, acc exported.Account)

Set account in storage.

Jump to

Keyboard shortcuts

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