keeper

package
v1.4.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	QueryParameters        = "params"
	QueryWrkChain          = "wrkchain"
	QueryWrkChainsFiltered = "wrkchains-filtered"
	QueryWrkChainBlock     = "block"
)

query endpoints supported by the wrkchain Querier

View Source
const (
	TestDenomination = "testc"
)

Variables

View Source
var (
	TestAddrs = []sdk.AccAddress{
		wcAddr1, wcAddr2, wcAddr3, wcAddr4, wcAddr5,
	}
)

dummy addresses used for testing

Functions

func GenerateRandomAddresses

func GenerateRandomAddresses(num int) []sdk.AccAddress

func GenerateRandomString

func GenerateRandomString(length int) string

GenerateRandomString generates a random string given a length, based on a set character set

func GenerateRandomStringWithCharset

func GenerateRandomStringWithCharset(length int, charset string) string

GenerateRandomStringWithCharset generates a random string given a length and character set

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier is the module level router for state queries

func ParamsEqual

func ParamsEqual(paramsA, paramsB types.Params) bool

ParamsEqual checks params are equal

func RandInBetween

func RandInBetween(min, max int) int

RandInBetween generates a random number between two given values

func WRKChainBlockEqual

func WRKChainBlockEqual(lA, lB types.WrkChainBlock) bool

WRKChainBlockEqual checks if two WRKChainBlocks are equal

func WRKChainEqual

func WRKChainEqual(wcA types.WrkChain, wcB types.WrkChain) bool

WRKChainEqual checks if two WRKChains are equal

Types

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(storeKey sdk.StoreKey, paramSpace params.Subspace, cdc *codec.Codec) Keeper

NewKeeper creates new instances of the wrkchain Keeper

func (Keeper) Cdc

func (k Keeper) Cdc() *codec.Codec

func (Keeper) GetAllWrkChainBlockHashes

func (k Keeper) GetAllWrkChainBlockHashes(ctx sdk.Context, wrkchainID uint64) (wrkChainBlocks types.WrkChainBlocks)

GetAllWrkChainBlockHashes returns all the wrkchain's hashes from store

func (Keeper) GetAllWrkChains

func (k Keeper) GetAllWrkChains(ctx sdk.Context) (wrkChains types.WrkChains)

GetAllWrkChains returns all the registered wrkchain metadata from store

func (Keeper) GetHighestWrkChainID

func (k Keeper) GetHighestWrkChainID(ctx sdk.Context) (wrkChainID uint64, err error)

GetHighestWrkChainID gets the highest WRKChain ID

func (Keeper) GetParamDenom

func (k Keeper) GetParamDenom(ctx sdk.Context) string

func (Keeper) GetParamRecordFee

func (k Keeper) GetParamRecordFee(ctx sdk.Context) uint64

func (Keeper) GetParamRegistrationFee

func (k Keeper) GetParamRegistrationFee(ctx sdk.Context) uint64

func (Keeper) GetParams

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

GetParams returns the total set of WRKChain parameters.

func (Keeper) GetRecordFeeAsCoin

func (k Keeper) GetRecordFeeAsCoin(ctx sdk.Context) sdk.Coin

func (Keeper) GetRecordFeeAsCoins

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

func (Keeper) GetRegistrationFeeAsCoin

func (k Keeper) GetRegistrationFeeAsCoin(ctx sdk.Context) sdk.Coin

func (Keeper) GetRegistrationFeeAsCoins

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

func (Keeper) GetWrkChain

func (k Keeper) GetWrkChain(ctx sdk.Context, wrkchainId uint64) types.WrkChain

GetWrkChain Gets the entire WRKChain metadata struct for a wrkchainId

func (Keeper) GetWrkChainBlock

func (k Keeper) GetWrkChainBlock(ctx sdk.Context, wrkchainId uint64, height uint64) types.WrkChainBlock

GetWrkChainBlock Gets the entire WRKChain metadata struct for a wrkchainId

func (Keeper) GetWrkChainBlockHashesFiltered

func (k Keeper) GetWrkChainBlockHashesFiltered(ctx sdk.Context, wrkchainID uint64, params types.QueryWrkChainBlockParams) []types.WrkChainBlock

GetWrkChainsFiltered retrieves wrkchains filtered by a given set of params which include pagination parameters along a moniker and owner address.

NOTE: If no filters are provided, all proposals will be returned in paginated form.

func (Keeper) GetWrkChainBlockHashesIterator

func (k Keeper) GetWrkChainBlockHashesIterator(ctx sdk.Context, wrkchainID uint64) sdk.Iterator

GetWrkChainBlockHashesIterator Gets an iterator over all WrkChain hashess in which the keys are the WrkChain Ids and the values are the WrkChainBlocks

func (Keeper) GetWrkChainOwner

func (k Keeper) GetWrkChainOwner(ctx sdk.Context, wrkchainId uint64) sdk.AccAddress

GetWrkChainOwner - get the current owner of a WRKChain

func (Keeper) GetWrkChainsFiltered

func (k Keeper) GetWrkChainsFiltered(ctx sdk.Context, params types.QueryWrkChainParams) []types.WrkChain

GetWrkChainsFiltered retrieves wrkchains filtered by a given set of params which include pagination parameters along a moniker and owner address.

NOTE: If no filters are provided, all proposals will be returned in paginated form.

func (Keeper) GetWrkChainsIterator

func (k Keeper) GetWrkChainsIterator(ctx sdk.Context) sdk.Iterator

GetWrkChainsIterator Get an iterator over all WrkChains in which the keys are the WrkChain Ids and the values are the WrkChains

func (Keeper) GetZeroFeeAsCoin

func (k Keeper) GetZeroFeeAsCoin(ctx sdk.Context) sdk.Coin

func (Keeper) GetZeroFeeAsCoins

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

func (Keeper) IsAuthorisedToRecord

func (k Keeper) IsAuthorisedToRecord(ctx sdk.Context, wrkchainId uint64, recorder sdk.AccAddress) bool

IsAuthorisedToRecord ensures only the WRKChain owner is recording hashes

func (Keeper) IsWrkChainBlockRecorded

func (k Keeper) IsWrkChainBlockRecorded(ctx sdk.Context, wrkchainId uint64, height uint64) bool

IsWrkChainBlockRecorded Check if the WrkChainBlock is present in the store or not

func (Keeper) IsWrkChainRegistered

func (k Keeper) IsWrkChainRegistered(ctx sdk.Context, wrkchainId uint64) bool

IsWrkChainRegistered Checks if the WrkChain is present in the store or not

func (Keeper) IterateWrkChainBlockHashes

func (k Keeper) IterateWrkChainBlockHashes(ctx sdk.Context, wrkchainID uint64, cb func(wrkChain types.WrkChainBlock) (stop bool))

IterateWrkChainBlockHashes iterates over the all the hashes for a wrkchain and performs a callback function

func (Keeper) IterateWrkChains

func (k Keeper) IterateWrkChains(ctx sdk.Context, cb func(wrkChain types.WrkChain) (stop bool))

IterateWrkChains iterates over the all the wrkchain metadata and performs a callback function

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) RecordWrkchainHashes

func (k Keeper) RecordWrkchainHashes(
	ctx sdk.Context,
	wrkchainId uint64,
	height uint64,
	blockHash string,
	parentHash string,
	hash1 string,
	hash2 string,
	hash3 string,
	owner sdk.AccAddress) error

RecordWrkchainHashes records a WRKChain block has for a registered WRKChain

func (Keeper) RegisterWrkChain

func (k Keeper) RegisterWrkChain(ctx sdk.Context, moniker string, wrkchainName string, genesisHash string, baseType string, owner sdk.AccAddress) (uint64, error)

RegisterWrkChain registers a WRKChain in the store

func (Keeper) SetHighestWrkChainID

func (k Keeper) SetHighestWrkChainID(ctx sdk.Context, wrkChainID uint64)

SetHighestWrkChainID sets the new highest WRKChain ID to the store

func (Keeper) SetLastBlock

func (k Keeper) SetLastBlock(ctx sdk.Context, wrkchainId uint64, blockNum uint64) error

SetLastBlock - sets the last block number submitted

func (Keeper) SetNumBlocks

func (k Keeper) SetNumBlocks(ctx sdk.Context, wrkchainId uint64) error

func (Keeper) SetParams

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

SetParams sets the total set of WRKChain parameters.

func (Keeper) SetWrkChain

func (k Keeper) SetWrkChain(ctx sdk.Context, wrkchain types.WrkChain) error

SetWrkChain Sets the WrkChain metadata struct for a wrkchainId

func (Keeper) SetWrkChainBlock

func (k Keeper) SetWrkChainBlock(ctx sdk.Context, wrkchainBlock types.WrkChainBlock) error

SetWrkChainBlock Sets the WrkChain Block struct for a wrkchainId & height

type NodeQuerier

type NodeQuerier interface {
	// QueryWithData performs a query to a Tendermint node with the provided path
	// and a data payload. It returns the result and height of the query upon success
	// or an error if the query fails.
	QueryWithData(path string, data []byte) ([]byte, int64, error)
}

NodeQuerier is an interface that is satisfied by types that provide the QueryWithData method

type ParamsRetriever

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

ParamsRetriever defines the properties of a type that can be used to retrieve enterprise params.

func NewParamsRetriever

func NewParamsRetriever(querier NodeQuerier) ParamsRetriever

NewParamsRetriever initialises a new ParamsRetriever instance.

func (ParamsRetriever) GetParams

func (ar ParamsRetriever) GetParams() (types.Params, error)

GetParams queries for parameters. An error is returned if the query or decoding fails.

func (ParamsRetriever) GetParamsHeight

func (ar ParamsRetriever) GetParamsHeight() (types.Params, int64, error)

GetParamsHeight queries for parameters. Returns the height of the query with the params. An error is returned if the query or decoding fails.

Jump to

Keyboard shortcuts

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