Documentation ¶
Index ¶
- Variables
- 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 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, permlink types.Permlink) (sdk.Rat, sdk.Error)
- func (pm PostManager) GetRedistributionSplitRate(ctx sdk.Context, permlink types.Permlink) (sdk.Rat, sdk.Error)
- func (pm PostManager) GetReportOrUpvoteInterval(ctx sdk.Context) (int64, 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) ReportOrUpvoteToPost(ctx sdk.Context, permlink types.Permlink, user types.AccountKey, ...) 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 ¶
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 ErrDeveloperNotFound ¶
func ErrDeveloperNotFound(fromApp types.AccountKey) sdk.Error
func ErrInvalidMemo ¶
func ErrInvalidTarget ¶
func ErrNoAuthor ¶
func ErrNoPostID ¶
func ErrNoUsername ¶
func ErrPostIDTooLong ¶
func ErrTooManyURL ¶
func ErrURLLengthTooLong ¶
func InitGlobalManager ¶
func InitGlobalManager(ctx sdk.Context, gm global.GlobalManager) error
func NewHandler ¶
func NewHandler(pm PostManager, am acc.AccountManager, gm global.GlobalManager, dm dev.DeveloperManager) sdk.Handler
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) 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 (DonateMsg) GetPermission ¶
func (msg DonateMsg) GetPermission() types.Permission
func (DonateMsg) GetSignBytes ¶
func (DonateMsg) GetSigners ¶
func (msg DonateMsg) GetSigners() []sdk.AccAddress
func (DonateMsg) ValidateBasic ¶
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 ¶
DeletePost triggered by censorship proposal
func (PostManager) DoesPostExist ¶
check if post exist
func (PostManager) GetCreatedTimeAndReward ¶
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 (PostManager) GetReportOrUpvoteInterval ¶
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) 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 ¶
func (event RewardEvent) Execute( ctx sdk.Context, pm PostManager, am acc.AccountManager, gm global.GlobalManager, dm dev.DeveloperManager) sdk.Error
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 ¶
NewViewMsg constructs a view msg
func (ViewMsg) GetConsumeAmount ¶
func (ViewMsg) GetPermission ¶
func (msg ViewMsg) GetPermission() types.Permission
func (ViewMsg) GetSignBytes ¶
func (ViewMsg) GetSigners ¶
func (msg ViewMsg) GetSigners() []sdk.AccAddress
func (ViewMsg) ValidateBasic ¶
ValidateBasic implements sdk.Msg