types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeDevelopmentFundDistribution   = "DevelopmentFundDistribution"
	EventTypeSecurityTokenFundDistribution = "SecurityTokenFundDistribution"
	EventTypeWithdrawNameReward            = "withdraw_name_reward"
	EventTypeWithdrawValidatorReward       = "withdraw_validator_rewards"
	EventTypeDepositSavings                = "deposit_savings"
	EventTypeWithdrawSavings               = "withdraw_savings"
	EventTypeWithdrawSavingsInterest       = "withdraw_savings_interest"

	AttributeKeyAmount      = "amount"
	AttributeKeyRecipient   = "recipient"
	AttributeKeySender      = "sender"
	AttributeKeyTitle       = "title"
	AttributeKeyDescription = "description"
	AttributeKeyReward      = "reward"

	AttributeValueModule = ModuleName
)
View Source
const (
	ModuleName = "distribution"

	AmcModuleName              = "amc"
	NvrpModuleName             = "nvrp"
	NvrpDistributionModuleName = "nvrpd"

	HRAHolderRewardModuleName   = "hhrm"
	DevelopmentFundModuleName   = "dfm"
	SecurityTokenFundModuleName = "stfm"

	SavingsModuleName             = "savings"
	SavingsDistributionModuleName = "savingsdistr"

	DefaultParamspace = ModuleName
	StoreKey          = ModuleName
	QuerierRoute      = StoreKey
	RouterKey         = ModuleName
)
View Source
const (
	DefaultNameDepositDelay              = time.Second * 1      // time.Second * 30
	DefaultRewardWithdrawalBlockedPeriod = time.Hour * 24 * 365 // time.Second * 30
)
View Source
const (
	ProposalTypeDevelopmentFundDistribution   = "DevelopmentFundDistribution"
	ProposalTypeSecurityTokenFundDistribution = "SecurityTokenFundDistribution"
)

Variables

View Source
var (
	ErrRewardWithdrawalDisabled = sdkerrors.Register(ModuleName, 101, "Reward Withdrawal Disabled.")
	ErrNoValidatorRewards       = sdkerrors.Register(ModuleName, 102, "no validator commission to withdraw")

	ErrAlreadyHasSavings = sdkerrors.Register(ModuleName, 103, "savings already active")
	ErrHasNoSavings      = sdkerrors.Register(ModuleName, 104, "user has no savings")
)
View Source
var (
	NameStakeKey                     = []byte{0x10}
	NameRewardRateKey                = []byte{0x11}
	NameRewardRateByAddressKeyPrefix = []byte{0x12}
	PendingNameDistributionKey       = []byte{0x13}
	NameDepositQueueKeyPrefix        = []byte{0x14}
	NameRewardEscrowKeyPrefix        = []byte{0x15}
	NameRewardLeftoverKeyPrefix      = []byte{0x16}

	SavingsStakeKey                     = []byte{0x20}
	SavingsStakeByAddressKeyPrefix      = []byte{0x21}
	SavingsRewardRateKey                = []byte{0x22}
	SavingsRewardRateByAddressKeyPrefix = []byte{0x23}
	SavingsRewardEscrowKeyPrefix        = []byte{0x24}
	SavingsRewardLeftoverKeyPrefix      = []byte{0x25}

	ValidatorAccumulatedRewardsKeyPrefix = []byte{0x30} // key for accumulated validator rewards
	NvrpdRemainderKey                    = []byte{0x31}
)
View Source
var (
	DefaultRewardWithdrawalEnabledTime = time.Time{}
	DefaultSavingsSplitAdjustment      = sdk.NewDecWithPrec(9, 1)

	DefaultDevelopmentFundShare   = sdk.NewDecWithPrec(25, 2)
	DefaultSecurityTokenFundShare = sdk.NewDecWithPrec(25, 2)

	KeyNameDepositDelay              = []byte("NameDepositDelay")
	KeyRewardWithdrawalBlockedPeriod = []byte("RewardWithdrawalBlockedPeriod")
	KeyRewardWithdrawalEnabledTime   = []byte("RewardWithdrawalEnabledTime")

	KeySavingsSplitAdjustment = []byte("SavingsSplitAdjustment")

	KeyDevelopmentFundShare   = []byte("DevelopmentFundShare")
	KeySecurityTokenFundShare = []byte("SecurityTokenFundShare")
)
View Source
var ModuleCdc *codec.Codec

Functions

func GetNameRewardAddress

func GetNameRewardAddress(key []byte) (address sdk.AccAddress)

func GetNameRewardByAddressKey

func GetNameRewardByAddressKey(address sdk.AccAddress) []byte

func GetNameRewardEscrowAddress

func GetNameRewardEscrowAddress(key []byte) (address sdk.AccAddress)

func GetNameRewardEscrowKey

func GetNameRewardEscrowKey(address sdk.AccAddress) []byte

func GetNameRewardLeftoverAddress

func GetNameRewardLeftoverAddress(key []byte) (address sdk.AccAddress)

func GetNameRewardLeftoverKey

func GetNameRewardLeftoverKey(address sdk.AccAddress) []byte

func GetNameRewardRateKey

func GetNameRewardRateKey() []byte

func GetNameStakeKey

func GetNameStakeKey() []byte

func GetNvrpdRemainderKey

func GetNvrpdRemainderKey() []byte

func GetPendingNameDistributionKey

func GetPendingNameDistributionKey() []byte

func GetSavingsRewardAddress

func GetSavingsRewardAddress(key []byte) (address sdk.AccAddress)

func GetSavingsRewardByAddressKey

func GetSavingsRewardByAddressKey(address sdk.AccAddress) []byte

func GetSavingsRewardEscrowAddress

func GetSavingsRewardEscrowAddress(key []byte) (address sdk.AccAddress)

func GetSavingsRewardEscrowKey

func GetSavingsRewardEscrowKey(address sdk.AccAddress) []byte

func GetSavingsRewardLeftoverAddress

func GetSavingsRewardLeftoverAddress(key []byte) (address sdk.AccAddress)

func GetSavingsRewardLeftoverKey

func GetSavingsRewardLeftoverKey(address sdk.AccAddress) []byte

func GetSavingsRewardRateKey

func GetSavingsRewardRateKey() []byte

func GetSavingsStakeAddress

func GetSavingsStakeAddress(key []byte) (address sdk.AccAddress)

func GetSavingsStakeByAddressKey

func GetSavingsStakeByAddressKey(address sdk.AccAddress) []byte

func GetSavingsStakeKey

func GetSavingsStakeKey() []byte

func GetValidatorAccumulatedRewardsAddress

func GetValidatorAccumulatedRewardsAddress(key []byte) (valAddr sdk.ValAddress)

gets the address from a validator's accumulated rewards key

func GetValidatorAccumulatedRewardsKey

func GetValidatorAccumulatedRewardsKey(v sdk.ValAddress) []byte

gets the key for a validator's current rewards

func NameDepositByTimeKey

func NameDepositByTimeKey(endTime time.Time) []byte

func NameDepositQueueKey

func NameDepositQueueKey(address sdk.AccAddress, endTime time.Time) []byte

func NewDevelopmentFundDistributionProposal

func NewDevelopmentFundDistributionProposal(title, description string, amount sdk.Coins, recipient sdk.AccAddress) gov.Content

func NewSecurityTokenFundDistributionProposal

func NewSecurityTokenFundDistributionProposal(title, description string, recipients []Recipients) gov.Content

func ParamKeyTable

func ParamKeyTable() params.KeyTable

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

func SplitNameDepositQueueKey

func SplitNameDepositQueueKey(key []byte) (address sdk.AccAddress, endTime time.Time)

func ValidateGenesis

func ValidateGenesis(data GenesisState) error

Types

type AddressNameRewardRateRecord

type AddressNameRewardRateRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Rate    sdk.Dec        `json:"rate" yaml:"rate"`
}

type AddressSavingsRewardRateRecord

type AddressSavingsRewardRateRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Rate    sdk.Dec        `json:"rate" yaml:"rate"`
}

type AddressSavingsStakeRecord

type AddressSavingsStakeRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Stake   sdk.Int        `json:"stake" yaml:"stake"`
}

type DevelopmentFundDistributionProposal

type DevelopmentFundDistributionProposal struct {
	Title       string         `json:"title" yaml:"title"`
	Description string         `json:"description" yaml:"description"`
	Amount      sdk.Coins      `json:"amount" yaml:"amount"`
	Recipient   sdk.AccAddress `json:"recipient" yaml:"recipient"`
}

func (DevelopmentFundDistributionProposal) GetDescription

func (p DevelopmentFundDistributionProposal) GetDescription() string

func (DevelopmentFundDistributionProposal) GetTitle

func (DevelopmentFundDistributionProposal) ProposalRoute

func (p DevelopmentFundDistributionProposal) ProposalRoute() string

func (DevelopmentFundDistributionProposal) ProposalType

func (DevelopmentFundDistributionProposal) String

func (DevelopmentFundDistributionProposal) ValidateBasic

func (p DevelopmentFundDistributionProposal) ValidateBasic() error

type GenesisState

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

	NameStake               sdk.Dec                       `json:"name_stake" yaml:"name_stake"`
	NameRewardRate          sdk.Dec                       `json:"name_reward_rate" yaml:"name_reward_rate"`
	AddressNameRewardRates  []AddressNameRewardRateRecord `json:"address_name_reward_rates" yaml:"address_name_reward_rates"`
	PendingNameDistribution sdk.Coins                     `json:"pending_name_distribution" yaml:"pending_name_distribution"`
	NameDepositQueue        []NameDepositQueueRecord      `json:"name_deposit_queue" yaml:"name_deposit_queue"`
	NameRewardEscrow        []NameRewardEscrowRecord      `json:"name_reward_escrow" yaml:"name_reward_escrow"`
	NameRewardLeftover      []NameRewardLeftoverRecord    `json:"name_reward_leftover" yaml:"name_reward_leftover"`

	SavingsStake              sdk.Int                          `json:"savings_stake" yaml:"savings_stake"`
	SavingsRewardRate         sdk.Dec                          `json:"savings_reward_rate" yaml:"savings_reward_rate"`
	AddressSavingsRewardRates []AddressSavingsRewardRateRecord `json:"address_savings_reward_rates" yaml:"address_savings_reward_rates"`
	AddressSavingsStake       []AddressSavingsStakeRecord      `json:"address_savings_stake" yaml:"address_savings_stake"`
	SavingsRewardEscrow       []SavingsRewardEscrowRecord      `json:"savings_reward_escrow" yaml:"savings_reward_escrow"`
	SavingsRewardLeftover     []SavingsRewardLeftoverRecord    `json:"savings_reward_leftover" yaml:"savings_reward_leftover"`

	ValidatorAccumulatedRewards []ValidatorAccumulatedRewardRecord `json:"validator_accumulated_rewards" yaml:"validator_accumulated_rewards"`
	NvrpRemainder               sdk.DecCoins                       `json:"nvrp_remainder" yaml:"nvrp_remainder"`
}

func DefaultGenesisState

func DefaultGenesisState() GenesisState

func NewGenesisState

func NewGenesisState(params Params, nameStake sdk.Dec, nameRewardRate sdk.Dec, addressNameRewardRates []AddressNameRewardRateRecord,
	pendingNameDistribution sdk.Coins, nameDepositQueue []NameDepositQueueRecord, nameRewardEscrow []NameRewardEscrowRecord, nameRewardLeftover []NameRewardLeftoverRecord,
	savingsStake sdk.Int, savingsRewardRate sdk.Dec, addressSavingsRewardRates []AddressSavingsRewardRateRecord, addressSavingsStake []AddressSavingsStakeRecord,
	savingsRewardEscrow []SavingsRewardEscrowRecord, savingsRewardLeftover []SavingsRewardLeftoverRecord,
	validatorAccumulatedRewards []ValidatorAccumulatedRewardRecord, nvrpRemainder sdk.DecCoins) GenesisState

type MsgDepositSavings

type MsgDepositSavings struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
	Amount sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgDepositSavings

func NewMsgDepositSavings

func NewMsgDepositSavings(sender sdk.AccAddress, amount sdk.Coins) MsgDepositSavings

func (MsgDepositSavings) GetSignBytes

func (msg MsgDepositSavings) GetSignBytes() []byte

func (MsgDepositSavings) GetSigners

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

func (MsgDepositSavings) Route

func (msg MsgDepositSavings) Route() string

func (MsgDepositSavings) Type

func (msg MsgDepositSavings) Type() string

func (MsgDepositSavings) ValidateBasic

func (msg MsgDepositSavings) ValidateBasic() error

type MsgWithdrawNameReward

type MsgWithdrawNameReward struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
}

MsgWithdrawNameReward

func NewMsgWithdrawNameReward

func NewMsgWithdrawNameReward(sender sdk.AccAddress) MsgWithdrawNameReward

func (MsgWithdrawNameReward) GetSignBytes

func (msg MsgWithdrawNameReward) GetSignBytes() []byte

func (MsgWithdrawNameReward) GetSigners

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

func (MsgWithdrawNameReward) Route

func (msg MsgWithdrawNameReward) Route() string

func (MsgWithdrawNameReward) Type

func (msg MsgWithdrawNameReward) Type() string

func (MsgWithdrawNameReward) ValidateBasic

func (msg MsgWithdrawNameReward) ValidateBasic() error

type MsgWithdrawSavings

type MsgWithdrawSavings struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
}

MsgWithdrawSavings

func NewMsgWithdrawSavings

func NewMsgWithdrawSavings(sender sdk.AccAddress) MsgWithdrawSavings

func (MsgWithdrawSavings) GetSignBytes

func (msg MsgWithdrawSavings) GetSignBytes() []byte

func (MsgWithdrawSavings) GetSigners

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

func (MsgWithdrawSavings) Route

func (msg MsgWithdrawSavings) Route() string

func (MsgWithdrawSavings) Type

func (msg MsgWithdrawSavings) Type() string

func (MsgWithdrawSavings) ValidateBasic

func (msg MsgWithdrawSavings) ValidateBasic() error

type MsgWithdrawSavingsInterest

type MsgWithdrawSavingsInterest struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
}

MsgWithdrawSavingsInterest

func NewMsgWithdrawSavingsInterest

func NewMsgWithdrawSavingsInterest(sender sdk.AccAddress) MsgWithdrawSavingsInterest

func (MsgWithdrawSavingsInterest) GetSignBytes

func (msg MsgWithdrawSavingsInterest) GetSignBytes() []byte

func (MsgWithdrawSavingsInterest) GetSigners

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

func (MsgWithdrawSavingsInterest) Route

func (msg MsgWithdrawSavingsInterest) Route() string

func (MsgWithdrawSavingsInterest) Type

func (MsgWithdrawSavingsInterest) ValidateBasic

func (msg MsgWithdrawSavingsInterest) ValidateBasic() error

type MsgWithdrawValidatorReward

type MsgWithdrawValidatorReward struct {
	Validator sdk.ValAddress `json:"validator" yaml:"validator"`
}

MsgWithdrawValidatorReward

func NewMsgWithdrawValidatorReward

func NewMsgWithdrawValidatorReward(validator sdk.ValAddress) MsgWithdrawValidatorReward

func (MsgWithdrawValidatorReward) GetSignBytes

func (msg MsgWithdrawValidatorReward) GetSignBytes() []byte

func (MsgWithdrawValidatorReward) GetSigners

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

func (MsgWithdrawValidatorReward) Route

func (msg MsgWithdrawValidatorReward) Route() string

func (MsgWithdrawValidatorReward) Type

func (MsgWithdrawValidatorReward) ValidateBasic

func (msg MsgWithdrawValidatorReward) ValidateBasic() error

quick validity check

type NameDepositQueueRecord

type NameDepositQueueRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Time    time.Time      `json:"time" yaml:"time"`
}

type NameHooks

type NameHooks interface {
	AfterFirstNameCreated(ctx sdk.Context, address sdk.AccAddress) error
	AfterLastNameRemoved(ctx sdk.Context, address sdk.AccAddress) error
}

type NameRewardEscrowRecord

type NameRewardEscrowRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Amount  sdk.DecCoins   `json:"amount" yaml:"amount"`
}

type NameRewardLeftoverRecord

type NameRewardLeftoverRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Amount  sdk.Dec        `json:"amount" yaml:"amount"`
}

type Params

type Params struct {
	NameDepositDelay              time.Duration `json:"name_deposit_delay" yaml:"name_deposit_delay"`
	RewardWithdrawalBlockedPeriod time.Duration `json:"reward_withdrawal_blocked_period" yaml:"reward_withdrawal_blocked_period"`
	RewardWithdrawalEnabledTime   time.Time     `json:"reward_withdrawal_enabled_time" yaml:"reward_withdrawal_enabled_time"`
	SavingsSplitAdjustment        sdk.Dec       `json:"savings_split_adjustment" yaml:"savings_split_adjustment"`

	DevelopmentFundShare   sdk.Dec `json:"development_fund_share" yaml:"development_fund_share"`
	SecurityTokenFundShare sdk.Dec `json:"security_token_fund_share" yaml:"security_token_fund_share"`
}

func DefaultParams

func DefaultParams() Params

func NewParams

func NewParams(nameDepositDelay time.Duration) Params

func (*Params) ParamSetPairs

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

func (Params) String

func (p Params) String() string

func (Params) Validate

func (p Params) Validate() error

type Recipients

type Recipients struct {
	Amount    sdk.Coins      `json:"amount" yaml:"amount"`
	Recipient sdk.AccAddress `json:"recipient" yaml:"recipient"`
}

type SavingsRewardEscrowRecord

type SavingsRewardEscrowRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Amount  sdk.DecCoins   `json:"amount" yaml:"amount"`
}

type SavingsRewardLeftoverRecord

type SavingsRewardLeftoverRecord struct {
	Address sdk.AccAddress `json:"address" yaml:"address"`
	Amount  sdk.Dec        `json:"amount" yaml:"amount"`
}

type SecurityTokenFundDistributionProposal

type SecurityTokenFundDistributionProposal struct {
	Title       string       `json:"title" yaml:"title"`
	Description string       `json:"description" yaml:"description"`
	Recipients  []Recipients `json:"recipients" yaml:"recipients"`
}

func (SecurityTokenFundDistributionProposal) GetDescription

func (p SecurityTokenFundDistributionProposal) GetDescription() string

func (SecurityTokenFundDistributionProposal) GetTitle

func (SecurityTokenFundDistributionProposal) ProposalRoute

func (SecurityTokenFundDistributionProposal) ProposalType

func (SecurityTokenFundDistributionProposal) String

func (SecurityTokenFundDistributionProposal) ValidateBasic

func (p SecurityTokenFundDistributionProposal) ValidateBasic() error

type ValidatorAccumulatedRewardRecord

type ValidatorAccumulatedRewardRecord struct {
	ValidatorAddress sdk.ValAddress `json:"validator_address" yaml:"validator_address"`
	Accumulated      sdk.DecCoins   `json:"accumulated" yaml:"accumulated"`
}

Jump to

Keyboard shortcuts

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