authx

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSpaceAuthX sdk.CodespaceType = "authx"

	// 201 ~ 299
	CodeInvalidMinGasPriceLimit sdk.CodeType = 201
	CodeGasPriceTooLow          sdk.CodeType = 202
)
View Source
const (
	// StoreKey is string representation of the store key for authx
	StoreKey = "accx"
	// QuerierRoute is the querier route for accx
	QuerierRoute = StoreKey
)
View Source
const (
	// DefaultMinGasPrice of the network
	// Make token transfer/send tx to costs around 0.01CET
	// activated account send to self,                  costs 38883 gas
	// activated account send to non-activated account, costs 48951 gas
	// activated account send to other activated addr,  costs 33903 gas
	// consider it takes 50000 to do transfer/send tx
	// so, min_gas_price = 100000000sato.CET * 0.01 / 50000 = 20 sato.CET
	DefaultMinGasPriceLimit = "20.0"
)

Default parameter values

View Source
const DefaultParamspace = "authx"

DefaultParamspace defines the default authx module parameter subspace

View Source
const (
	QueryAccountX = "accountx"
)

query endpoints supported by the auth Querier

Variables

View Source
var (
	PrefixUnlockedCoinsQueue = []byte("UnlockedCoinsQueue")
	KeyDelimiter             = []byte(";")
)
View Source
var (
	// AddressStoreKeyPrefix prefix for accountx-by-address store
	AddressStoreKeyPrefix = []byte{0x01}
)
View Source
var (
	KeyMinGasPriceLimit = []byte("MinGasPriceLimit")
)

Parameter keys

Functions

func AddressStoreKey

func AddressStoreKey(addr sdk.AccAddress) []byte

func EndBlocker

func EndBlocker(ctx sdk.Context, aux AccountXKeeper, keeper auth.AccountKeeper)

func ErrGasPriceTooLow

func ErrGasPriceTooLow(required, actual sdk.Dec) sdk.Error

func ErrInvalidMinGasPriceLimit

func ErrInvalidMinGasPriceLimit(limit sdk.Dec) sdk.Error

func InitGenesis

func InitGenesis(ctx sdk.Context, keeper AccountXKeeper, data GenesisState)

InitGenesis - Init store state from genesis data

func KeyUnlockedCoinsQueue

func KeyUnlockedCoinsQueue(unlockedTime int64, address sdk.AccAddress) []byte

func NewAnteHandler

func NewAnteHandler(ak auth.AccountKeeper, fck auth.FeeCollectionKeeper,
	axk AccountXKeeper, anteHelper AnteHelper) sdk.AnteHandler

NewAnteHandler returns an AnteHandler that checks and increments sequence numbers, checks signatures & account numbers, and deducts fees from the first signer.

func NewQuerier

func NewQuerier(keeper AccountXKeeper) sdk.Querier

creates a querier for auth REST endpoints

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for authx module

func PrefixUnlockedTimeQueueTime

func PrefixUnlockedTimeQueueTime(unlockedTime int64) []byte

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the codec

Types

type AccountAll

type AccountAll struct {
	Account  auth.Account `json:"account"`
	AccountX AccountX     `json:"account_x"`
}

func (AccountAll) String

func (accAll AccountAll) String() string

type AccountMix

type AccountMix struct {
	Address       sdk.AccAddress `json:"address"`
	Coins         sdk.Coins      `json:"coins"`
	LockedCoins   LockedCoins    `json:"locked_coins"`
	FrozenCoins   sdk.Coins      `json:"frozen_coins"`
	PubKey        crypto.PubKey  `json:"public_key"`
	AccountNumber uint64         `json:"account_number"`
	Sequence      uint64         `json:"sequence"`
	MemoRequired  bool           `json:"memo_required"` // if memo is required for receiving coins
}

func NewAccountMix

func NewAccountMix(acc auth.Account, x AccountX) AccountMix

type AccountX

type AccountX struct {
	Address      sdk.AccAddress `json:"address"`
	MemoRequired bool           `json:"memo_required"` // if memo is required for receiving coins
	LockedCoins  LockedCoins    `json:"locked_coins"`
	FrozenCoins  sdk.Coins      `json:"frozen_coins"`
}

func NewAccountXWithAddress

func NewAccountXWithAddress(addr sdk.AccAddress) AccountX

func (*AccountX) AddLockedCoins

func (acc *AccountX) AddLockedCoins(coins LockedCoins)

func (*AccountX) GetAddress

func (acc *AccountX) GetAddress() sdk.AccAddress

func (*AccountX) GetAllLockedCoins

func (acc *AccountX) GetAllLockedCoins() LockedCoins

func (*AccountX) GetAllUnlockedCoinsAtTheTime

func (acc *AccountX) GetAllUnlockedCoinsAtTheTime(time int64) LockedCoins

func (*AccountX) GetLockedCoinsByDemon

func (acc *AccountX) GetLockedCoinsByDemon(demon string) LockedCoins

func (*AccountX) GetUnlockedCoinsAtTheTime

func (acc *AccountX) GetUnlockedCoinsAtTheTime(demon string, time int64) LockedCoins

func (*AccountX) IsMemoRequired

func (acc *AccountX) IsMemoRequired() bool

func (*AccountX) SetAddress

func (acc *AccountX) SetAddress(address sdk.AccAddress)

func (*AccountX) SetMemoRequired

func (acc *AccountX) SetMemoRequired(b bool)

func (AccountX) String

func (acc AccountX) String() string

func (*AccountX) TransferUnlockedCoins

func (acc *AccountX) TransferUnlockedCoins(time int64, ctx sdk.Context, kx AccountXKeeper, keeper auth.AccountKeeper)

type AccountXKeeper

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

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSubspace params.Subspace) AccountXKeeper

func (AccountXKeeper) GetAccountX

func (axk AccountXKeeper) GetAccountX(ctx sdk.Context, addr sdk.AccAddress) (ax AccountX, ok bool)

func (AccountXKeeper) GetOrCreateAccountX

func (axk AccountXKeeper) GetOrCreateAccountX(ctx sdk.Context, addr sdk.AccAddress) AccountX

func (AccountXKeeper) GetParams

func (axk AccountXKeeper) GetParams(ctx sdk.Context) (params Params)

GetParams gets the asset module's parameters.

func (AccountXKeeper) InsertUnlockedCoinsQueue

func (axk AccountXKeeper) InsertUnlockedCoinsQueue(ctx sdk.Context, unlockedTime int64, address sdk.AccAddress)

func (AccountXKeeper) IterateAccounts

func (axk AccountXKeeper) IterateAccounts(ctx sdk.Context, process func(AccountX) (stop bool))

func (AccountXKeeper) RemoveFromUnlockedCoinsQueue

func (axk AccountXKeeper) RemoveFromUnlockedCoinsQueue(ctx sdk.Context, unlockedTime int64, address sdk.AccAddress)

func (AccountXKeeper) RemoveFromUnlockedCoinsQueueByKey

func (axk AccountXKeeper) RemoveFromUnlockedCoinsQueueByKey(ctx sdk.Context, key []byte)

func (AccountXKeeper) SetAccountX

func (axk AccountXKeeper) SetAccountX(ctx sdk.Context, ax AccountX)

func (AccountXKeeper) SetParams

func (axk AccountXKeeper) SetParams(ctx sdk.Context, params Params)

SetParams sets the asset module's parameters.

func (AccountXKeeper) UnlockedCoinsQueueIterator

func (axk AccountXKeeper) UnlockedCoinsQueueIterator(ctx sdk.Context, unlockedTime int64) sdk.Iterator

type AnteHelper

type AnteHelper interface {
	CheckMsg(ctx sdk.Context, msg sdk.Msg, memo string) sdk.Error
}

type GenesisState

type GenesisState struct {
	Params Params `json:"params"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState - Return a default genesis state

func ExportGenesis

func ExportGenesis(ctx sdk.Context, keeper AccountXKeeper) GenesisState

ExportGenesis returns a GenesisState for a given context and keeper

func NewGenesisState

func NewGenesisState(params Params) GenesisState

func (GenesisState) Validate

func (data GenesisState) Validate() error

ValidateGenesis performs basic validation of asset genesis data returning an error for any failed validation criteria.

type LockedCoin

type LockedCoin struct {
	Coin       sdk.Coin `json:"coin"`
	UnlockTime int64    `json:"unlock_time"`
}

func (LockedCoin) String

func (coin LockedCoin) String() string

type LockedCoins

type LockedCoins []LockedCoin

func (LockedCoins) String

func (coins LockedCoins) String() string

type Params

type Params struct {
	MinGasPriceLimit sdk.Dec `json:"min_gas_price_limit"`
}

Params defines the parameters for the authx module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Params types are identical.

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of authx module's parameters.

func (Params) String

func (p Params) String() string

String implements the stringer interface.

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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