keeper

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the curating MsgServer interface for the provided Keeper.

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable for staking module

Types

type Keeper

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

Keeper of the x/curating store

func NewKeeper

NewKeeper creates a new staking Keeper instance

func (Keeper) BurnFromVotingPool

func (k Keeper) BurnFromVotingPool(ctx sdk.Context, amount sdk.Int) error

BurnFromVotingPool burns an amount of CREDITS from the voting pool

func (Keeper) CreatePost

func (k Keeper) CreatePost(
	ctx sdk.Context,
	vendorID uint32,
	postID *types.PostID,
	bodyHash types.BodyHash,
	body string,
	creator, rewardAccount sdk.AccAddress,
	chainID string,
	contractAddress sdk.AccAddress,
	metadata string,
	parentID *types.PostID,
) (post types.Post, err error)

CreatePost registers a post on-chain and starts the curation period. It can be called from CreateUpvote() when a post doesn't exist yet.

func (Keeper) CreateUpvote

func (k Keeper) CreateUpvote(
	ctx sdk.Context, vendorID uint32, postID types.PostID, curator,
	rewardAccount sdk.AccAddress, voteNum int32) error

CreateUpvote performs an upvote operation

func (Keeper) CurationQueueIterator

func (k Keeper) CurationQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

CurationQueueIterator returns an sdk.Iterator for all the posts in the queue that expire by endTime

func (Keeper) DeletePost

func (k Keeper) DeletePost(ctx sdk.Context, vendorID uint32, postID types.PostID) error

DeletePost removes a post

func (Keeper) DeleteUpvote

func (k Keeper) DeleteUpvote(ctx sdk.Context, vendorID uint32, postID types.PostID, upvote types.Upvote) error

DeleteUpvote removes an upvote

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis exports the curating module state

func (Keeper) GetCurationQueueTimeSlice

func (k Keeper) GetCurationQueueTimeSlice(
	ctx sdk.Context, timestamp time.Time) (vpPairs []types.VPPair)

GetCurationQueueTimeSlice returns a slice of Vendor/PostID pairs for a give time

func (Keeper) GetParams

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

GetParams returns the total set of curating parameters.

func (Keeper) GetPost

func (k Keeper) GetPost(
	ctx sdk.Context, vendorID uint32, postID types.PostID) (post types.Post, found bool, err error)

GetPost returns post if one exists

func (Keeper) GetPostID added in v0.6.0

func (k Keeper) GetPostID(ctx sdk.Context) (postID uint64)

GetPostID gets the highest postl ID

func (Keeper) GetPosts

func (k Keeper) GetPosts(ctx sdk.Context, vendorID uint32) (posts []types.Post)

GetPosts returns all posts on chain based on vendor id

func (Keeper) GetRewardPool

func (k Keeper) GetRewardPool(ctx sdk.Context) (rewardPool authtypes.ModuleAccountI)

GetRewardPool returns the reward pool account.

func (Keeper) GetRewardPoolBalance

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

GetRewardPoolBalance returns the reward pool balance

func (Keeper) GetUpvote

func (k Keeper) GetUpvote(
	ctx sdk.Context, vendorID uint32, postID types.PostID,
	curator sdk.AccAddress) (upvote types.Upvote, found bool, err error)

GetUpvote returns an upvote if one exists

func (Keeper) InflateRewardPool

func (k Keeper) InflateRewardPool(ctx sdk.Context) error

InflateRewardPool process the designated inflation to the reward pool

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState)

InitGenesis initializes the curating module state

func (Keeper) InitializeRewardPool

func (k Keeper) InitializeRewardPool(ctx sdk.Context, funds sdk.Coin) error

InitializeRewardPool sets up the reward pool from genesis

func (Keeper) InsertCurationQueue

func (k Keeper) InsertCurationQueue(
	ctx sdk.Context, vendorID uint32, postID types.PostID, curationEndTime time.Time)

InsertCurationQueue inserts a VPPair into the right timeslot in the curation queue

func (Keeper) IterateExpiredPosts

func (k Keeper) IterateExpiredPosts(
	ctx sdk.Context, cb func(post types.Post) (stop bool))

IterateExpiredPosts iterates over posts that have finished their curation period, and performs a callback fuction.

func (Keeper) IteratePosts

func (k Keeper) IteratePosts(ctx sdk.Context, vendorID uint32, cb func(post types.Post) (stop bool))

IteratePosts iterates over the all the posts by vendor_id and performs a callback function

func (Keeper) IterateUpvotes

func (k Keeper) IterateUpvotes(
	ctx sdk.Context, vendorID uint32, postID types.PostID, cb func(upvote types.Upvote) (stop bool))

IterateUpvotes performs a callback function for each upvoter on a post

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MustMarshalPost

func (k Keeper) MustMarshalPost(post types.Post) []byte

MustMarshalPost attempts to encode a Post object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustMarshalUpvote

func (k Keeper) MustMarshalUpvote(upvote types.Upvote) []byte

MustMarshalUpvote attempts to encode an Upvote object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustUnmarshalPost

func (k Keeper) MustUnmarshalPost(data []byte, post *types.Post)

MustUnmarshalPost attempts to decode a Post object and return it. It panics on error.

func (Keeper) Params

Params returns module params

func (Keeper) Post

Post returns a post based on vendor and post id

func (Keeper) Posts

Posts returns all posts based on vendor

func (Keeper) RemoveFromCurationQueue

func (k Keeper) RemoveFromCurationQueue(ctx sdk.Context, curationEndTime time.Time)

RemoveFromCurationQueue will remove an entire VPPair set from the queue

func (Keeper) SendMatchingReward

func (k Keeper) SendMatchingReward(
	ctx sdk.Context, account sdk.AccAddress, matchReward sdk.Dec) (sdk.Coin, error)

SendMatchingReward sends curator rewards from the protocol reward pool

func (Keeper) SetCurationQueueTimeSlice

func (k Keeper) SetCurationQueueTimeSlice(
	ctx sdk.Context, timestamp time.Time, vps []types.VPPair)

SetCurationQueueTimeSlice sets a slice of Vendor/PostIDs in the curation queue

func (Keeper) SetParams

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

SetParams sets the curating parameters to the param space.

func (Keeper) SetPost

func (k Keeper) SetPost(ctx sdk.Context, post types.Post)

SetPost sets a post in the store

func (Keeper) SetPostID added in v0.6.0

func (k Keeper) SetPostID(ctx sdk.Context, postID uint64)

SetPostID sets the new post ID to the store

func (Keeper) SetUpvote

func (k Keeper) SetUpvote(ctx sdk.Context, upvote types.Upvote, curator sdk.AccAddress)

SetUpvote sets a upvote in the store

func (Keeper) Upvotes

Upvotes returns all upvotes for a given vendor and post id

Jump to

Keyboard shortcuts

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