staking

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2019 License: Apache-2.0 Imports: 21 Imported by: 2

Documentation

Index

Constants

View Source
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

View Source
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.

View Source
const (
	ErrInvalidArgumentStakeDenom = Error("invalid denomination for argument stake")
	ErrInvalidUpvoteStakeDenom   = Error("invalid denomination for upvote stake")
)

GenesisErrors

View Source
const (
	TypeMsgSubmitArgument = "submit_argument"
	TypeMsgSubmitUpvote   = "submit_upvote"
	TypeMsgDeleteArgument = "delete_argument"
	TypeMsgEditArgument   = "edit_argument"
	TypeMsgAddAdmin       = "add_admin"
	TypeMsgRemoveAdmin    = "remove_admin"
	TypeMsgUpdateParams   = "update_params"
)
View Source
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"
)
View Source
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

View Source
const ModuleName = "trustaking"

ModuleName is the name of this module

Variables

View Source
var (
	WithCommunityID   = exported.WithCommunityID
	FromModuleAccount = exported.FromModuleAccount
	ToModuleAccount   = exported.ToModuleAccount
)

Transaction setters

View Source
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

View Source
var (
	ParamKeyPeriod                   = []byte("period")
	ParamKeyArgumentCreationStake    = []byte("argumentCreationStake")
	ParamKeyArgumentBodyMaxLength    = []byte("argumentBodyMaxLength")
	ParamKeyArgumentBodyMinLength    = []byte("argumentBodyMinLength")
	ParamKeyArgumentSummaryMaxLength = []byte("argumentSummaryMaxLength")
	ParamKeyArgumentSummaryMinLength = []byte("argumentSummaryMinLength")
	ParamKeyUpvoteStake              = []byte("upvoteStake")
	ParamKeyCreatorShare             = []byte("creatorShare")
	ParamKeyInterestRate             = []byte("interestRate")
	ParamKeyStakingAdmins            = []byte("stakingAdmins")
	ParamKeyStakeLimitPercent        = []byte("stakeLimitPercent")
	ParamKeyStakeLimitDays           = []byte("stakeLimitDays")
	ParamKeyUnjailUpvotes            = []byte("unjailUpvotes")
	ParamKeyMaxArgumentsPerClaim     = []byte("maxArgumentsPerClaim")
)
View Source
var ModuleCodec *codec.Codec

ModuleCodec encodes module codec

View Source
var StakeTypeName = []string{
	StakeBacking:   "StakeBacking",
	StakeChallenge: "StakeChallenge",
	StakeUpvote:    "StakeUpvote",
}

Functions

func EndBlocker

func EndBlocker(ctx sdk.Context, keeper Keeper)

EndBlocker called every block, process expiring stakes

func ErrAddressNotAuthorised

func ErrAddressNotAuthorised() sdk.Error

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

func ErrCodeCannotEditArgumentAlreadyStaked(argumentID uint64) sdk.Error

ErrCodeCannotEditArgumentAlreadyStaked throws an error when an argument cannot be edited because it has already been staked

func ErrCodeCannotEditArgumentWrongCreator

func ErrCodeCannotEditArgumentWrongCreator(argumentID uint64) sdk.Error

ErrCodeCannotEditArgumentWrongCreator throws an error when an argument cannot be edited because the edit is not coming from the creator

func ErrCodeDuplicateStake

func ErrCodeDuplicateStake(argumentID uint64) sdk.Error

ErrCodeDuplicateStake throws an error when you already staked.

func ErrCodeInvalidBodyLength

func ErrCodeInvalidBodyLength() sdk.Error

ErrCodeInvalidBodyLength throws an error when an invalid body length.

func ErrCodeInvalidStakeType

func ErrCodeInvalidStakeType(stakeType StakeType) sdk.Error

ErrCodeInvalidStakeType throws an error when an invalid stake type is

func ErrCodeInvalidSummaryLength

func ErrCodeInvalidSummaryLength() sdk.Error

ErrCodeInvalidSummaryLength throws an error when an invalid body length.

func ErrCodeMaxAmountStakingReached

func ErrCodeMaxAmountStakingReached() sdk.Error

ErrCodeMaxAmountStakingReached throws an error when you already staked.

func ErrCodeMaxNumOfArgumentsReached

func ErrCodeMaxNumOfArgumentsReached(max int) sdk.Error

ErrCodeMaxNumOfArgumentsReached throws an error when you already staked.

func ErrCodeMinBalance

func ErrCodeMinBalance() sdk.Error

ErrCodeMinBalance throws an error when you have the minimum balance.

func ErrCodeUnknownArgument

func ErrCodeUnknownArgument(argumentID uint64) sdk.Error

ErrCodeUnknownArgument throws an error when an invalid argument id

func ErrCodeUnknownClaim

func ErrCodeUnknownClaim(claimID uint64) sdk.Error

ErrCodeUnknownClaim throws an error when an invalid claim id

func ErrCodeUnknownStake

func ErrCodeUnknownStake(stakeID uint64) sdk.Error

ErrCodeUnknownStake throws an error when an invalid stake id

func ErrCodeUnknownStakeType

func ErrCodeUnknownStakeType() sdk.Error

ErrCodeUnknownStakeType throws an error when an invalid stake type

func ErrInvalidQueryParams

func ErrInvalidQueryParams(err error) sdk.Error

ErrInvalidQueryParams throws an error when the transaction type is invalid.

func ErrJSONParse

func ErrJSONParse(err error) sdk.Error

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

func Interest(interestRate sdk.Dec, amount sdk.Coin, period time.Duration) sdk.Dec

Interest takes an annual inflation/interest rate and calculates the return on an amount staked for a given period

func NewHandler

func NewHandler(keeper Keeper) sdk.Handler

NewHandler creates a new handler for staking module

func NewQuerier

func NewQuerier(keeper Keeper) sdk.Querier

NewQuerier creates a new querier

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable for staking module

func RegisterCodec

func RegisterCodec(c *codec.Codec)

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 AccountKeeper interface {
	IsJailed(ctx sdk.Context, address sdk.AccAddress) (bool, sdk.Error)
	UnJail(ctx sdk.Context, address sdk.AccAddress) sdk.Error
	IterateAppAccounts(ctx sdk.Context, cb func(acc account.AppAccount) (stop bool))
}

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule defines external data for the module ----------------------------------------------------------------------------

func NewAppModule

func NewAppModule(keeper Keeper) AppModule

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

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

func (am AppModule) NewHandler() sdk.Handler

NewHandler creates the handler for the staking module

func (AppModule) NewQuerierHandler

func (am AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler creates a new querier handler

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute defines the querier route

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

RegisterInvariants enforces registering of invariants

func (AppModule) Route

func (AppModule) Route() string

Route defines the key for the route

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) Name

func (AppModuleBasic) Name() string

Name define the name of the 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 Error

type Error string

func (Error) Error

func (e Error) Error() string

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

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

ActiveStakeQueueIterator returns an sdk.Iterator for all the stakes in the Active Queue that expire by endTime

func (Keeper) AddAdmin

func (k Keeper) AddAdmin(ctx sdk.Context, admin, creator sdk.AccAddress) (err sdk.Error)

AddAdmin adds a new admin

func (Keeper) Argument

func (k Keeper) Argument(ctx sdk.Context, argumentID uint64) (Argument, bool)

func (Keeper) ArgumentStakes

func (k Keeper) ArgumentStakes(ctx sdk.Context, argumentID uint64) []Stake

func (Keeper) Arguments

func (k Keeper) Arguments(ctx sdk.Context) []Argument

func (Keeper) ClaimArguments

func (k Keeper) ClaimArguments(ctx sdk.Context, claimID uint64) []Argument

func (Keeper) CommunityStakes

func (k Keeper) CommunityStakes(ctx sdk.Context, communityID string) []Stake

func (Keeper) DownvoteArgument

func (k Keeper) DownvoteArgument(ctx sdk.Context, argumentID uint64) sdk.Error

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) GetParams

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

GetParams gets the genesis params for the staking module

func (Keeper) InsertActiveStakeQueue

func (k Keeper) InsertActiveStakeQueue(ctx sdk.Context, stakeID uint64, endTime time.Time)

InsertActiveStakeQueue inserts a stakeID into the active stake queue at endTime

func (Keeper) IterateActiveStakeQueue

func (k Keeper) IterateActiveStakeQueue(ctx sdk.Context, endTime time.Time, cb func(stake Stake) (stop bool))

func (Keeper) IterateAfterCreatedTimeUserStakes

func (k Keeper) IterateAfterCreatedTimeUserStakes(ctx sdk.Context,
	creator sdk.AccAddress, createdTime time.Time,
	cb func(stake Stake) (stop bool))

func (Keeper) IterateArgumentStakes

func (k Keeper) IterateArgumentStakes(ctx sdk.Context, argumentID uint64, cb func(stake Stake) (stop bool))

func (Keeper) IterateClaimArguments

func (k Keeper) IterateClaimArguments(ctx sdk.Context, claimID uint64, cb func(argument Argument) (stop bool))

func (Keeper) IterateCommunityStakes

func (k Keeper) IterateCommunityStakes(ctx sdk.Context, communityID string, cb func(stake Stake) (stop bool))

func (Keeper) IterateUserArguments

func (k Keeper) IterateUserArguments(ctx sdk.Context, creator sdk.AccAddress, cb func(argument Argument) (stop bool))

func (Keeper) IterateUserCommunityStakes

func (k Keeper) IterateUserCommunityStakes(ctx sdk.Context, creator sdk.AccAddress, communityID string, cb func(stake Stake) (stop bool))

func (Keeper) IterateUserEarnedCoins

func (k Keeper) IterateUserEarnedCoins(ctx sdk.Context, cb userEarnedCoinsCallback)

func (Keeper) IterateUserStakes

func (k Keeper) IterateUserStakes(ctx sdk.Context, creator sdk.AccAddress, cb func(stake Stake) (stop bool))

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MarkUnhelpfulArgument

func (k Keeper) MarkUnhelpfulArgument(ctx sdk.Context, argumentID uint64) sdk.Error

func (Keeper) RemoveAdmin

func (k Keeper) RemoveAdmin(ctx sdk.Context, admin, remover sdk.AccAddress) (err sdk.Error)

RemoveAdmin removes an admin

func (Keeper) RemoveFromActiveStakeQueue

func (k Keeper) RemoveFromActiveStakeQueue(ctx sdk.Context, stakeID uint64, endTime time.Time)

RemoveFromActiveStakeQueue removes a stakeID from the Active Stake Queue

func (Keeper) SetParams

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

SetParams sets the params for staking module

func (Keeper) SetStakeExpired

func (k Keeper) SetStakeExpired(ctx sdk.Context, stakeID uint64) sdk.Error

func (Keeper) Stake

func (k Keeper) Stake(ctx sdk.Context, stakeID uint64) (Stake, bool)

func (Keeper) Stakes

func (k Keeper) Stakes(ctx sdk.Context) []Stake

func (Keeper) SubmitArgument

func (k Keeper) SubmitArgument(ctx sdk.Context, body, summary string,
	creator sdk.AccAddress, claimID uint64, stakeType StakeType) (Argument, sdk.Error)

func (Keeper) SubmitUpvote

func (k Keeper) SubmitUpvote(ctx sdk.Context, argumentID uint64, creator sdk.AccAddress) (Stake, sdk.Error)

func (Keeper) SubtractEarnedCoin

func (k Keeper) SubtractEarnedCoin(ctx sdk.Context, user sdk.AccAddress, communityID string, amount sdk.Int)

func (Keeper) TotalEarnedCoins

func (k Keeper) TotalEarnedCoins(ctx sdk.Context, creator sdk.AccAddress) sdk.Int

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 (k Keeper) UserArguments(ctx sdk.Context, address sdk.AccAddress) []Argument

func (Keeper) UserCommunityStakes

func (k Keeper) UserCommunityStakes(ctx sdk.Context, address sdk.AccAddress, communityID string) []Stake

func (Keeper) UserStakes

func (k Keeper) UserStakes(ctx sdk.Context, address sdk.AccAddress) []Stake

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) Route

func (msg MsgAddAdmin) Route() string

Route implements Msg

func (MsgAddAdmin) Type

func (msg MsgAddAdmin) Type() string

Type implements Msg

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) Route

func (msg MsgRemoveAdmin) Route() string

Route implements Msg

func (MsgRemoveAdmin) Type

func (msg MsgRemoveAdmin) Type() string

Type implements Msg

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) Route

func (msg MsgUpdateParams) Route() string

Route implements Msg

func (MsgUpdateParams) Type

func (msg MsgUpdateParams) Type() string

Type implements Msg

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"`
	CreatorShare             sdk.Dec          `json:"creator_share"`
	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"`
}

func (Stake) String

func (s Stake) String() string

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
const (
	StakeBacking StakeType = iota
	StakeChallenge
	StakeUpvote
)

func (StakeType) BankTransactionType

func (t StakeType) BankTransactionType() bank.TransactionType

func (StakeType) String

func (t StakeType) String() string

func (StakeType) Valid

func (t StakeType) Valid() bool

func (StakeType) ValidForArgument

func (t StakeType) ValidForArgument() bool

func (StakeType) ValidForUpvote

func (t StakeType) ValidForUpvote() bool

type TransactionType

type TransactionType = exported.TransactionType

type UserEarnedCoins

type UserEarnedCoins struct {
	Address sdk.AccAddress `json:"address"`
	Coins   sdk.Coins      `json:"coins"`
}

Jump to

Keyboard shortcuts

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