Documentation ¶
Index ¶
- Variables
- func GetTokensInVesting(ctx sdk.Context, k wasmtypes.ViewKeeper, contractAddr sdk.AccAddress) (map[string]sdkmath.Int, sdkmath.Int, error)
- func MustGetTokensInVesting(ctx sdk.Context, k wasmtypes.ViewKeeper, contractAddr sdk.AccAddress) (map[string]sdkmath.Int, sdkmath.Int)
- func NewLegacyMsgServerImpl(govAcct string, server govv1.MsgServer) govv1beta1.MsgServer
- func NewLegacyQueryServerImpl(qs govv1.QueryServer) govv1beta1.QueryServer
- func NewMsgServerImpl(k Keeper) govv1.MsgServer
- func NewQueryServerImpl(k Keeper) govv1.QueryServer
- type Keeper
Constants ¶
This section is empty.
Variables ¶
var DefaultContractAddr = wasmkeeper.BuildContractAddressClassic(1, 1)
DefaultContractAddr is the wasm contract address generated by code ID 1 and instance ID 1.
In other words, the first ever contract to be deployed on this chain will necessarily have this address.
Why don't we make this a configurable parameter in the module params? Because doing so involves messing with the vanilla gov module's params type, which breaks a bunch of code and imo, isn't worth it.
Functions ¶
func GetTokensInVesting ¶
func GetTokensInVesting(ctx sdk.Context, k wasmtypes.ViewKeeper, contractAddr sdk.AccAddress) (map[string]sdkmath.Int, sdkmath.Int, error)
GetTokensInVesting queries the vesting contract for an array of users who have tokens locked in the contract and their respective amount, as well as computing the total amount of locked tokens.
func MustGetTokensInVesting ¶
func MustGetTokensInVesting(ctx sdk.Context, k wasmtypes.ViewKeeper, contractAddr sdk.AccAddress) (map[string]sdkmath.Int, sdkmath.Int)
MustGetTokensInVesting is the same with `GetTokensInVesting`, but panics on error.
func NewLegacyMsgServerImpl ¶
func NewLegacyMsgServerImpl(govAcct string, server govv1.MsgServer) govv1beta1.MsgServer
NewMsgServerImpl creates an implementation of the gov v1 MsgServer interface for the given keeper.
func NewLegacyQueryServerImpl ¶
func NewLegacyQueryServerImpl(qs govv1.QueryServer) govv1beta1.QueryServer
NewQueryServerImpl creates an implementation of the QueryServer interface for the given keeper
func NewMsgServerImpl ¶
NewMsgServerImpl creates an implementation of the gov v1 MsgServer interface for the given keeper.
func NewQueryServerImpl ¶
func NewQueryServerImpl(k Keeper) govv1.QueryServer
NewQueryServerImpl creates an implementation of the QueryServer interface for the given keeper.
Types ¶
type Keeper ¶
Keeper defines the custom governance module Keeper
NOTE: Keeper wraps the vanilla gov keeper to inherit most of its functions. However, we include an additional dependency, the wasm keeper, which is needed for our custom vote tallying logic.
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace govtypes.ParamSubspace, accountKeeper govtypes.AccountKeeper, bankKeeper govtypes.BankKeeper, stakingKeeper govtypes.StakingKeeper, wasmKeeper wasmtypes.ViewKeeper, legacyRouter govv1beta1.Router, router *baseapp.MsgServiceRouter, config govtypes.Config, ) Keeper
NewKeeper returns a custom gov keeper
NOTE: compared to the vanilla gov keeper's constructor function, here we require an additional wasm keeper, which is needed for our custom vote tallying logic.
func (Keeper) Tally ¶
func (k Keeper) Tally(ctx sdk.Context, proposal govv1.Proposal) (passes bool, burnDeposits bool, tallyResults govv1.TallyResult)
Tally iterates over the votes and updates the tally of a proposal based on the voting power of the voters.
NOTE: here the voting power of a user is defined as: amount of MARS tokens staked + amount locked in vesting.