keeper

package
v0.4.2-rc0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2021 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(),
		secp256k1.GenPrivKey().PubKey(),
		secp256k1.GenPrivKey().PubKey(),
	}

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

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

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

	OracleDecPrecision = 8
)

Functions

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

Types

type Keeper

type Keeper struct {
	StakingKeeper types.StakingKeeper
	// contains filtered or unexported fields
}

Keeper of the oracle store

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey,
	paramspace params.Subspace, distrKeeper types.DistributionKeeper,
	stakingKeeper types.StakingKeeper, supplyKeeper types.SupplyKeeper,
	distrName string) Keeper

NewKeeper constructs a new keeper for oracle

func (Keeper) AddAggregateExchangeRatePrevote added in v0.4.0

func (k Keeper) AddAggregateExchangeRatePrevote(ctx sdk.Context, aggregatePrevote types.AggregateExchangeRatePrevote)

AddAggregateExchangeRatePrevote adds an oracle aggregate prevote to the store

func (Keeper) AddAggregateExchangeRateVote added in v0.4.0

func (k Keeper) AddAggregateExchangeRateVote(ctx sdk.Context, aggregateVote types.AggregateExchangeRateVote)

AddAggregateExchangeRateVote adds an oracle aggregate prevote to the store

func (Keeper) AddExchangeRatePrevote

func (k Keeper) AddExchangeRatePrevote(ctx sdk.Context, prevote types.ExchangeRatePrevote)

AddExchangeRatePrevote adds an oracle prevote to the store

func (Keeper) AddExchangeRateVote

func (k Keeper) AddExchangeRateVote(ctx sdk.Context, vote types.ExchangeRateVote)

AddExchangeRateVote adds an oracle vote to the store

func (Keeper) ClearTobinTaxes added in v0.4.0

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

ClearTobinTaxes clears tobin taxes

func (Keeper) DeleteAggregateExchangeRatePrevote added in v0.4.0

func (k Keeper) DeleteAggregateExchangeRatePrevote(ctx sdk.Context, aggregatePrevote types.AggregateExchangeRatePrevote)

DeleteAggregateExchangeRatePrevote deletes an oracle prevote from the store

func (Keeper) DeleteAggregateExchangeRateVote added in v0.4.0

func (k Keeper) DeleteAggregateExchangeRateVote(ctx sdk.Context, aggregateVote types.AggregateExchangeRateVote)

DeleteAggregateExchangeRateVote deletes an oracle prevote from the store

func (Keeper) DeleteExchangeRatePrevote

func (k Keeper) DeleteExchangeRatePrevote(ctx sdk.Context, prevote types.ExchangeRatePrevote)

DeleteExchangeRatePrevote deletes an oracle prevote from the store

func (Keeper) DeleteExchangeRateVote

func (k Keeper) DeleteExchangeRateVote(ctx sdk.Context, vote types.ExchangeRateVote)

DeleteExchangeRateVote deletes an oracle vote from the store

func (Keeper) DeleteLunaExchangeRate

func (k Keeper) DeleteLunaExchangeRate(ctx sdk.Context, denom string)

DeleteLunaExchangeRate deletes the consensus exchange rate of Luna denominated in the denom asset from the store.

func (Keeper) DeleteMissCounter added in v0.3.5

func (k Keeper) DeleteMissCounter(ctx sdk.Context, operator sdk.ValAddress)

DeleteMissCounter removes miss counter for the validator

func (Keeper) GetAggregateExchangeRatePrevote added in v0.4.0

func (k Keeper) GetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) (aggregatePrevote types.AggregateExchangeRatePrevote, err error)

GetAggregateExchangeRatePrevote retrieves an oracle prevote from the store

func (Keeper) GetAggregateExchangeRateVote added in v0.4.0

func (k Keeper) GetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) (aggregateVote types.AggregateExchangeRateVote, err error)

GetAggregateExchangeRateVote retrieves an oracle prevote from the store

func (Keeper) GetExchangeRatePrevote

func (k Keeper) GetExchangeRatePrevote(ctx sdk.Context, denom string, voter sdk.ValAddress) (prevote types.ExchangeRatePrevote, err error)

GetExchangeRatePrevote retrieves an oracle prevote from the store

func (Keeper) GetLunaExchangeRate

func (k Keeper) GetLunaExchangeRate(ctx sdk.Context, denom string) (exchangeRate sdk.Dec, err error)

GetLunaExchangeRate gets the consensus exchange rate of Luna denominated in the denom asset from the store.

func (Keeper) GetMissCounter

func (k Keeper) GetMissCounter(ctx sdk.Context, operator sdk.ValAddress) (missCounter int64)

GetMissCounter retrieves the # of vote periods missed in this oracle slash window

func (Keeper) GetOracleAccount added in v0.4.0

func (k Keeper) GetOracleAccount(ctx sdk.Context) supplyexported.ModuleAccountI

GetOracleAccount returns oracle ModuleAccount

func (Keeper) GetOracleDelegate

func (k Keeper) GetOracleDelegate(ctx sdk.Context, operator sdk.ValAddress) (delegate sdk.AccAddress)

GetOracleDelegate gets the account address that the validator operator delegated oracle vote rights to

func (Keeper) GetParams

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

GetParams returns the total set of oracle parameters.

func (Keeper) GetRewardPool

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

GetRewardPool retrieves the balance of the oracle module account

func (Keeper) GetTobinTax added in v0.4.0

func (k Keeper) GetTobinTax(ctx sdk.Context, denom string) (tobinTax sdk.Dec, err error)

GetTobinTax return tobin tax for the denom

func (Keeper) GetVoteTargets added in v0.4.0

func (k Keeper) GetVoteTargets(ctx sdk.Context) (voteTargets []string)

GetVoteTargets returns the voting target list on current vote period

func (Keeper) IsVoteTarget added in v0.4.0

func (k Keeper) IsVoteTarget(ctx sdk.Context, denom string) bool

IsVoteTarget returns existence of a denom in the the voting target list

func (Keeper) IterateAggregateExchangeRatePrevotes added in v0.4.0

func (k Keeper) IterateAggregateExchangeRatePrevotes(ctx sdk.Context, handler func(aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool))

IterateAggregateExchangeRatePrevotes iterates rate over prevotes in the store

func (Keeper) IterateAggregateExchangeRateVotes added in v0.4.0

func (k Keeper) IterateAggregateExchangeRateVotes(ctx sdk.Context, handler func(aggregateVote types.AggregateExchangeRateVote) (stop bool))

IterateAggregateExchangeRateVotes iterates rate over prevotes in the store

func (Keeper) IterateExchangeRatePrevotes

func (k Keeper) IterateExchangeRatePrevotes(ctx sdk.Context, handler func(prevote types.ExchangeRatePrevote) (stop bool))

IterateExchangeRatePrevotes iterates rate over prevotes in the store

func (Keeper) IterateExchangeRateVotes

func (k Keeper) IterateExchangeRateVotes(ctx sdk.Context, handler func(vote types.ExchangeRateVote) (stop bool))

IterateExchangeRateVotes iterates over votes in the store

func (Keeper) IterateLunaExchangeRates

func (k Keeper) IterateLunaExchangeRates(ctx sdk.Context, handler func(denom string, exchangeRate sdk.Dec) (stop bool))

IterateLunaExchangeRates iterates over luna rates in the store

func (Keeper) IterateMissCounters

func (k Keeper) IterateMissCounters(ctx sdk.Context,
	handler func(operator sdk.ValAddress, missCounter int64) (stop bool))

IterateMissCounters iterates over the miss counters and performs a callback function.

func (Keeper) IterateOracleDelegates

func (k Keeper) IterateOracleDelegates(ctx sdk.Context,
	handler func(delegator sdk.ValAddress, delegate sdk.AccAddress) (stop bool))

IterateOracleDelegates iterates over the feed delegates and performs a callback function.

func (Keeper) IterateTobinTaxes added in v0.4.0

func (k Keeper) IterateTobinTaxes(ctx sdk.Context, handler func(denom string, tobinTax sdk.Dec) (stop bool))

IterateTobinTaxes iterates rate over tobin taxes in the store

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MinValidPerWindow

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

MinValidPerWindow returns oracle slashing threshold

func (Keeper) OrganizeBallotByDenom

func (k Keeper) OrganizeBallotByDenom(ctx sdk.Context) (votes map[string]types.ExchangeRateBallot)

OrganizeBallotByDenom collects all oracle votes for the period, categorized by the votes' denom parameter

func (Keeper) RewardBallotWinners

func (k Keeper) RewardBallotWinners(ctx sdk.Context, ballotWinners map[string]types.Claim)

RewardBallotWinners implements at the end of every VotePeriod, we give out portion of seigniorage reward(reward-weight) to the oracle voters that voted faithfully.

func (Keeper) RewardBand

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

RewardBand returns the ratio of allowable exchange rate error that a validator can be rewared

func (Keeper) RewardDistributionWindow

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

RewardDistributionWindow returns the number of vote periods during which seigiornage reward comes in and then is distributed.

func (Keeper) SetLunaExchangeRate

func (k Keeper) SetLunaExchangeRate(ctx sdk.Context, denom string, exchangeRate sdk.Dec)

SetLunaExchangeRate sets the consensus exchange rate of Luna denominated in the denom asset to the store.

func (Keeper) SetLunaExchangeRateWithEvent added in v0.4.0

func (k Keeper) SetLunaExchangeRateWithEvent(ctx sdk.Context, denom string, exchangeRate sdk.Dec)

SetLunaExchangeRateWithEvent sets the consensus exchange rate of Luna denominated in the denom asset to the store with ABCI event

func (Keeper) SetMissCounter

func (k Keeper) SetMissCounter(ctx sdk.Context, operator sdk.ValAddress, missCounter int64)

SetMissCounter updates the # of vote periods missed in this oracle slash window

func (Keeper) SetOracleDelegate

func (k Keeper) SetOracleDelegate(ctx sdk.Context, operator sdk.ValAddress, delegatedFeeder sdk.AccAddress)

SetOracleDelegate sets the account address that the validator operator delegated oracle vote rights to

func (Keeper) SetParams

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

SetParams sets the total set of oracle parameters.

func (Keeper) SetTobinTax added in v0.4.0

func (k Keeper) SetTobinTax(ctx sdk.Context, denom string, tobinTax sdk.Dec)

SetTobinTax updates tobin tax for the denom

func (Keeper) SlashFraction

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

SlashFraction returns oracle voting penalty rate

func (Keeper) SlashWindow

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

SlashWindow returns # of vote period for oracle slashing

func (Keeper) VotePeriod

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

VotePeriod returns the number of blocks during which voting takes place.

func (Keeper) VoteThreshold

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

VoteThreshold returns the minimum percentage of votes that must be received for a ballot to pass.

func (Keeper) Whitelist

func (k Keeper) Whitelist(ctx sdk.Context) (res types.DenomList)

Whitelist returns the denom list that can be activated

type TestInput

type TestInput struct {
	Ctx           sdk.Context
	Cdc           *codec.Codec
	AccKeeper     auth.AccountKeeper
	BankKeeper    bank.Keeper
	OracleKeeper  Keeper
	SupplyKeeper  supply.Keeper
	StakingKeeper staking.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