treasury

package
v0.2.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

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

	// StoreKey is the string store representation
	StoreKey = ModuleName

	// RouterKey is the msg router key for the treasury module
	RouterKey = ModuleName

	// QuerierRoute is the query router key for the treasury module
	QuerierRoute = ModuleName

	// DefaultParamspace is the paramspace representation
	DefaultParamspace = ModuleName
)
View Source
const (
	QueryTaxRate             = "tax-rate"
	QueryTaxCap              = "tax-cap"
	QueryMiningRewardWeight  = "reward-weight"
	QuerySeigniorageProceeds = "seigniorage-proceeds"
	QueryActiveClaims        = "active-claims"
	QueryCurrentEpoch        = "current-epoch"
	QueryParams              = "params"
	QueryIssuance            = "issuance"
	QueryTaxProceeds         = "tax-proceeds"
)

query endpoints supported by the treasury Querier

Variables

View Source
var (
	PrefixClaim = []byte("claim")
)

nolint

Functions

func EndBlocker added in v0.0.5

func EndBlocker(ctx sdk.Context, k Keeper) (resTags sdk.Tags)

EndBlocker called to adjust macro weights (tax, mining reward) and settle outstanding claims.

func InitGenesis added in v0.0.5

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

InitGenesis new treasury genesis

func MRL added in v0.0.7

func MRL(ctx sdk.Context, k Keeper, epoch sdk.Int) sdk.Dec

MRL returns mining rewards / luna / epoch

func MiningRewardForEpoch added in v0.0.7

func MiningRewardForEpoch(ctx sdk.Context, k Keeper, epoch sdk.Int) sdk.Dec

MiningRewardForEpoch returns the sum of tax and seigniorage rewards for the epoch

func NewQuerier added in v0.0.5

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func RegisterCodec added in v0.0.5

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on codec codec

func RollingAverageIndicator added in v0.0.7

func RollingAverageIndicator(ctx sdk.Context, k Keeper, epochs sdk.Int,
	indicatorFunction func(sdk.Context, Keeper, sdk.Int) sdk.Dec) sdk.Dec

RollingAverageIndicator returns the rolling average of the indicator over several epochs. If current epoch < epochs, we return the best we can and return RollingAverageIndicator(currentEpoch)

func SRL added in v0.0.7

func SRL(ctx sdk.Context, k Keeper, epoch sdk.Int) sdk.Dec

SRL returns Seigniorage rewards / luna / epoch

func SeigniorageRewardsForEpoch added in v0.0.7

func SeigniorageRewardsForEpoch(ctx sdk.Context, k Keeper, epoch sdk.Int) sdk.Dec

SeigniorageRewardsForEpoch returns seigniorage rewards for the epoch

func SumIndicator added in v0.0.7

func SumIndicator(ctx sdk.Context, k Keeper, epochs sdk.Int,
	indicatorFunction func(sdk.Context, Keeper, sdk.Int) sdk.Dec) sdk.Dec

SumIndicator returns the sum of the indicator over several epochs. If current epoch < epochs, we return the best we can and return SumIndicator(currentEpoch)

func TRL added in v0.0.7

func TRL(ctx sdk.Context, k Keeper, epoch sdk.Int) sdk.Dec

TRL returns tax rewards / luna / epoch

func TaxRewardsForEpoch added in v0.0.7

func TaxRewardsForEpoch(ctx sdk.Context, k Keeper, epoch sdk.Int) sdk.Dec

TaxRewardsForEpoch returns tax rewards that have been collected in the epoch

func UnitLunaIndicator added in v0.0.7

func UnitLunaIndicator(ctx sdk.Context, k Keeper, epoch sdk.Int,
	indicatorFunction func(sdk.Context, Keeper, sdk.Int) sdk.Dec) sdk.Dec

UnitLunaIndicator evaluates the indicator function and divides it by the luna supply for the epoch

func ValidateGenesis added in v0.0.5

func ValidateGenesis(data GenesisState) error

ValidateGenesis validates the provided treasury genesis state to ensure the expected invariants holds. (i.e. params in correct bounds, no duplicate validators)

Types

type DistributionKeeper added in v0.2.0

type DistributionKeeper interface {
	AllocateTokensToValidator(ctx sdk.Context, val sdk.Validator, tokens sdk.DecCoins)
}

expected coin keeper

type FeeCollectionKeeper added in v0.2.0

type FeeCollectionKeeper interface {
	AddCollectedFees(ctx sdk.Context, coins sdk.Coins) sdk.Coins
}

expected fee keeper

type GenesisState added in v0.0.5

type GenesisState struct {
	Params              Params  `json:"params"` // treasury params
	GenesisTaxRate      sdk.Dec `json:"tax_rate"`
	GenesisRewardWeight sdk.Dec `json:"reward_weight"`
}

GenesisState - all treasury state that must be provided at genesis

func DefaultGenesisState added in v0.0.5

func DefaultGenesisState() GenesisState

DefaultGenesisState returns raw genesis message for testing

func ExportGenesis added in v0.0.5

func ExportGenesis(ctx sdk.Context, k Keeper) GenesisState

ExportGenesis returns a GenesisState for a given context and keeper. The GenesisState will contain the pool, and validator/delegator distribution info's

func NewGenesisState added in v0.0.5

func NewGenesisState(params Params, taxRate, rewardWeight sdk.Dec) GenesisState

NewGenesisState constructs a new genesis state

type Keeper

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

Keeper of the treasury store

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, valset sdk.ValidatorSet,
	mtk MintKeeper, mk MarketKeeper, paramspace params.Subspace) Keeper

NewKeeper constructs a new keeper

func (Keeper) GetParams added in v0.0.5

func (k Keeper) GetParams(ctx sdk.Context) Params

GetParams get treasury params from the global param store

func (Keeper) GetRewardWeight added in v0.0.5

func (k Keeper) GetRewardWeight(ctx sdk.Context, epoch sdk.Int) (rewardWeight sdk.Dec)

GetRewardWeight returns the mining reward weight

func (Keeper) GetTaxCap added in v0.0.5

func (k Keeper) GetTaxCap(ctx sdk.Context, denom string) (taxCap sdk.Int)

GetTaxCap gets the Tax Cap. Denominated in integer units of the reference {denom}

func (Keeper) GetTaxRate added in v0.0.5

func (k Keeper) GetTaxRate(ctx sdk.Context, epoch sdk.Int) (rate sdk.Dec)

GetTaxRate gets the tax rate

func (Keeper) PeekTaxProceeds added in v0.0.5

func (k Keeper) PeekTaxProceeds(ctx sdk.Context, epoch sdk.Int) (res sdk.Coins)

PeekTaxProceeds peeks the total amount of taxes that have been collected in the given epoch.

func (Keeper) RecordTaxProceeds added in v0.0.7

func (k Keeper) RecordTaxProceeds(ctx sdk.Context, delta sdk.Coins)

RecordTaxProceeds add tax proceeds that have been added this epoch

func (Keeper) SetParams added in v0.0.5

func (k Keeper) SetParams(ctx sdk.Context, params Params)

SetParams set treasury params from the global param store

func (Keeper) SetRewardWeight added in v0.0.5

func (k Keeper) SetRewardWeight(ctx sdk.Context, weight sdk.Dec)

SetRewardWeight sets the ratio of the treasury that goes to mining rewards, i.e. supply of Luna that is burned. You can only set the reward weight of the current epoch.

func (Keeper) SetTaxRate added in v0.0.5

func (k Keeper) SetTaxRate(ctx sdk.Context, rate sdk.Dec)

SetTaxRate sets the tax rate; called from the treasury.

type MarketKeeper added in v0.2.0

type MarketKeeper interface {
	GetSwapDecCoin(ctx sdk.Context, offerCoin sdk.DecCoin, askDenom string) (sdk.DecCoin, sdk.Error)
	GetSwapCoin(ctx sdk.Context, offerCoin sdk.Coin, askDenom string, isInternal bool) (sdk.Coin, sdk.Dec, sdk.Error)
}

expected market keeper

type MintKeeper added in v0.2.0

type MintKeeper interface {
	PeekEpochSeigniorage(ctx sdk.Context, epoch sdk.Int) (seignioragePool sdk.Int)
	Mint(ctx sdk.Context, recipient sdk.AccAddress, coin sdk.Coin) (err sdk.Error)
	GetIssuance(ctx sdk.Context, denom string, day sdk.Int) (issuance sdk.Int)
}

expected mint keeper

type Params added in v0.0.5

type Params struct {
	TaxPolicy    PolicyConstraints `json:"tax_policy"`
	RewardPolicy PolicyConstraints `json:"reward_policy"`

	SeigniorageBurdenTarget sdk.Dec `json:"seigniorage_burden_target"`
	MiningIncrement         sdk.Dec `json:"mining_increment"`

	WindowShort     sdk.Int `json:"window_short"`
	WindowLong      sdk.Int `json:"window_long"`
	WindowProbation sdk.Int `json:"window_probation"`
}

Params treasury parameters

func DefaultParams added in v0.0.5

func DefaultParams() Params

DefaultParams creates default treasury module parameters

func NewParams added in v0.0.5

func NewParams(
	taxPolicy, rewardPolicy PolicyConstraints,
	seigniorageBurden sdk.Dec,
	miningIncrement sdk.Dec,
	windowShort, windowLong, windowProbation sdk.Int,
) Params

NewParams creates a new param instance

func (Params) String added in v0.0.5

func (params Params) String() string

implements fmt.Stringer

type PolicyConstraints added in v0.0.7

type PolicyConstraints struct {
	RateMin       sdk.Dec  `json:"rate_min"`
	RateMax       sdk.Dec  `json:"rate_max"`
	Cap           sdk.Coin `json:"cap"`
	ChangeRateMax sdk.Dec  `json:"change_max"`
}

PolicyConstraints wraps constraints around updating a key Treasury variable

func (PolicyConstraints) Clamp added in v0.0.7

func (pc PolicyConstraints) Clamp(prevRate sdk.Dec, newRate sdk.Dec) (clampedRate sdk.Dec)

Clamp constrains a policy variable update within the policy constraints

func (PolicyConstraints) String added in v0.0.7

func (pc PolicyConstraints) String() string

String implements fmt.Stringer

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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