vote

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

README

x/vote Module

This is an implementation of a governance module with an elected government and community polls

It includes functionalities for creating votes, counting votes for a particular proposal, and performing actions based on vote results.

Documentation

Index

Constants

View Source
const (
	ModuleName = types.ModuleName
)

Variables

View Source
var (
	// functions aliases
	DefaultGenesisState = types.DefaultGenesisState
	ValidateGenesis     = types.ValidateGenesis
)

Functions

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k keeper.Keeper) (data *types.GenesisState)

ExportGenesis writes the current store values to a genesis file, which can be imported again with InitGenesis

func InitGenesis

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

InitGenesis initialize default parameters and the keeper's address to pubkey map

Types

type AppModule

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

AppModule implements an application module for the vote module.

func NewAppModule

func NewAppModule(cdc codec.Codec, k keeper.Keeper,
	referralKeeper types.ReferralKeeper,
) AppModule

NewAppModule creates a new AppModule object

func (AppModule) AutoCLIOptions

func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions

AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx context.Context) error

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context, mrshl codec.JSONCodec) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the vote module.

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, mrshl codec.JSONCodec, data json.RawMessage)

InitGenesis performs genesis initialization for the vote module. It returns no validator updates.

func (AppModule) IsAppModule

func (am AppModule) IsAppModule()

IsAppModule implements the appmodule.AppModule interface.

func (AppModule) IsOnePerModuleType

func (am AppModule) IsOnePerModuleType()

IsOnePerModuleType implements the depinject.OnePerModuleType interface.

func (AppModule) Name

func (AppModule) Name() string

Name returns the vote module's name.

func (AppModule) RegisterInvariants

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

RegisterInvariants registers the vote module invariants.

func (AppModule) RegisterServices

func (am AppModule) RegisterServices(cfg module.Configurator)

type AppModuleBasic

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

AppModuleBasic defines the basic application module used by the vote module.

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the vote module.

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns no root query command for the vote module.

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the root tx command for the vote module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the vote module's name.

func (AppModuleBasic) RegisterGRPCGatewayRoutes

func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)

func (AppModuleBasic) RegisterInterfaces

func (AppModuleBasic) RegisterInterfaces(registry codecTypes.InterfaceRegistry)

func (AppModuleBasic) RegisterLegacyAminoCodec

func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterCodec registers the vote module's types for the given codec.

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router)

RegisterRESTRoutes registers the REST routes for the vote module.

func (AppModuleBasic) ValidateGenesis

ValidateGenesis performs genesis state validation for the vote module.

type GenesisState

type GenesisState = types.GenesisState

type Keeper

type Keeper = keeper.Keeper

type ModuleInputs

type ModuleInputs struct {
	depinject.In

	Config         *modulev1.Module
	StoreService   store.KVStoreService
	Cdc            codec.Codec
	ReferralKeeper types.ReferralKeeper
	AccountKeeper  types.AccountKeeper

	MsgServiceRouter baseapp.MessageRouter
}

type ModuleOutputs

type ModuleOutputs struct {
	depinject.Out

	VoteKeeper keeper.Keeper
	Module     appmodule.AppModule
}

func ProvideModule

func ProvideModule(in ModuleInputs) ModuleOutputs

type Params

type Params = types.Params

Directories

Path Synopsis
client
cli

Jump to

Keyboard shortcuts

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