incentive

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2019 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeSpaceIncentive sdk.CodespaceType = "incentive"

	// 701 ~ 799
	CodeInvalidAdjustmentHeight      sdk.CodeType = 701
	CodeInvalidDefaultRewardPerBlock sdk.CodeType = 702
	CodeInvalidPlanHeight            sdk.CodeType = 703
	CodeInvalidRewardPerBlock        sdk.CodeType = 704
	CodeInvalidTotalIncentive        sdk.CodeType = 705
)
View Source
const (
	RouterKey = "incentive"
	StoreKey  = RouterKey
)
View Source
const (
	ModuleName        = "incentive"
	QuerierRoute      = ModuleName
	DefaultParamspace = ModuleName
)

Variables

View Source
var (
	KeyIncentiveDefaultRewardPerBlock = []byte("incentiveDefaultRewardPerBlock")
	KeyIncentivePlans                 = []byte("incentivePlans")
)
View Source
var ModuleCdc = codec.New()
View Source
var (
	PoolAddr = sdk.AccAddress(crypto.AddressHash([]byte("incentive_pool")))
)
View Source
var (
	StateKey = []byte{0x01}
)

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k Keeper) sdk.Error

func InitGenesis added in v0.0.2

func InitGenesis(ctx sdk.Context, keeper Keeper, data GenesisState)

InitGenesis - Init store state from genesis data

func ParamKeyTable added in v0.0.2

func ParamKeyTable() params.KeyTable

ParamKeyTable type declaration for parameters

func RegisterCodec added in v0.0.2

func RegisterCodec(cdc *codec.Codec)

Types

type AppModule added in v0.0.4

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

___________________________ app module object

func NewAppModule added in v0.0.4

func NewAppModule(incentiveKeeper Keeper) AppModule

NewAppModule creates a new AppModule object

func (AppModule) BeginBlock added in v0.0.4

func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)

module begin-block

func (AppModule) EndBlock added in v0.0.4

module end-block

func (AppModule) ExportGenesis added in v0.0.4

func (am AppModule) ExportGenesis(ctx sdk.Context) json.RawMessage

module export genesis

func (AppModule) InitGenesis added in v0.0.4

func (am AppModule) InitGenesis(ctx sdk.Context, data json.RawMessage) []abci.ValidatorUpdate

module init-genesis

func (AppModule) Name added in v0.0.4

func (AppModule) Name() string

module name

func (AppModule) NewHandler added in v0.0.4

func (AppModule) NewHandler() sdk.Handler

module handler

func (AppModule) NewQuerierHandler added in v0.0.4

func (am AppModule) NewQuerierHandler() sdk.Querier

module querier

func (AppModule) QuerierRoute added in v0.0.4

func (AppModule) QuerierRoute() string

module querier route name

func (AppModule) RegisterInvariants added in v0.0.4

func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

register invariants

func (AppModule) Route added in v0.0.4

func (AppModule) Route() string

module message route name

type AppModuleBasic added in v0.0.4

type AppModuleBasic struct {
}

app module basics object

func (AppModuleBasic) DefaultGenesis added in v0.0.4

func (AppModuleBasic) DefaultGenesis() json.RawMessage

default genesis state

func (AppModuleBasic) GetQueryCmd added in v0.0.4

func (amb AppModuleBasic) GetQueryCmd(cdc *codec.Codec) *cobra.Command

get the root query command of this module

func (AppModuleBasic) GetTxCmd added in v0.0.4

func (amb AppModuleBasic) GetTxCmd(cdc *codec.Codec) *cobra.Command

get the root tx command of this module

func (AppModuleBasic) Name added in v0.0.4

func (AppModuleBasic) Name() string

module name

func (AppModuleBasic) RegisterCodec added in v0.0.4

func (AppModuleBasic) RegisterCodec(cdc *codec.Codec)

register module codec

func (AppModuleBasic) RegisterRESTRoutes added in v0.0.4

func (amb AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)

register rest routes

func (AppModuleBasic) ValidateGenesis added in v0.0.4

func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error

module validate genesis

type GenesisState added in v0.0.2

type GenesisState struct {
	State State  `json:"state"`
	Param Params `json:"params"`
}

GenesisState - all asset state that must be provided at genesis

func DefaultGenesisState added in v0.0.2

func DefaultGenesisState() GenesisState

DefaultGenesisState - Return a default genesis state

func ExportGenesis added in v0.0.2

func ExportGenesis(ctx sdk.Context, keeper Keeper) GenesisState

ExportGenesis returns a GenesisState for a given context and keeper

func NewGenesisState added in v0.0.2

func NewGenesisState(state State, param Params) GenesisState

NewGenesisState - Create a new genesis state

func (GenesisState) ValidateGenesis added in v0.0.4

func (data GenesisState) ValidateGenesis() error

ValidateGenesis performs basic validation of asset genesis data returning an error for any failed validation criteria.

type Keeper

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

func NewKeeper

func NewKeeper(cdc *codec.Codec, key sdk.StoreKey, paramSubspace params.Subspace,
	bk types.BankKeeper, supplyKeeper authtypes.SupplyKeeper, feeCollectorName string) Keeper

func (Keeper) AddNewPlan added in v0.0.2

func (k Keeper) AddNewPlan(ctx sdk.Context, plan Plan)

func (Keeper) GetParam added in v0.0.2

func (k Keeper) GetParam(ctx sdk.Context) (param Params)

func (Keeper) GetState added in v0.0.2

func (k Keeper) GetState(ctx sdk.Context) (state State)

func (Keeper) SetParam added in v0.0.2

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

func (Keeper) SetState added in v0.0.2

func (k Keeper) SetState(ctx sdk.Context, state State) sdk.Error

type Params added in v0.0.2

type Params struct {
	DefaultRewardPerBlock uint16 `json:"default_reward_per_block"`
	Plans                 []Plan `json:"plans"`
}

func DefaultParams added in v0.0.2

func DefaultParams() Params

func (*Params) ParamSetPairs added in v0.0.2

func (p *Params) ParamSetPairs() params.ParamSetPairs

type Plan added in v0.0.2

type Plan struct {
	StartHeight    int64 `json:"start_height"`
	EndHeight      int64 `json:"end_height"`
	RewardPerBlock int64 `json:"reward_per_block"`
	TotalIncentive int64 `json:"total_incentive"`
}

type State added in v0.0.2

type State struct {
	HeightAdjustment int64 `json:"height_adjustment"`
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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