Documentation ¶
Index ¶
- func ErrAccountNotFound(author types.AccountKey) sdk.Error
- func ErrCannotDonateToSelf(user types.AccountKey) sdk.Error
- func ErrCommentAndRepostConflict() sdk.Error
- func ErrCreatePostSourceInvalid(permlink types.Permlink) sdk.Error
- func ErrDeveloperNotFound(fromApp types.AccountKey) sdk.Error
- func ErrDonatePostIsDeleted(permlink types.Permlink) sdk.Error
- func ErrGetSourcePost(permlink types.Permlink) sdk.Error
- func ErrIdentifierLengthTooLong() sdk.Error
- func ErrInvalidMemo() sdk.Error
- func ErrInvalidPostRedistributionSplitRate() sdk.Error
- func ErrInvalidTarget() sdk.Error
- func ErrNoAuthor() sdk.Error
- func ErrNoPostID() sdk.Error
- func ErrNoUsername() sdk.Error
- func ErrPostAlreadyExist(permlink types.Permlink) sdk.Error
- func ErrPostContentExceedMaxLength() sdk.Error
- func ErrPostIDTooLong() sdk.Error
- func ErrPostNotFound(permlink types.Permlink) sdk.Error
- func ErrPostTitleExceedMaxLength() sdk.Error
- func ErrPostTooOften(author types.AccountKey) sdk.Error
- func ErrProcessDonation(permlink types.Permlink) sdk.Error
- func ErrProcessSourceDonation(permlink types.Permlink) sdk.Error
- func ErrRedistributionSplitRateLengthTooLong() sdk.Error
- func ErrReportOrUpvoteAlreadyExist(permlink types.Permlink) sdk.Error
- func ErrReportOrUpvoteTooOften() sdk.Error
- func ErrTooManyURL() sdk.Error
- func ErrURLLengthTooLong() sdk.Error
- func ErrUpdatePostIsDeleted(permlink types.Permlink) sdk.Error
- func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error
- func NewHandler(pm PostManager, am acc.AccountManager, gm global.GlobalManager, ...) sdk.Handler
- func RegisterWire(cdc *wire.Codec)
- type CreatePostMsg
- func (msg CreatePostMsg) GetConsumeAmount() types.Coin
- func (msg CreatePostMsg) GetPermission() types.Permission
- func (msg CreatePostMsg) GetSignBytes() []byte
- func (msg CreatePostMsg) GetSigners() []sdk.AccAddress
- func (msg CreatePostMsg) String() string
- func (msg CreatePostMsg) Type() string
- func (msg CreatePostMsg) ValidateBasic() sdk.Error
- type DeletePostMsg
- func (msg DeletePostMsg) GetConsumeAmount() types.Coin
- func (msg DeletePostMsg) GetPermission() types.Permission
- func (msg DeletePostMsg) GetSignBytes() []byte
- func (msg DeletePostMsg) GetSigners() []sdk.AccAddress
- func (msg DeletePostMsg) String() string
- func (msg DeletePostMsg) Type() string
- func (msg DeletePostMsg) ValidateBasic() sdk.Error
- type DonateMsg
- func (msg DonateMsg) GetConsumeAmount() types.Coin
- func (msg DonateMsg) GetPermission() types.Permission
- func (msg DonateMsg) GetSignBytes() []byte
- func (msg DonateMsg) GetSigners() []sdk.AccAddress
- func (msg DonateMsg) String() string
- func (msg DonateMsg) Type() string
- func (msg DonateMsg) ValidateBasic() sdk.Error
- type PostManager
- func (pm PostManager) AddComment(ctx sdk.Context, permlink types.Permlink, commentAuthor types.AccountKey, ...) sdk.Error
- func (pm PostManager) AddDonation(ctx sdk.Context, permlink types.Permlink, donator types.AccountKey, ...) sdk.Error
- func (pm PostManager) AddOrUpdateViewToPost(ctx sdk.Context, permlink types.Permlink, user types.AccountKey) sdk.Error
- func (pm PostManager) CreatePost(ctx sdk.Context, author types.AccountKey, postID string, ...) sdk.Error
- func (pm PostManager) DeletePost(ctx sdk.Context, permlink types.Permlink) sdk.Error
- func (pm PostManager) DoesPostExist(ctx sdk.Context, permlink types.Permlink) bool
- func (pm PostManager) GetCreatedTimeAndReward(ctx sdk.Context, permlink types.Permlink) (int64, types.Coin, sdk.Error)
- func (pm PostManager) GetPenaltyScore(ctx sdk.Context, reputation types.Coin) (sdk.Rat, sdk.Error)
- func (pm PostManager) GetRedistributionSplitRate(ctx sdk.Context, permlink types.Permlink) (sdk.Rat, sdk.Error)
- func (pm PostManager) GetSourcePost(ctx sdk.Context, permlink types.Permlink) (types.AccountKey, string, sdk.Error)
- func (pm PostManager) IsDeleted(ctx sdk.Context, permlink types.Permlink) (bool, sdk.Error)
- func (pm PostManager) UpdateLastActivityAt(ctx sdk.Context, permlink types.Permlink) sdk.Error
- func (pm PostManager) UpdatePost(ctx sdk.Context, author types.AccountKey, postID, title, content string, ...) sdk.Error
- type ReportOrUpvoteMsg
- func (msg ReportOrUpvoteMsg) GetConsumeAmount() types.Coin
- func (msg ReportOrUpvoteMsg) GetPermission() types.Permission
- func (msg ReportOrUpvoteMsg) GetSignBytes() []byte
- func (msg ReportOrUpvoteMsg) GetSigners() []sdk.AccAddress
- func (msg ReportOrUpvoteMsg) String() string
- func (msg ReportOrUpvoteMsg) Type() string
- func (msg ReportOrUpvoteMsg) ValidateBasic() sdk.Error
- type RewardEvent
- type UpdatePostMsg
- func (msg UpdatePostMsg) GetConsumeAmount() types.Coin
- func (msg UpdatePostMsg) GetPermission() types.Permission
- func (msg UpdatePostMsg) GetSignBytes() []byte
- func (msg UpdatePostMsg) GetSigners() []sdk.AccAddress
- func (msg UpdatePostMsg) String() string
- func (msg UpdatePostMsg) Type() string
- func (msg UpdatePostMsg) ValidateBasic() sdk.Error
- type ViewMsg
- func (msg ViewMsg) GetConsumeAmount() types.Coin
- func (msg ViewMsg) GetPermission() types.Permission
- func (msg ViewMsg) GetSignBytes() []byte
- func (msg ViewMsg) GetSigners() []sdk.AccAddress
- func (msg ViewMsg) String() string
- func (msg ViewMsg) Type() string
- func (msg ViewMsg) ValidateBasic() sdk.Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrAccountNotFound ¶
func ErrAccountNotFound(author types.AccountKey) sdk.Error
ErrAccountNotFound - error when account is not found
func ErrCannotDonateToSelf ¶
func ErrCannotDonateToSelf(user types.AccountKey) sdk.Error
ErrCannotDonateToSelf - error when donate to self
func ErrCommentAndRepostConflict ¶
ErrCommentAndRepostConflict - error when posting with both source post and parent post
func ErrCreatePostSourceInvalid ¶
ErrCreatePostSourceInvalid - error when repost's source post is invalid
func ErrDeveloperNotFound ¶
func ErrDeveloperNotFound(fromApp types.AccountKey) sdk.Error
ErrDeveloperNotFound - error when develoepr is not found
func ErrDonatePostIsDeleted ¶
ErrDonatePostIsDeleted - error when donate to a deleted post
func ErrGetSourcePost ¶
ErrGetSourcePost - error when get repost's source post failed
func ErrIdentifierLengthTooLong ¶
ErrIdentifierLengthTooLong - error when post identifier length is too long
func ErrInvalidMemo ¶
ErrInvalidMemo - error when donate memo is invalid
func ErrInvalidPostRedistributionSplitRate ¶
ErrInvalidPostRedistributionSplitRate - error when post redistribution split rate is invalid
func ErrInvalidTarget ¶
ErrInvalidTarget - error when target post is invalid
func ErrNoUsername ¶
ErrNoUsername - error when posting without username
func ErrPostAlreadyExist ¶
ErrPostAlreadyExist - error when post is already exist
func ErrPostContentExceedMaxLength ¶
ErrPostContentExceedMaxLength - error when post content is too long
func ErrPostIDTooLong ¶
ErrPostIDTooLong - error when post ID is too long
func ErrPostNotFound ¶
ErrPostNotFound - error when post is not found
func ErrPostTitleExceedMaxLength ¶
ErrPostTitleExceedMaxLength - error when post title is too long
func ErrPostTooOften ¶ added in v0.1.1
func ErrPostTooOften(author types.AccountKey) sdk.Error
ErrPostTooOften - error when user posting too often
func ErrProcessDonation ¶
ErrProcessDonation - error when donation failed
func ErrProcessSourceDonation ¶
ErrProcessSourceDonation - error when donate to source post failed
func ErrRedistributionSplitRateLengthTooLong ¶
ErrRedistributionSplitRateLengthTooLong - error when redistribution split rate's length is too long
func ErrReportOrUpvoteAlreadyExist ¶
ErrReportOrUpvoteAlreadyExist - error when user report or upvote to a post which he already reported or upvoted
func ErrReportOrUpvoteTooOften ¶
ErrReportOrUpvoteTooOften - error when user report too often
func ErrTooManyURL ¶
ErrTooManyURL - error when posting with too many url
func ErrURLLengthTooLong ¶
ErrURLLengthTooLong - error when post url length is too long
func ErrUpdatePostIsDeleted ¶
ErrUpdatePostIsDeleted - error when update a deleted post
func InitGlobalManager ¶
func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error
InitGlobalManager - init global manager
func NewHandler ¶
func NewHandler( pm PostManager, am acc.AccountManager, gm global.GlobalManager, dm dev.DeveloperManager, rm rep.ReputationManager) sdk.Handler
NewHandler - Handle all "post" type messages.
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
GetConsumeAmount - implements types.Msg
func (CreatePostMsg) GetPermission ¶
func (msg CreatePostMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
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) 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"` }
DeletePostMsg - sent from a user to a post
func NewDeletePostMsg ¶
func NewDeletePostMsg(author, postID string) DeletePostMsg
func (DeletePostMsg) GetConsumeAmount ¶
func (msg DeletePostMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implements types.Msg
func (DeletePostMsg) GetPermission ¶
func (msg DeletePostMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (DeletePostMsg) GetSignBytes ¶
func (msg DeletePostMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (DeletePostMsg) GetSigners ¶
func (msg DeletePostMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (DeletePostMsg) String ¶
func (msg DeletePostMsg) String() string
func (DeletePostMsg) ValidateBasic ¶
func (msg DeletePostMsg) ValidateBasic() sdk.Error
ValidateBasic - implements sdk.Msg
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 ¶
GetConsumeAmount - implements types.Msg
func (DonateMsg) GetPermission ¶
func (msg DonateMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (DonateMsg) GetSignBytes ¶
GetSignBytes - implements sdk.Msg
func (DonateMsg) GetSigners ¶
func (msg DonateMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (DonateMsg) ValidateBasic ¶
ValidateBasic - implements sdk.Msg
type PostManager ¶
type PostManager struct {
// contains filtered or unexported fields
}
func NewPostManager ¶
func NewPostManager(key sdk.StoreKey, holder param.ParamHolder) PostManager
NewPostManager - create a new post manager
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
AddDonation - add donation to post donation list
func (PostManager) AddOrUpdateViewToPost ¶
func (pm PostManager) AddOrUpdateViewToPost( ctx sdk.Context, permlink types.Permlink, user types.AccountKey) sdk.Error
AddOrUpdateViewToPost - 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 ¶
DeletePost - delete post by author or content censorship
func (PostManager) DoesPostExist ¶
DoesPostExist - check if post exist
func (PostManager) GetCreatedTimeAndReward ¶
func (pm PostManager) GetCreatedTimeAndReward(ctx sdk.Context, permlink types.Permlink) (int64, types.Coin, sdk.Error)
GetCreatedTimeAndReward - get post created time and reward for evaluate of content value
func (PostManager) GetPenaltyScore ¶
GetPenaltyScore - get penalty score from report and upvote
func (PostManager) GetRedistributionSplitRate ¶
func (pm PostManager) GetRedistributionSplitRate(ctx sdk.Context, permlink types.Permlink) (sdk.Rat, sdk.Error)
GetRedistributionSplitRate - get post redistribution split rate
func (PostManager) GetSourcePost ¶
func (pm PostManager) GetSourcePost( ctx sdk.Context, permlink types.Permlink) (types.AccountKey, string, sdk.Error)
GetSourcePost - return root source post
func (PostManager) UpdateLastActivityAt ¶ added in v0.1.1
UpdateLastActivityAt - update post last activity at
func (PostManager) UpdatePost ¶
func (pm PostManager) UpdatePost( ctx sdk.Context, author types.AccountKey, postID, title, content string, links []types.IDToURLMapping) sdk.Error
UpdatePost - update post title, content and links. Can't update a deleted post
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
GetConsumeAmount - implements types.Msg
func (ReportOrUpvoteMsg) GetPermission ¶
func (msg ReportOrUpvoteMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (ReportOrUpvoteMsg) GetSignBytes ¶
func (msg ReportOrUpvoteMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (ReportOrUpvoteMsg) GetSigners ¶
func (msg ReportOrUpvoteMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (ReportOrUpvoteMsg) String ¶
func (msg ReportOrUpvoteMsg) String() string
func (ReportOrUpvoteMsg) Type ¶
func (msg ReportOrUpvoteMsg) Type() string
Type - implements sdk.Msg
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"` }
RewardEvent - when donation occurred, a reward event will be register at 7 days later. After 7 days reward event will be executed and send inflation to author.
func (RewardEvent) Execute ¶
func (event RewardEvent) Execute( ctx sdk.Context, pm PostManager, am acc.AccountManager, gm global.GlobalManager, dm dev.DeveloperManager, vm vote.VoteManager, rm rep.ReputationManager) sdk.Error
Execute - execute reward event after 7 days
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"` }
UpdatePostMsg - update post
func NewUpdatePostMsg ¶
func NewUpdatePostMsg( author, postID, title, content string, links []types.IDToURLMapping) UpdatePostMsg
NewUpdatePostMsg - constructs a UpdatePost msg
func (UpdatePostMsg) GetConsumeAmount ¶
func (msg UpdatePostMsg) GetConsumeAmount() types.Coin
GetConsumeAmount - implements types.Msg
func (UpdatePostMsg) GetPermission ¶
func (msg UpdatePostMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (UpdatePostMsg) GetSignBytes ¶
func (msg UpdatePostMsg) GetSignBytes() []byte
GetSignBytes - implements sdk.Msg
func (UpdatePostMsg) GetSigners ¶
func (msg UpdatePostMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (UpdatePostMsg) String ¶
func (msg UpdatePostMsg) String() 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 ¶
NewViewMsg - constructs a view msg
func (ViewMsg) GetConsumeAmount ¶
GetConsumeAmount - implements types.Msg
func (ViewMsg) GetPermission ¶
func (msg ViewMsg) GetPermission() types.Permission
GetPermission - implements types.Msg
func (ViewMsg) GetSignBytes ¶
GetSignBytes - implements sdk.Msg
func (ViewMsg) GetSigners ¶
func (msg ViewMsg) GetSigners() []sdk.AccAddress
GetSigners - implements sdk.Msg
func (ViewMsg) ValidateBasic ¶
ValidateBasic - implements sdk.Msg