keeper

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2020 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

nolint:deadcode unused noalias

Index

Constants

This section is empty.

Variables

View Source
var (
	PubKeys = []crypto.PubKey{
		secp256k1.GenPrivKey().PubKey(),
		secp256k1.GenPrivKey().PubKey(),
		secp256k1.GenPrivKey().PubKey(),
	}

	Addrs = []sdk.AccAddress{
		sdk.AccAddress(PubKeys[0].Address()),
		sdk.AccAddress(PubKeys[1].Address()),
		sdk.AccAddress(PubKeys[2].Address()),
	}

	ValAddrs = []sdk.ValAddress{
		sdk.ValAddress(PubKeys[0].Address()),
		sdk.ValAddress(PubKeys[1].Address()),
		sdk.ValAddress(PubKeys[2].Address()),
	}

	InitTokens = sdk.TokensFromConsensusPower(200)
	InitCoins  = sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens))
)

Functions

func MR

func MR(ctx sdk.Context, epoch int64, k Keeper) sdk.Dec

MR returns Mining Rewards = Seigniorage Rewards + Tax Rates for the epoch

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func NewTestMsgCreateValidator

func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey crypto.PubKey, amt sdk.Int) staking.MsgCreateValidator

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable returns ParamTable for treasury module

func SR

func SR(ctx sdk.Context, epoch int64, k Keeper) sdk.Dec

SR returns Seigniorage Rewards for the epoch

func TRL

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

TRL returns Tax Rewards per Luna for the epoch

Types

type Keeper

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

Keeper of the treasury store

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, paramSpace params.Subspace,
	supplyKeeper types.SupplyKeeper, marketKeeper types.MarketKeeper,
	stakingKeeper types.StakingKeeper, distrKeeper types.DistributionKeeper,
	oracleModuleName string, distributionModuleName string, codespace sdk.CodespaceType) Keeper

NewKeeper creates a new treasury Keeper instance

func (Keeper) ClearSRs

func (k Keeper) ClearSRs(ctx sdk.Context)

ClearSRs delete all seigniorage rewards from the store

func (Keeper) ClearTRs

func (k Keeper) ClearTRs(ctx sdk.Context)

ClearTRs delete all tax rewards from the store

func (Keeper) ClearTSLs

func (k Keeper) ClearTSLs(ctx sdk.Context)

ClearTSLs delete all the total saked luna from the store

func (Keeper) Codespace

func (k Keeper) Codespace() sdk.CodespaceType

Codespace returns the codespace

func (Keeper) GetEpochInitialIssuance

func (k Keeper) GetEpochInitialIssuance(ctx sdk.Context) (res sdk.Coins)

GetEpochInitialIssuance returns epoch initial issuance

func (Keeper) GetParams

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

GetParams returns the total set of treasury parameters.

func (Keeper) GetRewardWeight

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

GetRewardWeight loads the reward weight

func (Keeper) GetSR

func (k Keeper) GetSR(ctx sdk.Context, epoch int64) (res sdk.Dec)

GetSR returns the seigniorage rewards for the epoch

func (Keeper) GetTR

func (k Keeper) GetTR(ctx sdk.Context, epoch int64) (res sdk.Dec)

GetTR returns the tax rewards for the epoch

func (Keeper) GetTSL

func (k Keeper) GetTSL(ctx sdk.Context, epoch int64) (res sdk.Int)

GetTSL returns the total saked luna for the epoch

func (Keeper) GetTaxCap

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

func (k Keeper) GetTaxRate(ctx sdk.Context) (taxRate sdk.Dec)

GetTaxRate loads the tax rate

func (Keeper) IterateTaxCap

func (k Keeper) IterateTaxCap(ctx sdk.Context, handler func(denom string, taxCap sdk.Int) (stop bool))

IterateTaxCap iterates all tax cap

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) MiningIncrement

func (k Keeper) MiningIncrement(ctx sdk.Context) (res sdk.Dec)

MiningIncrement is a factor used to determine how fast MRL should grow over time

func (Keeper) PeekEpochSeigniorage

func (k Keeper) PeekEpochSeigniorage(ctx sdk.Context) sdk.Int

PeekEpochSeigniorage returns epoch seigniorage

func (Keeper) PeekEpochTaxProceeds

func (k Keeper) PeekEpochTaxProceeds(ctx sdk.Context) (res sdk.Coins)

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

func (Keeper) RecordEpochInitialIssuance

func (k Keeper) RecordEpochInitialIssuance(ctx sdk.Context)

RecordEpochInitialIssuance updates epoch initial issuance from supply keeper

func (Keeper) RecordEpochTaxProceeds

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

RecordEpochTaxProceeds adds tax proceeds that have been added this epoch

func (Keeper) RewardPolicy

func (k Keeper) RewardPolicy(ctx sdk.Context) (res types.PolicyConstraints)

RewardPolicy defines constraints for RewardWeight

func (Keeper) SeigniorageBurdenTarget

func (k Keeper) SeigniorageBurdenTarget(ctx sdk.Context) (res sdk.Dec)

SeigniorageBurdenTarget defines fixed target for the Seigniorage Burden. Between 0 and 1.

func (Keeper) SetEpochInitialIssuance

func (k Keeper) SetEpochInitialIssuance(ctx sdk.Context, issuance sdk.Coins)

SetEpochInitialIssuance stores epoch initial issuance

func (Keeper) SetEpochTaxProceeds

func (k Keeper) SetEpochTaxProceeds(ctx sdk.Context, taxProceeds sdk.Coins)

SetEpochTaxProceeds stores tax proceeds for the given epoch

func (Keeper) SetParams

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

SetParams sets the total set of treasury parameters.

func (Keeper) SetRewardWeight

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

SetRewardWeight sets the reward weight

func (Keeper) SetSR

func (k Keeper) SetSR(ctx sdk.Context, epoch int64, SR sdk.Dec)

SetSR stores the seigniorage rewards for the epoch

func (Keeper) SetTR

func (k Keeper) SetTR(ctx sdk.Context, epoch int64, TR sdk.Dec)

SetTR stores the tax rewards for the epoch

func (Keeper) SetTSL

func (k Keeper) SetTSL(ctx sdk.Context, epoch int64, TSL sdk.Int)

SetTSL stores the total saked luna for the epoch

func (Keeper) SetTaxCap

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

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

SetTaxRate sets the tax rate

func (Keeper) SettleSeigniorage

func (k Keeper) SettleSeigniorage(ctx sdk.Context)

SettleSeigniorage computes seigniorage and distributes it to oracle and distribution(community-pool) account

func (Keeper) TaxPolicy

func (k Keeper) TaxPolicy(ctx sdk.Context) (res types.PolicyConstraints)

TaxPolicy defines constraints for TaxRate

func (Keeper) UpdateIndicators

func (k Keeper) UpdateIndicators(ctx sdk.Context)

UpdateIndicators updates interal indicators

func (Keeper) UpdateRewardPolicy

func (k Keeper) UpdateRewardPolicy(ctx sdk.Context) (newRewardWeight sdk.Dec)

UpdateRewardPolicy updates reward-weight with w(t+1) = w(t)*SB_target/SB_rolling(t)

func (Keeper) UpdateTaxCap

func (k Keeper) UpdateTaxCap(ctx sdk.Context) sdk.Coins

UpdateTaxCap updates all denom's tax cap

func (Keeper) UpdateTaxPolicy

func (k Keeper) UpdateTaxPolicy(ctx sdk.Context) (newTaxRate sdk.Dec)

UpdateTaxPolicy updates tax-rate with t(t+1) = t(t) * (TL_year(t) + INC) / TL_month(t)

func (Keeper) WindowLong

func (k Keeper) WindowLong(ctx sdk.Context) (res int64)

WindowLong is a long period window for moving average

func (Keeper) WindowProbation

func (k Keeper) WindowProbation(ctx sdk.Context) (res int64)

WindowProbation is a period of time to prevent updates

func (Keeper) WindowShort

func (k Keeper) WindowShort(ctx sdk.Context) (res int64)

WindowShort is a short period window for moving average

type TestInput

type TestInput struct {
	Ctx            sdk.Context
	Cdc            *codec.Codec
	TreasuryKeeper Keeper
	StakingKeeper  staking.Keeper
	OracleKeeper   oracle.Keeper
	SupplyKeeper   supply.Keeper
	MarketKeeper   market.Keeper
	DistrKeeper    distr.Keeper
}

TestInput nolint

func CreateTestInput

func CreateTestInput(t *testing.T) TestInput

CreateTestInput nolint

Jump to

Keyboard shortcuts

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