keeper

package
v3.0.1 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ValPubKeys = simtestutil.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 HandleAddBurnTaxExemptionAddressProposal

func HandleAddBurnTaxExemptionAddressProposal(ctx sdk.Context, k Keeper, p *types.AddBurnTaxExemptionAddressProposal) error

func HandleRemoveBurnTaxExemptionAddressProposal

func HandleRemoveBurnTaxExemptionAddressProposal(ctx sdk.Context, k Keeper, p *types.RemoveBurnTaxExemptionAddressProposal) error

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

func MakeTestCodec

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

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 math.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 storetypes.StoreKey,
	paramSpace paramstypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	marketKeeper types.MarketKeeper,
	oracleKeeper types.OracleKeeper,
	stakingKeeper types.StakingKeeper,
	distrKeeper types.DistributionKeeper,
	wasmKeeper *wasmkeeper.Keeper,
	distributionModuleName string,
) Keeper

NewKeeper creates a new treasury Keeper instance

func (Keeper) AddBurnTaxExemptionAddress

func (k Keeper) AddBurnTaxExemptionAddress(ctx sdk.Context, address string)

Burn tax exemption list

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) GetBurnSplitRate

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

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) GetMinInitialDepositRatio

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

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) math.Int

GetTSL returns the total staked luna for the epoch

func (Keeper) GetTaxCap

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

func (k Keeper) HasBurnTaxExemptionAddress(ctx sdk.Context, addresses ...string) bool

HasBurnTaxExemptionAddress returns true if all provided addresses are in the tax exemption whitelist

func (Keeper) HasBurnTaxExemptionContract

func (k Keeper) HasBurnTaxExemptionContract(ctx sdk.Context, address string) bool

HasBurnTaxExemptionContract returns true if a provided address is a smart contract AND is in the tax exemption list

func (Keeper) IterateTaxCap

func (k Keeper) IterateTaxCap(ctx sdk.Context, handler func(denom string, taxCap math.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) math.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) RemoveBurnTaxExemptionAddress

func (k Keeper) RemoveBurnTaxExemptionAddress(ctx sdk.Context, address string) error

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) SetBurnSplitRate

func (k Keeper) SetBurnSplitRate(ctx sdk.Context, burnTaxSplit sdk.Dec)

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) SetMinInitialDepositRatio

func (k Keeper) SetMinInitialDepositRatio(ctx sdk.Context, minInitialDepositRatio sdk.Dec)

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 math.LegacyDec)

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 math.Int)

SetTSL stores the total staked luna for the epoch

func (Keeper) SetTaxCap

func (k Keeper) SetTaxCap(ctx sdk.Context, denom string, cap math.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 Migrator

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

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from version 1 to 2.

func (Migrator) Migrate2to3

func (m Migrator) Migrate2to3(ctx sdk.Context) error

Migrate2to3 migrates from version 2 to 3.

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
}

func CreateTestInput

func CreateTestInput(t *testing.T) TestInput

Jump to

Keyboard shortcuts

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