types

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName          = "referral"
	ReferralAccountName = ModuleName

	EventTypeRefFee  = "ref_fee"
	AttributeKeyFrom = "from"
	AttributeKeyTo   = "to"
)
View Source
const (
	QueryStatus             = "status"
	QueryReferrer           = "referrer"
	QueryDelegatedInNetwork = "delegated"
	QueryCheckStatus        = "check-status"
	QueryParams             = "params"
	QueryInfo               = "info"
)

Query endpoints supported by the referral querier

View Source
const MaximumStatus = STATUS_MEGA
View Source
const MinimumStatus = STATUS_NEW

Variables

View Source
var (
	ErrParentNil          = sdkerrors.Register(ModuleName, 1, "parentAcc cannot be nil")
	ErrRegistrationClosed = sdkerrors.Register(ModuleName, 2, "referrer is inactive for too long")
	ErrNotFound           = sdkerrors.Register(ModuleName, 3, "account is out of the referral structure")
)
View Source
var (
	InfoPrefix           = []byte{0x00}
	ReferralsPrefix      = []byte{0x01}
	ParamsKey            = collections.NewPrefix(2)
	DowngradeQueuePrefix = []byte{0x05}
)

Keys for referral store Items are stored with the following key: values

- 0x00<accAddrLen (1 Byte)><accAddr_Bytes>: Info

- 0x01<accAddrLen (1 Byte)><accAddr_Bytes><refAddrLen (1 Byte)><refAddr_Bytes>: Referral connection

- 0x02<accAddrLen (1 Byte)><accAddr_Bytes><refAddrLen (1 Byte)><refAddr_Bytes>: Referral connection

- 0x03: Params

View Source
var (
	DefaultDelegatingAward = NetworkAward{
		Network: []util.Fraction{
			util.Percent(5),
			util.Percent(1),
			util.Percent(2),
			util.Percent(1),
			util.Percent(1),
			util.Percent(1),
			util.Percent(1),
			util.Percent(1),
			util.Permille(7),
			util.Permille(5),
			util.Permille(3),
			util.Permille(2),
			util.Permille(2),
			util.Permille(1),
		},
	}

	// DefaultStatusDowngradePeriod 7 days
	DefaultStatusDowngradePeriod int32 = 7 * 24 * 60 * 60
)
View Source
var (

	// ModuleCdc references the global x/referral module codec. Note, the codec should
	// ONLY be used in certain instances of tests and for JSON encoding as Amino is
	// still used for that purpose.
	ModuleCdc = codec.NewAminoCodec(amino)
)

Functions

func ExtractAccFromDowngradeQueueKey

func ExtractAccFromDowngradeQueueKey(key []byte) string

func FormatTimeBytes

func FormatTimeBytes(t time.Time) []byte

func GetDowngradeQueueIteratorEndKey

func GetDowngradeQueueIteratorEndKey(timestamp time.Time) []byte

func GetDowngradeQueueIteratorStartKey

func GetDowngradeQueueIteratorStartKey() []byte

func GetDowngradeQueueKey

func GetDowngradeQueueKey(acc string, timestamp time.Time) []byte

func GetInfoAddrKey

func GetInfoAddrKey(acc string) []byte

GetInfoAddrKey creates the key for a referral info record.

func GetReferralsChildIteratorKey

func GetReferralsChildIteratorKey(acc string) []byte

func GetReferralsRelationKey

func GetReferralsRelationKey(acc string, ref string) []byte

GetReferralsRelationKey create the key for a referral <=> referrer relation

func ParseInfoAddrKey

func ParseInfoAddrKey(key []byte) string

ParseInfoAddrKey creates the address from InfoAddrKey

func ParseReferralFromReleationKey

func ParseReferralFromReleationKey(key []byte) (string, string, error)

ParseInfoAddrKey creates the address from InfoAddrKey

func RegisterInterfaces

func RegisterInterfaces(registry types.InterfaceRegistry)

func RegisterLegacyAminoCodec

func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers concrete types on codec

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the referral genesis parameters

Types

type AccountKeeper

type AccountKeeper interface {
	AddressCodec() address.Codec
	GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI
}

AccountKeeper defines the expected account keeper used for simulations (noalias)

type BankKeeper

type BankKeeper interface {
	SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	InputOutputCoins(ctx context.Context, input types.Input, outputs []types.Output) error
	BurnCoins(ctx context.Context, name string, amt sdk.Coins) error
}

BankKeeper defines the expected interface needed to retrieve account balances.

type ParamSubspace

type ParamSubspace interface {
	WithKeyTable(table params.KeyTable) params.Subspace
	Get(ctx sdk.Context, key []byte, ptr interface{})
	GetParamSet(ctx sdk.Context, ps params.ParamSet)
	SetParamSet(ctx sdk.Context, ps params.ParamSet)
}

ParamSubspace defines the expected Subspace interface

type QueryResChildren

type QueryResChildren []sdk.AccAddress

func (QueryResChildren) String

func (qr QueryResChildren) String() string

type QueryResValidateTransition

type QueryResValidateTransition struct {
	Ok  bool   `json:"ok" yaml:"ok"`
	Err string `json:"err,omitempty" yaml:"err,omitempty"`
}

type ReferralFee

type ReferralFee struct {
	Beneficiary string        `json:"beneficiary" yaml:"beneficiary"`
	Ratio       util.Fraction `json:"ratio" yaml:"ratio"`
}

func (ReferralFee) GetBeneficiary

func (fee ReferralFee) GetBeneficiary() sdk.AccAddress

type ReferralValidatorFee

type ReferralValidatorFee struct {
	Beneficiary string        `json:"beneficiary" yaml:"beneficiary"`
	Ratio       util.Fraction `json:"ratio" yaml:"ratio"`
}

func (ReferralValidatorFee) GetBeneficiary

func (fee ReferralValidatorFee) GetBeneficiary() sdk.AccAddress

type StakingKeeper

type StakingKeeper interface {
	BondDenom(ctx context.Context) (string, error)
}

StakingKeeper expected staking keeper (noalias)

Jump to

Keyboard shortcuts

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