treasury

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryTaxRate            = "tax-rate"
	QueryTaxCap             = "tax-cap"
	QueryMiningRewardWeight = "mining-reward-weight"
	QueryBalance            = "balance"
	QueryActiveClaims       = "active-claims"
	QueryRewards            = "rewards"
	QueryParams             = "params"
	QueryIssuance           = "issuance"
)

query endpoints supported by the governance Querier

View Source
const (
	//nolint default paramspace for treasury keeper
	DefaultParamspace = "treasury"
)
View Source
const StoreKey = "treasury"

StoreKey is string representation of the store key for treasury

Variables

View Source
var (
	KeyRewardWeight     = []byte("reward_weight")
	PrefixClaim         = []byte("claim")
	ParamStoreKeyParams = []byte("params")
)

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)

new oracle genesis

func KeyClaim added in v0.0.5

func KeyClaim(claimID string) []byte

KeyClaim is in format of prefixclaim:claimType:claimID

func NewQuerier added in v0.0.5

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func ParamKeyTable added in v0.0.5

func ParamKeyTable() params.KeyTable

ParamKeyTable for treasury module

func RegisterCodec added in v0.0.5

func RegisterCodec(cdc *codec.Codec)

Register concrete types on codec codec

func ValidateGenesis added in v0.0.5

func ValidateGenesis(data GenesisState) error

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

Types

type Claim

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

Claim is an interface that directs its rewards to an attached bank account.

func NewClaim added in v0.0.5

func NewClaim(class ClaimClass, weight sdk.Int, recipient sdk.AccAddress) Claim

NewClaim generates a Claim instance.

func (Claim) ID added in v0.0.5

func (c Claim) ID() string

ID returns the id of the claim

func (Claim) String added in v0.0.5

func (c Claim) String() string

type ClaimClass added in v0.0.5

type ClaimClass byte
const (
	// RouterKey is they name of the treasury module
	RouterKey = "treasury"

	OracleClaimClass ClaimClass = iota
	BudgetClaimClass ClaimClass = iota
)

type Claims added in v0.0.5

type Claims []Claim

Claims is a collection of Claim

func (Claims) String added in v0.0.5

func (c Claims) String() (out string)

type GenesisState added in v0.0.5

type GenesisState struct {
	Params Params `json:"params"` // treasury params
}

GenesisState - all treasury state that must be provided at genesis

func DefaultGenesisState added in v0.0.5

func DefaultGenesisState() GenesisState

get raw genesis raw 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) GenesisState

type Keeper

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

Keeper of the treasury store

func NewKeeper

func NewKeeper(key sdk.StoreKey, cdc *codec.Codec, ak auth.AccountKeeper,
	bk bank.Keeper, mk market.Keeper, dk distribution.Keeper, paramspace params.Subspace) Keeper

NewKeeper constructs a new keeper

func (Keeper) AddTaxProceeds added in v0.0.5

func (k Keeper) AddTaxProceeds(ctx sdk.Context, epoch sdk.Int, addition sdk.Coins)

AddTaxProceeds add tax proceeds that have been added this epoch

func (Keeper) GetIssuance added in v0.0.5

func (k Keeper) GetIssuance(ctx sdk.Context, denom string, epoch sdk.Int) (issuance sdk.Int)

GetIssuance fetches the total issuance count of the coin matching {denom}. If the {epoch} applies to a previous period, fetches the last stored snapshot issuance of the coin. For virgin calls, iterates through the accountkeeper and computes the genesis issuance.

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) (res 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) (res 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) (res 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) ProcessClaims added in v0.0.5

func (k Keeper) ProcessClaims(ctx sdk.Context, class ClaimClass, rewardees map[string]sdk.Int)

AddClaim adds a funding claim to the treasury. Settled around once a month.

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.

func (Keeper) SetTaxCap added in v0.0.5

func (k Keeper) SetTaxCap(ctx sdk.Context, denom string, cap sdk.Int)

SetTaxCap sets the Tax Cap. Denominated in integer units of the reference {denom}

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 Params added in v0.0.5

type Params struct {
	TaxRateMin sdk.Dec `json:"tax_rate_min"` // percentage cap on taxes. Defaults to 2%.
	TaxRateMax sdk.Dec `json:"tax_rate_max"` // percentage floor on taxes. Defaults to 0.

	TaxCap sdk.Coin `json:"tax_cap"` // Tax Cap in TerraSDR

	RewardMin sdk.Dec `json:"reward_min"` // percentage floor on miner rewards for seigniorage. Defaults to 0.1.
	RewardMax sdk.Dec `json:"reward_max"` // percentage cap on miner rewards for seigniorage. Defaults to 0.9

	EpochLong  sdk.Int `json:"epoch_long"`
	EpochShort sdk.Int `json:"epoch_short"`

	OracleClaimShare sdk.Dec `json:"oracle_share"`
	BudgetClaimShare sdk.Dec `json:"budget_share"`
}

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(taxRateMin, taxRateMax, rewardMin, rewardMax, oracleClaimShare, budgetClaimShare sdk.Dec,
	epochLong, epochShort sdk.Int, taxCap sdk.Coin) Params

NewParams creates a new param instance

func (Params) String added in v0.0.5

func (params Params) String() string

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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