keeper

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	QueryOwner        = "owner"
	QueryShow         = "show"
	QueryList         = "list"
	QueryStats        = "stats"
	QueryCerberusAddr = "cerberus-addr"
)

query endpoints supported by the pdv Querier

Variables

This section is empty.

Functions

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier creates a new querier for pdv clients.

Types

type DateValue added in v0.2.0

type DateValue struct {
	Date  string  `json:"date"`
	Value float64 `json:"value" amino:"unsafe"`
}

DateValue is date-value stat item

type Keeper

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

Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine

func NewKeeper

func NewKeeper(cdc *codec.Codec, storeKey sdk.StoreKey, tokens TokenKeeper, stats Stats) Keeper

NewKeeper creates new instances of the PDV Keeper

func (Keeper) GetOwner

func (k Keeper) GetOwner(ctx sdk.Context, name string) sdk.AccAddress

GetOwner - get the current owner of a name

func (Keeper) GetPDV

func (k Keeper) GetPDV(ctx sdk.Context, address string) types.PDV

Gets the entire PDV metadata struct for an address

func (Keeper) GetPDVsIterator

func (k Keeper) GetPDVsIterator(ctx sdk.Context, prefix string) sdk.Iterator

Get an iterator over all PDVs in which the keys are the address and the values are the PDV

func (Keeper) IsHashPresent

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

Check if the address is present in the store or not

func (Keeper) SetPDV

func (k Keeper) SetPDV(ctx sdk.Context, address string, pdv types.PDV)

Sets the entire PDV metadata struct for an address

type Stats

type Stats interface {
	AddPDV(pdv types.PDV, token sdk.Int)
	ListPDV(owner sdk.AccAddress, from *time.Time, limit uint) ([]types.PDV, error)
	GetStats(owner sdk.AccAddress) (map[time.Time]float64, error)
}

func NewStats

func NewStats(db *bolt.DB) (Stats, error)

type TokenKeeper

type TokenKeeper interface {
	AddTokens(ctx sdk.Context, owner sdk.AccAddress, amount sdk.Int)
}

Jump to

Keyboard shortcuts

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