post

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TestAccountKVStoreKey   = sdk.NewKVStoreKey("account")
	TestPostKVStoreKey      = sdk.NewKVStoreKey("post")
	TestGlobalKVStoreKey    = sdk.NewKVStoreKey("global")
	TestDeveloperKVStoreKey = sdk.NewKVStoreKey("developer")
	TestParamKVStoreKey     = sdk.NewKVStoreKey("param")
)

Construct some global addrs and txs for tests.

Functions

func ErrAccountNotFound

func ErrAccountNotFound(author types.AccountKey) sdk.Error

func ErrCannotDonateToSelf

func ErrCannotDonateToSelf(user types.AccountKey) sdk.Error

func ErrCommentAndRepostConflict

func ErrCommentAndRepostConflict() sdk.Error

func ErrCreatePostSourceInvalid

func ErrCreatePostSourceInvalid(permlink types.Permlink) sdk.Error

func ErrDeveloperNotFound

func ErrDeveloperNotFound(fromApp types.AccountKey) sdk.Error

func ErrDonatePostIsDeleted

func ErrDonatePostIsDeleted(permlink types.Permlink) sdk.Error

func ErrGetSourcePost

func ErrGetSourcePost(permlink types.Permlink) sdk.Error

func ErrIdentifierLengthTooLong

func ErrIdentifierLengthTooLong() sdk.Error

func ErrInvalidMemo

func ErrInvalidMemo() sdk.Error

func ErrInvalidPostRedistributionSplitRate

func ErrInvalidPostRedistributionSplitRate() sdk.Error

func ErrInvalidTarget

func ErrInvalidTarget() sdk.Error

func ErrNoAuthor

func ErrNoAuthor() sdk.Error

func ErrNoPostID

func ErrNoPostID() sdk.Error

func ErrNoUsername

func ErrNoUsername() sdk.Error

func ErrPostAlreadyExist

func ErrPostAlreadyExist(permlink types.Permlink) sdk.Error

func ErrPostContentExceedMaxLength

func ErrPostContentExceedMaxLength() sdk.Error

func ErrPostIDTooLong

func ErrPostIDTooLong() sdk.Error

func ErrPostNotFound

func ErrPostNotFound(permlink types.Permlink) sdk.Error

func ErrPostTitleExceedMaxLength

func ErrPostTitleExceedMaxLength() sdk.Error

func ErrProcessDonation

func ErrProcessDonation(permlink types.Permlink) sdk.Error

func ErrProcessSourceDonation

func ErrProcessSourceDonation(permlink types.Permlink) sdk.Error

func ErrRedistributionSplitRateLengthTooLong

func ErrRedistributionSplitRateLengthTooLong() sdk.Error

func ErrReportOrUpvoteAlreadyExist

func ErrReportOrUpvoteAlreadyExist(permlink types.Permlink) sdk.Error

func ErrReportOrUpvoteTooOften

func ErrReportOrUpvoteTooOften() sdk.Error

func ErrTooManyURL

func ErrTooManyURL() sdk.Error

func ErrURLLengthTooLong

func ErrURLLengthTooLong() sdk.Error

func ErrUpdatePostIsDeleted

func ErrUpdatePostIsDeleted(permlink types.Permlink) sdk.Error

func InitGlobalManager

func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error

func RegisterWire

func RegisterWire(cdc *wire.Codec)

Register concrete types on wire codec

Types

type CreatePostMsg

type CreatePostMsg struct {
	Author                  types.AccountKey       `json:"author"`
	PostID                  string                 `json:"post_id"`
	Title                   string                 `json:"title"`
	Content                 string                 `json:"content"`
	ParentAuthor            types.AccountKey       `json:"parent_author"`
	ParentPostID            string                 `json:"parent_postID"`
	SourceAuthor            types.AccountKey       `json:"source_author"`
	SourcePostID            string                 `json:"source_postID"`
	Links                   []types.IDToURLMapping `json:"links"`
	RedistributionSplitRate string                 `json:"redistribution_split_rate"`
}

CreatePostMsg contains information to create a post

func NewCreatePostMsg

func NewCreatePostMsg(
	author, postID, title, content, parentAuthor, parentPostID,
	sourceAuthor, sourcePostID, redistributionSplitRate string,
	links []types.IDToURLMapping) CreatePostMsg

NewCreatePostMsg constructs a post msg

func (CreatePostMsg) GetConsumeAmount

func (msg CreatePostMsg) GetConsumeAmount() types.Coin

func (CreatePostMsg) GetPermission

func (msg CreatePostMsg) GetPermission() types.Permission

Get implements sdk.Msg; should not be called

func (CreatePostMsg) GetSignBytes

func (msg CreatePostMsg) GetSignBytes() []byte

GetSignBytes implements sdk.Msg

func (CreatePostMsg) GetSigners

func (msg CreatePostMsg) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg.

func (CreatePostMsg) String

func (msg CreatePostMsg) String() string

String implements Stringer

func (CreatePostMsg) Type

func (msg CreatePostMsg) Type() string

Type implements sdk.Msg

func (CreatePostMsg) ValidateBasic

func (msg CreatePostMsg) ValidateBasic() sdk.Error

ValidateBasic implements sdk.Msg

type DeletePostMsg

type DeletePostMsg struct {
	Author types.AccountKey `json:"author"`
	PostID string           `json:"post_id"`
}

func NewDeletePostMsg

func NewDeletePostMsg(author, postID string) DeletePostMsg

func (DeletePostMsg) GetConsumeAmount

func (msg DeletePostMsg) GetConsumeAmount() types.Coin

func (DeletePostMsg) GetPermission

func (msg DeletePostMsg) GetPermission() types.Permission

func (DeletePostMsg) GetSignBytes

func (msg DeletePostMsg) GetSignBytes() []byte

func (DeletePostMsg) GetSigners

func (msg DeletePostMsg) GetSigners() []sdk.AccAddress

func (DeletePostMsg) String

func (msg DeletePostMsg) String() string

func (DeletePostMsg) Type

func (msg DeletePostMsg) Type() string

func (DeletePostMsg) ValidateBasic

func (msg DeletePostMsg) ValidateBasic() sdk.Error

type DonateMsg

type DonateMsg struct {
	Username types.AccountKey `json:"username"`
	Amount   types.LNO        `json:"amount"`
	Author   types.AccountKey `json:"author"`
	PostID   string           `json:"post_id"`
	FromApp  types.AccountKey `json:"from_app"`
	Memo     string           `json:"memo"`
}

DonateMsg sent from a user to a post

func NewDonateMsg

func NewDonateMsg(
	user string, amount types.LNO, author string,
	postID string, fromApp string, memo string) DonateMsg

NewDonateMsg constructs a donate msg

func (DonateMsg) GetConsumeAmount

func (msg DonateMsg) GetConsumeAmount() types.Coin

func (DonateMsg) GetPermission

func (msg DonateMsg) GetPermission() types.Permission

func (DonateMsg) GetSignBytes

func (msg DonateMsg) GetSignBytes() []byte

func (DonateMsg) GetSigners

func (msg DonateMsg) GetSigners() []sdk.AccAddress

func (DonateMsg) String

func (msg DonateMsg) String() string

func (DonateMsg) Type

func (msg DonateMsg) Type() string

func (DonateMsg) ValidateBasic

func (msg DonateMsg) ValidateBasic() sdk.Error

type PostManager

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

func NewPostManager

func NewPostManager(key sdk.StoreKey, holder param.ParamHolder) PostManager

create NewPostManager

func (PostManager) AddComment

func (pm PostManager) AddComment(
	ctx sdk.Context, permlink types.Permlink, commentAuthor types.AccountKey, commentPostID string) sdk.Error

add comment to post comment list

func (PostManager) AddDonation

func (pm PostManager) AddDonation(
	ctx sdk.Context, permlink types.Permlink, donator types.AccountKey,
	amount types.Coin, donationType types.DonationType) sdk.Error

add donation to post donation list

func (PostManager) AddOrUpdateViewToPost

func (pm PostManager) AddOrUpdateViewToPost(
	ctx sdk.Context, permlink types.Permlink, user types.AccountKey) sdk.Error

add or update view from the user if view exists

func (PostManager) CreatePost

func (pm PostManager) CreatePost(
	ctx sdk.Context, author types.AccountKey, postID string,
	sourceAuthor types.AccountKey, sourcePostID string,
	parentAuthor types.AccountKey, parentPostID string,
	content string, title string, redistributionSplitRate sdk.Rat,
	links []types.IDToURLMapping) sdk.Error

create the post

func (PostManager) DeletePost

func (pm PostManager) DeletePost(ctx sdk.Context, permlink types.Permlink) sdk.Error

DeletePost triggered by censorship proposal

func (PostManager) DoesPostExist

func (pm PostManager) DoesPostExist(ctx sdk.Context, permlink types.Permlink) bool

check if post exist

func (PostManager) GetCreatedTimeAndReward

func (pm PostManager) GetCreatedTimeAndReward(ctx sdk.Context, permlink types.Permlink) (int64, types.Coin, sdk.Error)

func (PostManager) GetPenaltyScore

func (pm PostManager) GetPenaltyScore(ctx sdk.Context, permlink types.Permlink) (sdk.Rat, sdk.Error)

get penalty score from report and upvote

func (PostManager) GetRedistributionSplitRate

func (pm PostManager) GetRedistributionSplitRate(ctx sdk.Context, permlink types.Permlink) (sdk.Rat, sdk.Error)

func (PostManager) GetReportOrUpvoteInterval

func (pm PostManager) GetReportOrUpvoteInterval(ctx sdk.Context) (int64, sdk.Error)

add or update view from the user if view exists

func (PostManager) GetSourcePost

func (pm PostManager) GetSourcePost(
	ctx sdk.Context, permlink types.Permlink) (types.AccountKey, string, sdk.Error)

return root source post

func (PostManager) IsDeleted

func (pm PostManager) IsDeleted(ctx sdk.Context, permlink types.Permlink) (bool, sdk.Error)

func (PostManager) ReportOrUpvoteToPost

func (pm PostManager) ReportOrUpvoteToPost(
	ctx sdk.Context, permlink types.Permlink, user types.AccountKey,
	stake types.Coin, isReport bool) sdk.Error

add or update report or upvote from the user if exist

func (PostManager) UpdatePost

func (pm PostManager) UpdatePost(
	ctx sdk.Context, author types.AccountKey, postID, title, content string,
	links []types.IDToURLMapping, redistributionSplitRate sdk.Rat) sdk.Error

type ReportOrUpvoteMsg

type ReportOrUpvoteMsg struct {
	Username types.AccountKey `json:"username"`
	Author   types.AccountKey `json:"author"`
	PostID   string           `json:"post_id"`
	IsReport bool             `json:"is_report"`
}

ReportOrUpvoteMsg sent from a user to a post

func NewReportOrUpvoteMsg

func NewReportOrUpvoteMsg(
	user, author, postID string, isReport bool) ReportOrUpvoteMsg

NewReportOrUpvoteMsg constructs a ReportOrUpvote msg

func (ReportOrUpvoteMsg) GetConsumeAmount

func (msg ReportOrUpvoteMsg) GetConsumeAmount() types.Coin

func (ReportOrUpvoteMsg) GetPermission

func (msg ReportOrUpvoteMsg) GetPermission() types.Permission

func (ReportOrUpvoteMsg) GetSignBytes

func (msg ReportOrUpvoteMsg) GetSignBytes() []byte

func (ReportOrUpvoteMsg) GetSigners

func (msg ReportOrUpvoteMsg) GetSigners() []sdk.AccAddress

func (ReportOrUpvoteMsg) String

func (msg ReportOrUpvoteMsg) String() string

func (ReportOrUpvoteMsg) Type

func (msg ReportOrUpvoteMsg) Type() string

func (ReportOrUpvoteMsg) ValidateBasic

func (msg ReportOrUpvoteMsg) ValidateBasic() sdk.Error

ValidateBasic implements sdk.Msg

type RewardEvent

type RewardEvent struct {
	PostAuthor types.AccountKey `json:"post_author"`
	PostID     string           `json:"post_id"`
	Consumer   types.AccountKey `json:"consumer"`
	Evaluate   types.Coin       `json:"evaluate"`
	Original   types.Coin       `json:"original"`
	Friction   types.Coin       `json:"friction"`
	FromApp    types.AccountKey `json:"from_app"`
}

func (RewardEvent) Execute

type UpdatePostMsg

type UpdatePostMsg struct {
	Author                  types.AccountKey       `json:"author"`
	PostID                  string                 `json:"post_id"`
	Title                   string                 `json:"title"`
	Content                 string                 `json:"content"`
	Links                   []types.IDToURLMapping `json:"links"`
	RedistributionSplitRate string                 `json:"redistribution_split_rate"`
}

func NewUpdatePostMsg

func NewUpdatePostMsg(
	author, postID, title, content string,
	links []types.IDToURLMapping, redistributionSplitRate string) UpdatePostMsg

NewUpdatePostMsg constructs a UpdatePost msg

func (UpdatePostMsg) GetConsumeAmount

func (msg UpdatePostMsg) GetConsumeAmount() types.Coin

func (UpdatePostMsg) GetPermission

func (msg UpdatePostMsg) GetPermission() types.Permission

func (UpdatePostMsg) GetSignBytes

func (msg UpdatePostMsg) GetSignBytes() []byte

func (UpdatePostMsg) GetSigners

func (msg UpdatePostMsg) GetSigners() []sdk.AccAddress

func (UpdatePostMsg) String

func (msg UpdatePostMsg) String() string

func (UpdatePostMsg) Type

func (msg UpdatePostMsg) Type() string

func (UpdatePostMsg) ValidateBasic

func (msg UpdatePostMsg) ValidateBasic() sdk.Error

ValidateBasic implements sdk.Msg

type ViewMsg

type ViewMsg struct {
	Username types.AccountKey `json:"username"`
	Author   types.AccountKey `json:"author"`
	PostID   string           `json:"post_id"`
}

ViewMsg sent from a user to a post

func NewViewMsg

func NewViewMsg(user, author string, postID string) ViewMsg

NewViewMsg constructs a view msg

func (ViewMsg) GetConsumeAmount

func (msg ViewMsg) GetConsumeAmount() types.Coin

func (ViewMsg) GetPermission

func (msg ViewMsg) GetPermission() types.Permission

func (ViewMsg) GetSignBytes

func (msg ViewMsg) GetSignBytes() []byte

func (ViewMsg) GetSigners

func (msg ViewMsg) GetSigners() []sdk.AccAddress

func (ViewMsg) String

func (msg ViewMsg) String() string

func (ViewMsg) Type

func (msg ViewMsg) Type() string

func (ViewMsg) ValidateBasic

func (msg ViewMsg) ValidateBasic() sdk.Error

ValidateBasic implements sdk.Msg

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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