keeper

package
v0.5.12-oracle Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 49 Imported by: 4

Documentation

Overview

nolint

Index

Constants

This section is empty.

Variables

View Source
var (
	ValPubKeys = simapp.CreateTestPubKeys(5)

	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, sdk.DefaultPowerReduction)
	InitCoins  = sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens))
)

Functions

func FundAccount

func FundAccount(input TestInput, addr sdk.AccAddress, amounts sdk.Coins) error

FundAccount is a utility function that funds an account by minting and sending the coins to the address. This should be used for testing purposes only!

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 MakeEncodingConfig

func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig

MakeEncodingConfig nolint

func MakeTestCodec

func MakeTestCodec(t *testing.T) codec.Codec

MakeTestCodec nolint

func NewLegacyQuerier

func NewLegacyQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewLegacyQuerier is the module level router for state queries

func NewQuerier

func NewQuerier(keeper Keeper) types.QueryServer

NewQuerier returns an implementation of the market QueryServer interface for the provided Keeper.

func NewTestMsgCreateValidator

func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator

NewTestMsgCreateValidator test msg creator

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.BinaryCodec, storeKey sdk.StoreKey,
	paramSpace paramstypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	marketKeeper types.MarketKeeper,
	oracleKeeper types.OracleKeeper,
	stakingKeeper types.StakingKeeper,
	distrKeeper types.DistributionKeeper,
	distributionModuleName string) Keeper

NewKeeper creates a new treasury Keeper instance

func (Keeper) BurnCoinsFromBurnAccount

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

BurnCoinsFromBurnAccount burn all coins from burn account

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 staked luna from the store

func (Keeper) GetBurnModuleAccount

func (k Keeper) GetBurnModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetBurnModuleAccount returns burn ModuleAccount

func (Keeper) GetEpoch

func (k Keeper) GetEpoch(ctx sdk.Context) int64

GetEpoch returns current epoch of (current block height + cumulated block height of past chains)

func (Keeper) GetEpochInitialIssuance

func (k Keeper) GetEpochInitialIssuance(ctx sdk.Context) 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) sdk.Dec

GetRewardWeight loads the reward weight

func (Keeper) GetSR

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

GetSR returns the seigniorage rewards for the epoch

func (Keeper) GetTR

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

GetTR returns the tax rewards for the epoch

func (Keeper) GetTSL

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

GetTSL returns the total staked luna for the epoch

func (Keeper) GetTaxCap

func (k Keeper) GetTaxCap(ctx sdk.Context, denom string) 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) sdk.Dec

GetTaxRate loads the tax rate

func (Keeper) GetTreasuryModuleAccount

func (k Keeper) GetTreasuryModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetTreasuryModuleAccount returns treasury ModuleAccount

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) 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 staked 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 internal 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 uint64)

WindowLong is a long period window for moving average

func (Keeper) WindowProbation

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

WindowProbation is a period of time to prevent updates

func (Keeper) WindowShort

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

WindowShort is a short period window for moving average

type TestInput

type TestInput struct {
	Ctx            sdk.Context
	Cdc            *codec.LegacyAmino
	TreasuryKeeper Keeper
	AccountKeeper  authkeeper.AccountKeeper
	BankKeeper     bankkeeper.Keeper
	DistrKeeper    distrkeeper.Keeper
	StakingKeeper  stakingkeeper.Keeper
	MarketKeeper   types.MarketKeeper
	OracleKeeper   types.OracleKeeper
}

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