Documentation ¶
Index ¶
- Constants
- Variables
- func ExtractAccFromDowngradeQueueKey(key []byte) string
- func FormatTimeBytes(t time.Time) []byte
- func GetDowngradeQueueIteratorEndKey(timestamp time.Time) []byte
- func GetDowngradeQueueIteratorStartKey() []byte
- func GetDowngradeQueueKey(acc string, timestamp time.Time) []byte
- func GetInfoAddrKey(acc string) []byte
- func GetReferralsChildIteratorKey(acc string) []byte
- func GetReferralsRelationKey(acc string, ref string) []byte
- func ParseInfoAddrKey(key []byte) string
- func ParseReferralFromReleationKey(key []byte) (string, string, error)
- func RegisterInterfaces(registry types.InterfaceRegistry)
- func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- func ValidateGenesis(data GenesisState) error
- type AccountKeeper
- type BankKeeper
- type ParamSubspace
- type QueryResChildren
- type QueryResValidateTransition
- type ReferralFee
- type ReferralValidatorFee
- type StakingKeeper
Constants ¶
const ( // ModuleName is the name of the module ModuleName = "referral" ReferralAccountName = ModuleName EventTypeRefFee = "ref_fee" AttributeKeyFrom = "from" AttributeKeyTo = "to" )
const ( QueryStatus = "status" QueryReferrer = "referrer" QueryDelegatedInNetwork = "delegated" QueryCheckStatus = "check-status" QueryParams = "params" QueryInfo = "info" )
Query endpoints supported by the referral querier
const MaximumStatus = STATUS_MEGA
const MinimumStatus = STATUS_NEW
Variables ¶
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") )
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
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 )
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 FormatTimeBytes ¶
func GetDowngradeQueueIteratorStartKey ¶
func GetDowngradeQueueIteratorStartKey() []byte
func GetInfoAddrKey ¶
GetInfoAddrKey creates the key for a referral info record.
func GetReferralsRelationKey ¶
GetReferralsRelationKey create the key for a referral <=> referrer relation
func ParseInfoAddrKey ¶
ParseInfoAddrKey creates the address from InfoAddrKey
func ParseReferralFromReleationKey ¶
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 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