types

package
v0.2.2-alpha Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

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

	// 201 ~ 299
	CodeInvalidMinGasPriceLimit sdk.CodeType = 201
	CodeGasPriceTooLow          sdk.CodeType = 202
	CodeRefereeChangeTooFast    sdk.CodeType = 203
	CodeRefereeMemoRequired     sdk.CodeType = 204
	CodeRefereeCanNotBeYourself sdk.CodeType = 205
)
View Source
const (
	AttributeValueCategory = ModuleName

	EventTypeSetReferee = "set_referee"

	AttributeReferee           = "referee_addr"
	AttributeRefereeChangeTime = "referee_change_time"
)
View Source
const (
	// StoreKey is string representation of the store key for authx
	StoreKey = "accx"
	// QuerierRoute is the querier route for accx
	QuerierRoute = StoreKey

	RouteKey = ModuleName
)
View Source
const (
	QueryParameters = "parameters"
	QueryAccountMix = "accountMix"
)

query endpoints supported by the auth Querier

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"
	DefaultRefereeChangeMinInterval = time.Second * 24 * 60 * 60
	DefaultRebateRatio              = 1000
	RebateRatioBase                 = 10000
)

Default parameter values

View Source
const DefaultParamspace = ModuleName

DefaultParamspace defines the default authx module parameter subspace

View Source
const ModuleName = "authx"

Variables

View Source
var (
	KeyMinGasPriceLimit         = []byte("MinGasPriceLimit")
	KeyRefereeChangeMinInterval = []byte("RefereeChangeMinInterval")
	KeyRebateRatio              = []byte("RebateRatio")
)

Parameter keys

View Source
var ModuleCdc = codec.New()

Functions

func ErrGasPriceTooLow

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

func ErrInvalidMinGasPriceLimit

func ErrInvalidMinGasPriceLimit(limit sdk.Dec) sdk.Error

func ErrRefereeCanNotBeYouself

func ErrRefereeCanNotBeYouself(referee string) sdk.Error

func ErrRefereeChangeTooFast

func ErrRefereeChangeTooFast(referee string) sdk.Error

func ErrRefereeMemoRequired

func ErrRefereeMemoRequired(referee string) sdk.Error

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for authx module

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
	Referee           sdk.AccAddress `json:"referee"`
	RefereeChangeTime int64          `json:"referee_change_time"`
}

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"`
	Referee           sdk.AccAddress `json:"referee,omitempty"`             // DEX2
	RefereeChangeTime int64          `json:"referee_change_time,omitempty"` // DEX2
}

func NewAccountX

func NewAccountX(address sdk.AccAddress, memoRequired bool, lockedCoins LockedCoins, frozenCoins sdk.Coins, referee sdk.AccAddress, refereeChangeTime int64) AccountX

func NewAccountXWithAddress

func NewAccountXWithAddress(addr sdk.AccAddress) AccountX

func (*AccountX) AddLockedCoins

func (acc *AccountX) AddLockedCoins(coins LockedCoins)

func (*AccountX) GetAllCoins

func (acc *AccountX) GetAllCoins() sdk.Coins

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) SetMemoRequired

func (acc *AccountX) SetMemoRequired(b bool)

func (AccountX) String

func (acc AccountX) String() string

func (*AccountX) UpdateRefereeAddr

func (acc *AccountX) UpdateRefereeAddr(referee sdk.AccAddress, time int64)

type AccountXs

type AccountXs []AccountX

type LockedCoin

type LockedCoin struct {
	Coin        sdk.Coin       `json:"coin"`
	UnlockTime  int64          `json:"unlock_time"`
	FromAddress sdk.AccAddress `json:"from_address,omitempty"`
	Supervisor  sdk.AccAddress `json:"supervisor,omitempty"`
	Reward      int64          `json:"reward,omitempty"`
}

func NewLockedCoin

func NewLockedCoin(denom string, amount sdk.Int, unlockTime int64) LockedCoin

func NewSupervisedLockedCoin

func NewSupervisedLockedCoin(denom string, amount sdk.Int, unlockTime int64, fromAddress sdk.AccAddress, supervisor sdk.AccAddress, reward int64) LockedCoin

func (LockedCoin) IsEqual

func (coin LockedCoin) IsEqual(other LockedCoin) bool

func (LockedCoin) String

func (coin LockedCoin) String() string

type LockedCoins

type LockedCoins []LockedCoin

func (LockedCoins) String

func (coins LockedCoins) String() string

type MergedParams

type MergedParams struct {
	MaxMemoCharacters        uint64  `json:"max_memo_characters" yaml:"max_memo_characters"`
	TxSigLimit               uint64  `json:"tx_sig_limit" yaml:"tx_sig_limit"`
	TxSizeCostPerByte        uint64  `json:"tx_size_cost_per_byte" yaml:"tx_size_cost_per_byte"`
	SigVerifyCostED25519     uint64  `json:"sig_verify_cost_ed25519" yaml:"sig_verify_cost_ed25519"`
	SigVerifyCostSecp256k1   uint64  `json:"sig_verify_cost_secp256k1" yaml:"sig_verify_cost_secp256k1"`
	MinGasPriceLimit         sdk.Dec `json:"min_gas_price_limit" yaml:"min_gas_price_limit"`
	RefereeChangeMinInterval int64   `json:"referee_change_min_interval" yaml:"referee_change_min_interval"`
	RebateRatio              int64   `json:"rebate_ratio" yaml:"rebate_ratio"`
}

func NewMergedParams

func NewMergedParams(params auth.Params, paramsx Params) MergedParams

func (MergedParams) String

func (p MergedParams) String() string

String implements the stringer interface.

type MsgSetReferee

type MsgSetReferee struct {
	Sender  sdk.AccAddress `json:"sender"`
	Referee sdk.AccAddress `json:"referee"`
}

func NewMsgSetReferee

func NewMsgSetReferee(sender sdk.AccAddress, referee sdk.AccAddress) MsgSetReferee

func (MsgSetReferee) GetSignBytes

func (msg MsgSetReferee) GetSignBytes() []byte

func (MsgSetReferee) GetSigners

func (msg MsgSetReferee) GetSigners() []sdk.AccAddress

func (MsgSetReferee) Route

func (msg MsgSetReferee) Route() string

func (*MsgSetReferee) SetAccAddress

func (msg *MsgSetReferee) SetAccAddress(addr sdk.AccAddress)

func (MsgSetReferee) Type

func (msg MsgSetReferee) Type() string

func (MsgSetReferee) ValidateBasic

func (msg MsgSetReferee) ValidateBasic() sdk.Error

type Params

type Params struct {
	MinGasPriceLimit         sdk.Dec `json:"min_gas_price_limit"`
	RefereeChangeMinInterval int64   `json:"referee_change_min_interval"` // DEX2
	RebateRatio              int64   `json:"rebate_ratio"`                // DEX2
}

Params defines the parameters for the authx module.

func DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func NewParams

func NewParams(minGasPriceLimit sdk.Dec, refreeChangeMinInterval int64, rebateRatio int64) Params

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.

func (*Params) ValidateGenesis

func (p *Params) ValidateGenesis() error

Jump to

Keyboard shortcuts

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