Documentation ¶
Index ¶
- Constants
- Variables
- func EndBlocker(ctx sdk.Context, keeper Keeper)
- func ErrAddressNotAuthorised() sdk.Error
- func ErrCodeAccountJailed(acc sdk.AccAddress) sdk.Error
- func ErrCodeCannotEditArgumentAlreadyStaked(argumentID uint64) sdk.Error
- func ErrCodeCannotEditArgumentWrongCreator(argumentID uint64) sdk.Error
- func ErrCodeDuplicateStake(argumentID uint64) sdk.Error
- func ErrCodeInvalidBodyLength() sdk.Error
- func ErrCodeInvalidStakeType(stakeType StakeType) sdk.Error
- func ErrCodeInvalidSummaryLength() sdk.Error
- func ErrCodeMaxAmountStakingReached() sdk.Error
- func ErrCodeMaxNumOfArgumentsReached(max int) sdk.Error
- func ErrCodeMinBalance() sdk.Error
- func ErrCodeUnknownArgument(argumentID uint64) sdk.Error
- func ErrCodeUnknownClaim(claimID uint64) sdk.Error
- func ErrCodeUnknownStake(stakeID uint64) sdk.Error
- func ErrCodeUnknownStakeType() sdk.Error
- func ErrInvalidQueryParams(err error) sdk.Error
- func ErrJSONParse(err error) sdk.Error
- func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
- func Interest(interestRate sdk.Dec, amount sdk.Coin, period time.Duration) sdk.Dec
- func NewHandler(keeper Keeper) sdk.Handler
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(c *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type AccountKeeper
- type AppModule
- func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)
- func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
- func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
- func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
- func (am AppModule) NewHandler() sdk.Handler
- func (am AppModule) NewQuerierHandler() sdk.Querier
- func (AppModule) QuerierRoute() string
- func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
- func (AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command
- func (AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- type Argument
- type BankKeeper
- type ClaimKeeper
- type Error
- type GenesisState
- type Keeper
- func (k Keeper) ActiveStakeQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) AddAdmin(ctx sdk.Context, admin, creator sdk.AccAddress) (err sdk.Error)
- func (k Keeper) Argument(ctx sdk.Context, argumentID uint64) (Argument, bool)
- func (k Keeper) ArgumentStakes(ctx sdk.Context, argumentID uint64) []Stake
- func (k Keeper) Arguments(ctx sdk.Context) []Argument
- func (k Keeper) ClaimArguments(ctx sdk.Context, claimID uint64) []Argument
- func (k Keeper) CommunityStakes(ctx sdk.Context, communityID string) []Stake
- func (k Keeper) DownvoteArgument(ctx sdk.Context, argumentID uint64) sdk.Error
- func (k Keeper) EditArgument(ctx sdk.Context, body, summary string, creator sdk.AccAddress, ...) (Argument, sdk.Error)
- func (k Keeper) GetParams(ctx sdk.Context) Params
- func (k Keeper) InsertActiveStakeQueue(ctx sdk.Context, stakeID uint64, endTime time.Time)
- func (k Keeper) IterateActiveStakeQueue(ctx sdk.Context, endTime time.Time, cb func(stake Stake) (stop bool))
- func (k Keeper) IterateAfterCreatedTimeUserStakes(ctx sdk.Context, creator sdk.AccAddress, createdTime time.Time, ...)
- func (k Keeper) IterateArgumentStakes(ctx sdk.Context, argumentID uint64, cb func(stake Stake) (stop bool))
- func (k Keeper) IterateClaimArguments(ctx sdk.Context, claimID uint64, cb func(argument Argument) (stop bool))
- func (k Keeper) IterateCommunityStakes(ctx sdk.Context, communityID string, cb func(stake Stake) (stop bool))
- func (k Keeper) IterateUserArguments(ctx sdk.Context, creator sdk.AccAddress, ...)
- func (k Keeper) IterateUserCommunityStakes(ctx sdk.Context, creator sdk.AccAddress, communityID string, ...)
- func (k Keeper) IterateUserEarnedCoins(ctx sdk.Context, cb userEarnedCoinsCallback)
- func (k Keeper) IterateUserStakes(ctx sdk.Context, creator sdk.AccAddress, cb func(stake Stake) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarkUnhelpfulArgument(ctx sdk.Context, argumentID uint64) sdk.Error
- func (k Keeper) RemoveAdmin(ctx sdk.Context, admin, remover sdk.AccAddress) (err sdk.Error)
- func (k Keeper) RemoveFromActiveStakeQueue(ctx sdk.Context, stakeID uint64, endTime time.Time)
- func (k Keeper) SetParams(ctx sdk.Context, params Params)
- func (k Keeper) SetStakeExpired(ctx sdk.Context, stakeID uint64) sdk.Error
- func (k Keeper) Stake(ctx sdk.Context, stakeID uint64) (Stake, bool)
- func (k Keeper) Stakes(ctx sdk.Context) []Stake
- func (k Keeper) SubmitArgument(ctx sdk.Context, body, summary string, creator sdk.AccAddress, claimID uint64, ...) (Argument, sdk.Error)
- func (k Keeper) SubmitUpvote(ctx sdk.Context, argumentID uint64, creator sdk.AccAddress) (Stake, sdk.Error)
- func (k Keeper) SubtractEarnedCoin(ctx sdk.Context, user sdk.AccAddress, communityID string, amount sdk.Int)
- func (k Keeper) TotalEarnedCoins(ctx sdk.Context, creator sdk.AccAddress) sdk.Int
- func (k Keeper) UpdateParams(ctx sdk.Context, updater sdk.AccAddress, updates Params, ...) sdk.Error
- func (k Keeper) UserArguments(ctx sdk.Context, address sdk.AccAddress) []Argument
- func (k Keeper) UserCommunityStakes(ctx sdk.Context, address sdk.AccAddress, communityID string) []Stake
- func (k Keeper) UserStakes(ctx sdk.Context, address sdk.AccAddress) []Stake
- func (k Keeper) UsersEarnings(ctx sdk.Context) []UserEarnedCoins
- type MsgAddAdmin
- type MsgDeleteArgument
- type MsgEditArgument
- type MsgRemoveAdmin
- type MsgSubmitArgument
- type MsgSubmitUpvote
- type MsgUpdateParams
- type Params
- type QueryArgumentStakesParams
- type QueryArgumentsByIDsParams
- type QueryClaimArgumentParams
- type QueryClaimArgumentsParams
- type QueryClaimTopArgumentParams
- type QueryCommunityStakesParams
- type QueryEarnedCoinsParams
- type QueryStakeParams
- type QueryTotalEarnedCoinsParams
- type QueryUserArgumentsParams
- type QueryUserCommunityStakesParams
- type QueryUserStakesParams
- type RewardResult
- type RewardResultType
- type Stake
- type StakeLimitUpgrade
- type StakeType
- type TransactionType
- type UserEarnedCoins
Constants ¶
const ( TransactionInterestArgumentCreation = exported.TransactionInterestArgumentCreation TransactionInterestUpvoteReceived = exported.TransactionInterestUpvoteReceived TransactionInterestUpvoteGiven = exported.TransactionInterestUpvoteGiven TransactionBacking = exported.TransactionBacking TransactionChallenge = exported.TransactionChallenge TransactionUpvote = exported.TransactionUpvote TransactionBackingReturned = exported.TransactionBackingReturned TransactionChallengeReturned = exported.TransactionChallengeReturned TransactionUpvoteReturned = exported.TransactionUpvoteReturned UserRewardPoolName = distribution.UserRewardPoolName )
Aliased constants
const ( DefaultCodespace sdk.CodespaceType = ModuleName ErrorCodeInvalidStakeType sdk.CodeType = 501 ErrorCodeAccountJailed sdk.CodeType = 502 ErrorCodeInvalidBodyLength sdk.CodeType = 503 ErrorCodeInvalidSummaryLength sdk.CodeType = 504 ErrorCodeUnknownArgument sdk.CodeType = 505 ErrorCodeUnknownStake sdk.CodeType = 506 ErrorCodeDuplicateStake sdk.CodeType = 507 ErrorCodeMaxNumOfArgumentsReached sdk.CodeType = 508 ErrorCodeMaxAmountStakingReached sdk.CodeType = 509 ErrorCodeInvalidQueryParams sdk.CodeType = 510 ErrorCodeJSONParsing sdk.CodeType = 511 ErrorCodeUnknownClaim sdk.CodeType = 512 ErrorCodeUnknownStakeType sdk.CodeType = 513 ErrorCodeCannotEditArgumentAlreadyStaked sdk.CodeType = 514 ErrorCodeCannotEditArgumentWrongCreator sdk.CodeType = 515 ErrorCodeMinBalance sdk.CodeType = 516 ErrorCodeAddressNotAuthorised sdk.CodeType = 517 )
Staking errors reserve 500 ~ 599.
const ( ErrInvalidArgumentStakeDenom = Error("invalid denomination for argument stake") ErrInvalidUpvoteStakeDenom = Error("invalid denomination for upvote stake") )
GenesisErrors
const ( TypeMsgSubmitArgument = "submit_argument" TypeMsgSubmitUpvote = "submit_upvote" TypeMsgDeleteArgument = "delete_argument" TypeMsgEditArgument = "edit_argument" TypeMsgAddAdmin = "add_admin" TypeMsgRemoveAdmin = "remove_admin" TypeMsgUpdateParams = "update_params" )
const ( QueryClaimArgument = "claim_argument" QueryClaimArguments = "claim_arguments" QueryUserArguments = "user_arguments" QueryArgumentStakes = "argument_stakes" QueryCommunityStakes = "community_stakes" QueryStake = "stake" QueryArgumentsByIDs = "arguments_ids" QueryUserStakes = "user_stakes" QueryUserCommunityStakes = "user_community_stakes" QueryClaimTopArgument = "claim_top_argument" QueryEarnedCoins = "earned_coins" QueryTotalEarnedCoins = "total_earned_coins" QueryParams = "params" )
const ( StoreKey = ModuleName RouterKey = ModuleName QuerierRoute = ModuleName DefaultParamspace = ModuleName EventTypeInterestRewardPaid = "interest-reward-paid" AttributeKeyExpiredStakes = "expired-stakes" EventTypeStakeLimitIncreased = "stake-limit-increased" AttributeKeyStakeLimitUpgrade = "stake-limit-upgrade" UserStakesPoolName = "user_stakes_tokens_pool" )
Defines staking module constants
const ModuleName = "trustaking"
ModuleName is the name of this module
Variables ¶
var ( WithCommunityID = exported.WithCommunityID FromModuleAccount = exported.FromModuleAccount ToModuleAccount = exported.ToModuleAccount )
Transaction setters
var ( StakesKeyPrefix = []byte{0x00} ArgumentsKeyPrefix = []byte{0x01} EarnedCoinsKeyPrefix = []byte{0x02} // ID Keys StakeIDKey = []byte{0x10} ArgumentIDKey = []byte{0x11} // AssociationKeys ClaimArgumentsKeyPrefix = []byte{0x20} ArgumentStakesKeyPrefix = []byte{0x21} UserArgumentsKeyPrefix = []byte{0x22} UserStakesKeyPrefix = []byte{0x23} CommunityStakesKeyPrefix = []byte{0x24} UserCommunityStakesKeyPrefix = []byte{0x25} // Queue ActiveStakeQueuePrefix = []byte{0x40} )
Define keys
var ( ParamKeyPeriod = []byte("period") ParamKeyArgumentCreationStake = []byte("argumentCreationStake") ParamKeyArgumentBodyMaxLength = []byte("argumentBodyMaxLength") ParamKeyArgumentBodyMinLength = []byte("argumentBodyMinLength") ParamKeyArgumentSummaryMaxLength = []byte("argumentSummaryMaxLength") ParamKeyArgumentSummaryMinLength = []byte("argumentSummaryMinLength") ParamKeyUpvoteStake = []byte("upvoteStake") ParamKeyInterestRate = []byte("interestRate") ParamKeyStakingAdmins = []byte("stakingAdmins") ParamKeyStakeLimitPercent = []byte("stakeLimitPercent") ParamKeyStakeLimitDays = []byte("stakeLimitDays") ParamKeyUnjailUpvotes = []byte("unjailUpvotes") ParamKeyMaxArgumentsPerClaim = []byte("maxArgumentsPerClaim") )
var ModuleCodec *codec.Codec
ModuleCodec encodes module codec
var StakeTypeName = []string{ StakeBacking: "StakeBacking", StakeChallenge: "StakeChallenge", StakeUpvote: "StakeUpvote", }
Functions ¶
func EndBlocker ¶
EndBlocker called every block, process expiring stakes
func ErrAddressNotAuthorised ¶
ErrAddressNotAuthorised throws an error when the address is not admin
func ErrCodeAccountJailed ¶
func ErrCodeAccountJailed(acc sdk.AccAddress) sdk.Error
ErrCodeAccountJailed throws an error is in jailed status when performing actions.
func ErrCodeCannotEditArgumentAlreadyStaked ¶
ErrCodeCannotEditArgumentAlreadyStaked throws an error when an argument cannot be edited because it has already been staked
func ErrCodeCannotEditArgumentWrongCreator ¶
ErrCodeCannotEditArgumentWrongCreator throws an error when an argument cannot be edited because the edit is not coming from the creator
func ErrCodeDuplicateStake ¶
ErrCodeDuplicateStake throws an error when you already staked.
func ErrCodeInvalidBodyLength ¶
ErrCodeInvalidBodyLength throws an error when an invalid body length.
func ErrCodeInvalidStakeType ¶
ErrCodeInvalidStakeType throws an error when an invalid stake type is
func ErrCodeInvalidSummaryLength ¶
ErrCodeInvalidSummaryLength throws an error when an invalid body length.
func ErrCodeMaxAmountStakingReached ¶
ErrCodeMaxAmountStakingReached throws an error when you already staked.
func ErrCodeMaxNumOfArgumentsReached ¶
ErrCodeMaxNumOfArgumentsReached throws an error when you already staked.
func ErrCodeMinBalance ¶
ErrCodeMinBalance throws an error when you have the minimum balance.
func ErrCodeUnknownArgument ¶
ErrCodeUnknownArgument throws an error when an invalid argument id
func ErrCodeUnknownClaim ¶
ErrCodeUnknownClaim throws an error when an invalid claim id
func ErrCodeUnknownStake ¶
ErrCodeUnknownStake throws an error when an invalid stake id
func ErrCodeUnknownStakeType ¶
ErrCodeUnknownStakeType throws an error when an invalid stake type
func ErrInvalidQueryParams ¶
ErrInvalidQueryParams throws an error when the transaction type is invalid.
func ErrJSONParse ¶
ErrJSONParse throws an error on failed JSON parsing
func InitGenesis ¶
func InitGenesis(ctx sdk.Context, k Keeper, data GenesisState)
InitGenesis initializes staking state from genesis file
func Interest ¶
Interest takes an annual inflation/interest rate and calculates the return on an amount staked for a given period
func NewHandler ¶
NewHandler creates a new handler for staking module
func RegisterCodec ¶
RegisterCodec registers all the necessary types and interfaces for the module
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the genesis state data
Types ¶
type AccountKeeper ¶
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule defines external data for the module ----------------------------------------------------------------------------
func NewAppModule ¶
NewAppModule creates a NewAppModule object
func (AppModule) BeginBlock ¶
func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock)
BeginBlock returns the begin blocker for the supply module.
func (AppModule) EndBlock ¶
func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate
EndBlock returns the end blocker for the supply module. It returns no validator updates.
func (AppModule) ExportGenesis ¶
func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage
ExportGenesis enforces exporting this module's data to a genesis file
func (AppModule) InitGenesis ¶
func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis enforces the creation of the genesis state for the staking module
func (AppModule) NewHandler ¶
NewHandler creates the handler for the staking module
func (AppModule) NewQuerierHandler ¶
NewQuerierHandler creates a new querier handler
func (AppModule) QuerierRoute ¶
QuerierRoute defines the querier route
func (AppModule) RegisterInvariants ¶
func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)
RegisterInvariants enforces registering of invariants
type AppModuleBasic ¶
type AppModuleBasic struct{}
AppModuleBasic defines the internal data for the module ----------------------------------------------------------------------------
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis creates the default genesis state for testing
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command
GetQueryCmd returns no root query command for the staking module.
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(_ *codec.Codec) *cobra.Command
GetTxCmd returns the root tx command for the staking module.
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)
RegisterCodec registers the types needed for amino encoding/decoding
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
RegisterRESTRoutes registers the REST routes for the staking module.
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
ValidateGenesis validates the genesis state
type Argument ¶
type Argument struct { ID uint64 `json:"id"` Creator sdk.AccAddress `json:"creator"` ClaimID uint64 `json:"claim_id"` CommunityID string `json:"community_id"` Summary string `json:"summary"` Body string `json:"body"` StakeType StakeType `json:"stake_type"` UpvotedCount int `json:"upvoted_count"` UpvotedStake sdk.Coin `json:"upvoted_stake"` TotalStake sdk.Coin `json:"total_stake"` DownvotedCount int `json:"downvoted_count"` IsUnhelpful bool `json:"is_unhelpful"` CreatedTime time.Time `json:"created_time"` UpdatedTime time.Time `json:"updated_time"` EditedTime time.Time `json:"edited_time"` Edited bool `json:"edited"` }
type BankKeeper ¶
type BankKeeper interface { AddCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, txType bankexported.TransactionType, setters ...bankexported.TransactionSetter) (sdk.Coins, sdk.Error) GetCoins(ctx sdk.Context, address sdk.AccAddress) sdk.Coins SubtractCoin(ctx sdk.Context, addr sdk.AccAddress, amt sdk.Coin, referenceID uint64, txType TransactionType, setters ...bankexported.TransactionSetter) (sdk.Coins, sdk.Error) TransactionsByAddress(ctx sdk.Context, address sdk.AccAddress, filterSetters ...bankexported.Filter) []bankexported.Transaction IterateUserTransactions(sdk.Context, sdk.AccAddress, bool, func(tx bankexported.Transaction) bool) }
BankKeeper is the expected bank keeper interface for this module
type ClaimKeeper ¶
type ClaimKeeper interface { Claim(ctx sdk.Context, id uint64) (claim claim.Claim, ok bool) AddBackingStake(ctx sdk.Context, id uint64, stake sdk.Coin) sdk.Error AddChallengeStake(ctx sdk.Context, id uint64, stake sdk.Coin) sdk.Error SubtractBackingStake(ctx sdk.Context, id uint64, stake sdk.Coin) sdk.Error SubtractChallengeStake(ctx sdk.Context, id uint64, stake sdk.Coin) sdk.Error SetFirstArgumentTime(ctx sdk.Context, id uint64, firstArgumentTime time.Time) sdk.Error }
type GenesisState ¶
type GenesisState struct { Arguments []Argument `json:"arguments"` Params Params `json:"params"` Stakes []Stake `json:"stakes"` UsersEarnings []UserEarnedCoins `json:"users_earnings"` }
GenesisState defines genesis data for the module
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state
func ExportGenesis ¶
func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState
ExportGenesis exports the genesis state
func NewGenesisState ¶
func NewGenesisState(arguments []Argument, stakes []Stake, userEarnings []UserEarnedCoins, params Params) GenesisState
NewGenesisState creates a new genesis state.
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper is the model object for the package staking module
func NewKeeper ¶
func NewKeeper(codec *codec.Codec, storeKey sdk.StoreKey, accountKeeper AccountKeeper, bankKeeper BankKeeper, claimKeeper ClaimKeeper, supplyKeeper supply.Keeper, paramStore params.Subspace, codespace sdk.CodespaceType) Keeper
NewKeeper creates a staking keeper.
func (Keeper) ActiveStakeQueueIterator ¶
ActiveStakeQueueIterator returns an sdk.Iterator for all the stakes in the Active Queue that expire by endTime
func (Keeper) ArgumentStakes ¶
func (Keeper) ClaimArguments ¶
func (Keeper) CommunityStakes ¶
func (Keeper) DownvoteArgument ¶
func (Keeper) EditArgument ¶
func (k Keeper) EditArgument(ctx sdk.Context, body, summary string, creator sdk.AccAddress, argumentID uint64) (Argument, sdk.Error)
EditArgument lets a creator edit an argument as long it hasn't been staked on
func (Keeper) InsertActiveStakeQueue ¶
InsertActiveStakeQueue inserts a stakeID into the active stake queue at endTime
func (Keeper) IterateActiveStakeQueue ¶
func (Keeper) IterateAfterCreatedTimeUserStakes ¶
func (Keeper) IterateArgumentStakes ¶
func (Keeper) IterateClaimArguments ¶
func (Keeper) IterateCommunityStakes ¶
func (Keeper) IterateUserArguments ¶
func (Keeper) IterateUserCommunityStakes ¶
func (Keeper) IterateUserEarnedCoins ¶
func (Keeper) IterateUserStakes ¶
func (Keeper) MarkUnhelpfulArgument ¶
func (Keeper) RemoveAdmin ¶
RemoveAdmin removes an admin
func (Keeper) RemoveFromActiveStakeQueue ¶
RemoveFromActiveStakeQueue removes a stakeID from the Active Stake Queue
func (Keeper) SetStakeExpired ¶
func (Keeper) SubmitArgument ¶
func (Keeper) SubmitUpvote ¶
func (Keeper) SubtractEarnedCoin ¶
func (Keeper) TotalEarnedCoins ¶
func (Keeper) UpdateParams ¶
func (k Keeper) UpdateParams(ctx sdk.Context, updater sdk.AccAddress, updates Params, updatedFields []string) sdk.Error
UpdateParams updates the required params
func (Keeper) UserArguments ¶
func (Keeper) UserCommunityStakes ¶
func (Keeper) UserStakes ¶
func (Keeper) UsersEarnings ¶
func (k Keeper) UsersEarnings(ctx sdk.Context) []UserEarnedCoins
type MsgAddAdmin ¶
type MsgAddAdmin struct { Admin sdk.AccAddress `json:"admin"` Creator sdk.AccAddress `json:"creator"` }
MsgAddAdmin defines the message to add a new admin
func NewMsgAddAdmin ¶
func NewMsgAddAdmin(admin, creator sdk.AccAddress) MsgAddAdmin
NewMsgAddAdmin returns the messages to add a new admin
func (MsgAddAdmin) GetSignBytes ¶
func (msg MsgAddAdmin) GetSignBytes() []byte
GetSignBytes implements Msg
func (MsgAddAdmin) GetSigners ¶
func (msg MsgAddAdmin) GetSigners() []sdk.AccAddress
GetSigners implements Msg. Returns the creator as the signer.
func (MsgAddAdmin) ValidateBasic ¶
func (msg MsgAddAdmin) ValidateBasic() sdk.Error
ValidateBasic implements Msg
type MsgDeleteArgument ¶
type MsgDeleteArgument struct { ArgumentID uint64 `json:"argument_id"` Creator sdk.AccAddress `json:"creator"` }
MsgDeleteArgument msg for deleting an argument.
func (MsgDeleteArgument) GetSignBytes ¶
func (msg MsgDeleteArgument) GetSignBytes() []byte
GetSignBytes gets the bytes for Msg signer to sign on
func (MsgDeleteArgument) GetSigners ¶
func (msg MsgDeleteArgument) GetSigners() []sdk.AccAddress
GetSigners gets the signs of the Msg
func (MsgDeleteArgument) Route ¶
func (MsgDeleteArgument) Route() string
func (MsgDeleteArgument) Type ¶
func (MsgDeleteArgument) Type() string
func (MsgDeleteArgument) ValidateBasic ¶
func (msg MsgDeleteArgument) ValidateBasic() sdk.Error
type MsgEditArgument ¶
type MsgEditArgument struct { Creator sdk.AccAddress `json:"creator"` ArgumentID uint64 `json:"argument_id"` Summary string `json:"summary"` Body string `json:"body"` }
MsgEditArgument msg for creating an argument.
func NewMsgEditArgument ¶
func NewMsgEditArgument(creator sdk.AccAddress, argumentID uint64, summary string, body string) MsgEditArgument
NewMsgEditArgument returns a new edit argument message.
func (MsgEditArgument) GetSignBytes ¶
func (msg MsgEditArgument) GetSignBytes() []byte
GetSignBytes gets the bytes for Msg signer to sign on
func (MsgEditArgument) GetSigners ¶
func (msg MsgEditArgument) GetSigners() []sdk.AccAddress
GetSigners gets the address of the signer of the Msg
func (MsgEditArgument) Route ¶
func (MsgEditArgument) Route() string
func (MsgEditArgument) Type ¶
func (MsgEditArgument) Type() string
func (MsgEditArgument) ValidateBasic ¶
func (msg MsgEditArgument) ValidateBasic() sdk.Error
type MsgRemoveAdmin ¶
type MsgRemoveAdmin struct { Admin sdk.AccAddress `json:"admin"` Remover sdk.AccAddress `json:"remover"` }
MsgRemoveAdmin defines the message to remove an admin
func NewMsgRemoveAdmin ¶
func NewMsgRemoveAdmin(admin, remover sdk.AccAddress) MsgRemoveAdmin
NewMsgRemoveAdmin returns the messages to remove an admin
func (MsgRemoveAdmin) GetSignBytes ¶
func (msg MsgRemoveAdmin) GetSignBytes() []byte
GetSignBytes implements Msg
func (MsgRemoveAdmin) GetSigners ¶
func (msg MsgRemoveAdmin) GetSigners() []sdk.AccAddress
GetSigners implements Msg. Returns the remover as the signer.
func (MsgRemoveAdmin) ValidateBasic ¶
func (msg MsgRemoveAdmin) ValidateBasic() sdk.Error
ValidateBasic implements Msg
type MsgSubmitArgument ¶
type MsgSubmitArgument struct { ClaimID uint64 `json:"claim_id"` Summary string `json:"summary"` Body string `json:"body"` StakeType StakeType `json:"stake_type"` Creator sdk.AccAddress `json:"creator"` }
MsgSubmitArgument msg for creating an argument.
func NewMsgSubmitArgument ¶
func NewMsgSubmitArgument(creator sdk.AccAddress, claimID uint64, summary, body string, stakeType StakeType) MsgSubmitArgument
NewMsgSubmitArgument returns a new submit argument message.
func (MsgSubmitArgument) GetSignBytes ¶
func (msg MsgSubmitArgument) GetSignBytes() []byte
GetSignBytes gets the bytes for Msg signer to sign on
func (MsgSubmitArgument) GetSigners ¶
func (msg MsgSubmitArgument) GetSigners() []sdk.AccAddress
GetSigners gets the signs of the Msg
func (MsgSubmitArgument) Route ¶
func (MsgSubmitArgument) Route() string
func (MsgSubmitArgument) Type ¶
func (MsgSubmitArgument) Type() string
func (MsgSubmitArgument) ValidateBasic ¶
func (msg MsgSubmitArgument) ValidateBasic() sdk.Error
type MsgSubmitUpvote ¶
type MsgSubmitUpvote struct { ArgumentID uint64 `json:"argument_id"` Creator sdk.AccAddress `json:"creator"` }
MsgSubmitUpvote msg for upvoting an argument.
func NewMsgSubmitUpvote ¶
func NewMsgSubmitUpvote(creator sdk.AccAddress, argumentID uint64) MsgSubmitUpvote
func (MsgSubmitUpvote) GetSignBytes ¶
func (msg MsgSubmitUpvote) GetSignBytes() []byte
GetSignBytes gets the bytes for Msg signer to sign on
func (MsgSubmitUpvote) GetSigners ¶
func (msg MsgSubmitUpvote) GetSigners() []sdk.AccAddress
GetSigners gets the signs of the Msg
func (MsgSubmitUpvote) Route ¶
func (MsgSubmitUpvote) Route() string
func (MsgSubmitUpvote) Type ¶
func (MsgSubmitUpvote) Type() string
func (MsgSubmitUpvote) ValidateBasic ¶
func (msg MsgSubmitUpvote) ValidateBasic() sdk.Error
type MsgUpdateParams ¶
type MsgUpdateParams struct { Updates Params `json:"updates"` UpdatedFields []string `json:"updated_fields"` Updater sdk.AccAddress `json:"updater"` }
MsgUpdateParams defines the message to remove an admin
func NewMsgUpdateParams ¶
func NewMsgUpdateParams(updates Params, updatedFields []string, updater sdk.AccAddress) MsgUpdateParams
NewMsgUpdateParams returns the message to update the params
func (MsgUpdateParams) GetSignBytes ¶
func (msg MsgUpdateParams) GetSignBytes() []byte
GetSignBytes implements Msg
func (MsgUpdateParams) GetSigners ¶
func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress
GetSigners implements Msg. Returns the remover as the signer.
func (MsgUpdateParams) ValidateBasic ¶
func (msg MsgUpdateParams) ValidateBasic() sdk.Error
ValidateBasic implements Msg
type Params ¶
type Params struct { Period time.Duration `json:"period"` ArgumentCreationStake sdk.Coin `json:"argument_creation_stake"` ArgumentBodyMaxLength int `json:"argument_body_max_length"` ArgumentBodyMinLength int `json:"argument_body_min_length"` ArgumentSummaryMaxLength int `json:"argument_summary_max_length"` ArgumentSummaryMinLength int `json:"argument_summary_min_length"` UpvoteStake sdk.Coin `json:"upvote_stake"` InterestRate sdk.Dec `json:"interest_rate"` StakingAdmins []sdk.AccAddress `json:"staking_admins"` // deprecated StakeLimitPercent sdk.Dec `json:"stake_limit_percent"` // deprecated StakeLimitDays time.Duration `json:"stake_limit_days"` UnjailUpvotes int `json:"unjail_upvotes"` MaxArgumentsPerClaim int `json:"max_arguments_per_claim"` }
func DefaultParams ¶
func DefaultParams() Params
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
type QueryArgumentStakesParams ¶
type QueryArgumentStakesParams struct {
ArgumentID uint64 `json:"argument_id"`
}
type QueryArgumentsByIDsParams ¶
type QueryArgumentsByIDsParams struct {
ArgumentIDs []uint64 `json:"argument_ids"`
}
type QueryClaimArgumentParams ¶
type QueryClaimArgumentParams struct {
ArgumentID uint64 `json:"argument_id"`
}
type QueryClaimArgumentsParams ¶
type QueryClaimArgumentsParams struct {
ClaimID uint64 `json:"claim_id"`
}
type QueryClaimTopArgumentParams ¶
type QueryClaimTopArgumentParams struct {
ClaimID uint64 `json:"claim_id"`
}
type QueryCommunityStakesParams ¶
type QueryCommunityStakesParams struct {
CommunityID string `json:"community_id"`
}
type QueryEarnedCoinsParams ¶
type QueryEarnedCoinsParams struct {
Address sdk.AccAddress `json:"address"`
}
type QueryStakeParams ¶
type QueryStakeParams struct {
StakeID uint64 `json:"stake_id"`
}
type QueryTotalEarnedCoinsParams ¶
type QueryTotalEarnedCoinsParams struct {
Address sdk.AccAddress `json:"address"`
}
type QueryUserArgumentsParams ¶
type QueryUserArgumentsParams struct {
Address sdk.AccAddress `json:"address"`
}
type QueryUserCommunityStakesParams ¶
type QueryUserCommunityStakesParams struct { Address sdk.AccAddress `json:"address"` CommunityID string `json:"community_id"` }
type QueryUserStakesParams ¶
type QueryUserStakesParams struct {
Address sdk.AccAddress `json:"address"`
}
type RewardResult ¶
type RewardResult struct { Type RewardResultType `json:"type"` ArgumentCreator sdk.AccAddress `json:"argument_creator"` ArgumentCreatorReward sdk.Coin `json:"argument_creator_reward"` StakeCreator sdk.AccAddress `json:"stake_creator"` StakeCreatorReward sdk.Coin `json:"stake_creator_reward"` }
type RewardResultType ¶
type RewardResultType byte
const ( RewardResultArgumentCreation RewardResultType = iota RewardResultUpvoteSplit )
type Stake ¶
type Stake struct { ID uint64 `json:"id"` ArgumentID uint64 `json:"argument_id"` CommunityID string `json:"community_id"` Type StakeType `json:"type"` Amount sdk.Coin `json:"amount"` Creator sdk.AccAddress `json:"creator"` CreatedTime time.Time `json:"created_time"` EndTime time.Time `json:"end_time"` Expired bool `json:"expired"` Result *RewardResult `json:"result,omitempty"` }
type StakeLimitUpgrade ¶
type StakeLimitUpgrade struct { Address sdk.AccAddress `json:"address"` NewLimit int `json:"new_limit"` EarnedStake sdk.Coin `json:"earned_stake"` }
type StakeType ¶
type StakeType byte
func (StakeType) BankTransactionType ¶
func (t StakeType) BankTransactionType() bank.TransactionType
func (StakeType) ValidForArgument ¶
func (StakeType) ValidForUpvote ¶
type TransactionType ¶
type TransactionType = exported.TransactionType
type UserEarnedCoins ¶
type UserEarnedCoins struct { Address sdk.AccAddress `json:"address"` Coins sdk.Coins `json:"coins"` }