types

package
v0.1.0-mage.1 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package types is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	EventTypeMint = ModuleName

	AttributeKeyTotalSupply       = "total_supply"
	AttributeKeyTotalBonded       = "total_bonded"
	AttributeSecondsPassed        = "seconds_since_last_mint"
	AttributeKeyCommunityPoolMint = "minted_community_pool_inflation"
	AttributeKeyStakingRewardMint = "minted_staking_rewards"
)

Minting module event types

View Source
const (
	// module name
	ModuleName = "magemint"

	// ModuleAccountName is the name of the module's account
	ModuleAccountName = ModuleName

	// StoreKey is the default store key for mint
	StoreKey = ModuleName

	// QuerierRoute is the querier route for the minting store.
	QuerierRoute = StoreKey
)

Variables

View Source
var (
	ErrInvalidLengthGenesis        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowGenesis          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthMagemint        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowMagemint          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupMagemint = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	KeyCommunityPoolInflation = []byte("CommunityPoolInflation")
	KeyStakingRewardsApy      = []byte("StakingRewardsApy")

	// default inflation values are zero
	DefaultCommunityPoolInflation = sdk.ZeroDec()
	DefaultStakingRewardsApy      = sdk.ZeroDec()

	// MaxMintingRate returns the per second rate equivalent to 10,000% per year
	MaxMintingRate = sdk.NewDec(100)
)

Parameter keys and default values

View Source
var (
	ErrInvalidLengthQuery        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowQuery          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	// DefaultPreviousBlockTime represents a time that is unset -- no previous block has occured
	DefaultPreviousBlockTime = time.Time{}
)
View Source
var PreviousBlockTimeKey = []byte{0x00}

PreviousBlockTimeKey is the store key for the previous block time

Functions

func ParamKeyTable

func ParamKeyTable() paramtypes.KeyTable

ParamKeyTable returns the key table for the magemint module

func RegisterQueryHandler

func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterQueryHandler registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterQueryHandlerClient

func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error

RegisterQueryHandlerClient registers the http handlers for service Query to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "QueryClient" to call the correct interceptors.

func RegisterQueryHandlerFromEndpoint

func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterQueryHandlerServer

func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error

RegisterQueryHandlerServer registers the http handlers for service Query to "mux". UnaryRPC :call QueryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead.

func RegisterQueryServer

func RegisterQueryServer(s grpc1.Server, srv QueryServer)

Types

type AccountKeeper

type AccountKeeper interface {
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, moduleName string) types.ModuleAccountI
}

AccountKeeper defines the contract required for account APIs.

type BankKeeper

type BankKeeper interface {
	GetSupply(ctx sdk.Context, denom string) sdk.Coin
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error
}

BankKeeper defines the contract needed to be fulfilled for banking and supply dependencies.

type GenesisState

type GenesisState struct {
	// Params defines all the parameters of the module.
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
	// PreviousBlockTime holds the last last time tokens were minted.
	// On first block, tokens will be minted for total number of seconds passed since this time.
	PreviousBlockTime time.Time `protobuf:"bytes,2,opt,name=previous_block_time,json=previousBlockTime,proto3,stdtime" json:"previous_block_time"`
}

GenesisState defines the magemint module's genesis state.

func DefaultGenesisState

func DefaultGenesisState() *GenesisState

DefaultGenesisState creates a default GenesisState object

func NewGenesisState

func NewGenesisState(params Params, previousBlockTime time.Time) *GenesisState

NewGenesisState creates a new GenesisState object

func (*GenesisState) Descriptor

func (*GenesisState) Descriptor() ([]byte, []int)

func (*GenesisState) Marshal

func (m *GenesisState) Marshal() (dAtA []byte, err error)

func (*GenesisState) MarshalTo

func (m *GenesisState) MarshalTo(dAtA []byte) (int, error)

func (*GenesisState) MarshalToSizedBuffer

func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GenesisState) ProtoMessage

func (*GenesisState) ProtoMessage()

func (*GenesisState) Reset

func (m *GenesisState) Reset()

func (*GenesisState) Size

func (m *GenesisState) Size() (n int)

func (*GenesisState) String

func (m *GenesisState) String() string

func (*GenesisState) Unmarshal

func (m *GenesisState) Unmarshal(dAtA []byte) error

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate validates the provided genesis state to ensure the expected invariants holds.

func (*GenesisState) XXX_DiscardUnknown

func (m *GenesisState) XXX_DiscardUnknown()

func (*GenesisState) XXX_Marshal

func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GenesisState) XXX_Merge

func (m *GenesisState) XXX_Merge(src proto.Message)

func (*GenesisState) XXX_Size

func (m *GenesisState) XXX_Size() int

func (*GenesisState) XXX_Unmarshal

func (m *GenesisState) XXX_Unmarshal(b []byte) error

type Params

type Params struct {
	// yearly inflation of total token supply minted to the community pool.
	CommunityPoolInflation github_com_cosmos_cosmos_sdk_types.Dec `` /* 169-byte string literal not displayed */
	// yearly inflation of bonded tokens minted for staking rewards to validators.
	StakingRewardsApy github_com_cosmos_cosmos_sdk_types.Dec `` /* 154-byte string literal not displayed */
}

Params wraps the governance parameters for the magemint module

func DefaultParams

func DefaultParams() Params

DefaultParams returns default valid parameters for the magemint module

func NewParams

func NewParams(communityPoolInflation sdk.Dec, stakingRewardsApy sdk.Dec) Params

NewParams returns new Params with inflation rates set

func (*Params) Descriptor

func (*Params) Descriptor() ([]byte, []int)

func (*Params) Marshal

func (m *Params) Marshal() (dAtA []byte, err error)

func (*Params) MarshalTo

func (m *Params) MarshalTo(dAtA []byte) (int, error)

func (*Params) MarshalToSizedBuffer

func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Params) ParamSetPairs

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

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs

func (*Params) ProtoMessage

func (*Params) ProtoMessage()

func (*Params) Reset

func (m *Params) Reset()

func (*Params) Size

func (m *Params) Size() (n int)

func (Params) String

func (p Params) String() string

String implements fmt.Stringer

func (*Params) Unmarshal

func (m *Params) Unmarshal(dAtA []byte) error

func (*Params) Validate

func (p *Params) Validate() error

Validate checks that the parameters have valid values.

func (*Params) XXX_DiscardUnknown

func (m *Params) XXX_DiscardUnknown()

func (*Params) XXX_Marshal

func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Params) XXX_Merge

func (m *Params) XXX_Merge(src proto.Message)

func (*Params) XXX_Size

func (m *Params) XXX_Size() int

func (*Params) XXX_Unmarshal

func (m *Params) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	// Params queries the parameters of x/magemint module.
	Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
	// Inflation queries x/magemint for the overall cumulative inflation rate of MAGE.
	Inflation(ctx context.Context, in *QueryInflationRequest, opts ...grpc.CallOption) (*QueryInflationResponse, error)
}

QueryClient is the client API for Query service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewQueryClient

func NewQueryClient(cc grpc1.ClientConn) QueryClient

type QueryInflationRequest

type QueryInflationRequest struct {
}

QueryInflationRequest is the request type for the Query/Inflation RPC method.

func (*QueryInflationRequest) Descriptor

func (*QueryInflationRequest) Descriptor() ([]byte, []int)

func (*QueryInflationRequest) Marshal

func (m *QueryInflationRequest) Marshal() (dAtA []byte, err error)

func (*QueryInflationRequest) MarshalTo

func (m *QueryInflationRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryInflationRequest) MarshalToSizedBuffer

func (m *QueryInflationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryInflationRequest) ProtoMessage

func (*QueryInflationRequest) ProtoMessage()

func (*QueryInflationRequest) Reset

func (m *QueryInflationRequest) Reset()

func (*QueryInflationRequest) Size

func (m *QueryInflationRequest) Size() (n int)

func (*QueryInflationRequest) String

func (m *QueryInflationRequest) String() string

func (*QueryInflationRequest) Unmarshal

func (m *QueryInflationRequest) Unmarshal(dAtA []byte) error

func (*QueryInflationRequest) XXX_DiscardUnknown

func (m *QueryInflationRequest) XXX_DiscardUnknown()

func (*QueryInflationRequest) XXX_Marshal

func (m *QueryInflationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryInflationRequest) XXX_Merge

func (m *QueryInflationRequest) XXX_Merge(src proto.Message)

func (*QueryInflationRequest) XXX_Size

func (m *QueryInflationRequest) XXX_Size() int

func (*QueryInflationRequest) XXX_Unmarshal

func (m *QueryInflationRequest) XXX_Unmarshal(b []byte) error

type QueryInflationResponse

type QueryInflationResponse struct {
	// inflation is the current minting inflation value.
	// example "0.990000000000000000" - 99% inflation
	Inflation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=inflation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"inflation"`
}

QueryInflationResponse is the response type for the Query/Inflation RPC method.

func (*QueryInflationResponse) Descriptor

func (*QueryInflationResponse) Descriptor() ([]byte, []int)

func (*QueryInflationResponse) Marshal

func (m *QueryInflationResponse) Marshal() (dAtA []byte, err error)

func (*QueryInflationResponse) MarshalTo

func (m *QueryInflationResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryInflationResponse) MarshalToSizedBuffer

func (m *QueryInflationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryInflationResponse) ProtoMessage

func (*QueryInflationResponse) ProtoMessage()

func (*QueryInflationResponse) Reset

func (m *QueryInflationResponse) Reset()

func (*QueryInflationResponse) Size

func (m *QueryInflationResponse) Size() (n int)

func (*QueryInflationResponse) String

func (m *QueryInflationResponse) String() string

func (*QueryInflationResponse) Unmarshal

func (m *QueryInflationResponse) Unmarshal(dAtA []byte) error

func (*QueryInflationResponse) XXX_DiscardUnknown

func (m *QueryInflationResponse) XXX_DiscardUnknown()

func (*QueryInflationResponse) XXX_Marshal

func (m *QueryInflationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryInflationResponse) XXX_Merge

func (m *QueryInflationResponse) XXX_Merge(src proto.Message)

func (*QueryInflationResponse) XXX_Size

func (m *QueryInflationResponse) XXX_Size() int

func (*QueryInflationResponse) XXX_Unmarshal

func (m *QueryInflationResponse) XXX_Unmarshal(b []byte) error

type QueryParamsRequest

type QueryParamsRequest struct {
}

QueryParamsRequest defines the request type for querying x/magemint parameters.

func (*QueryParamsRequest) Descriptor

func (*QueryParamsRequest) Descriptor() ([]byte, []int)

func (*QueryParamsRequest) Marshal

func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error)

func (*QueryParamsRequest) MarshalTo

func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsRequest) MarshalToSizedBuffer

func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsRequest) ProtoMessage

func (*QueryParamsRequest) ProtoMessage()

func (*QueryParamsRequest) Reset

func (m *QueryParamsRequest) Reset()

func (*QueryParamsRequest) Size

func (m *QueryParamsRequest) Size() (n int)

func (*QueryParamsRequest) String

func (m *QueryParamsRequest) String() string

func (*QueryParamsRequest) Unmarshal

func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error

func (*QueryParamsRequest) XXX_DiscardUnknown

func (m *QueryParamsRequest) XXX_DiscardUnknown()

func (*QueryParamsRequest) XXX_Marshal

func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsRequest) XXX_Merge

func (m *QueryParamsRequest) XXX_Merge(src proto.Message)

func (*QueryParamsRequest) XXX_Size

func (m *QueryParamsRequest) XXX_Size() int

func (*QueryParamsRequest) XXX_Unmarshal

func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error

type QueryParamsResponse

type QueryParamsResponse struct {
	Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"`
}

QueryParamsResponse defines the response type for querying x/magemint parameters.

func (*QueryParamsResponse) Descriptor

func (*QueryParamsResponse) Descriptor() ([]byte, []int)

func (*QueryParamsResponse) GetParams

func (m *QueryParamsResponse) GetParams() Params

func (*QueryParamsResponse) Marshal

func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error)

func (*QueryParamsResponse) MarshalTo

func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error)

func (*QueryParamsResponse) MarshalToSizedBuffer

func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*QueryParamsResponse) ProtoMessage

func (*QueryParamsResponse) ProtoMessage()

func (*QueryParamsResponse) Reset

func (m *QueryParamsResponse) Reset()

func (*QueryParamsResponse) Size

func (m *QueryParamsResponse) Size() (n int)

func (*QueryParamsResponse) String

func (m *QueryParamsResponse) String() string

func (*QueryParamsResponse) Unmarshal

func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error

func (*QueryParamsResponse) XXX_DiscardUnknown

func (m *QueryParamsResponse) XXX_DiscardUnknown()

func (*QueryParamsResponse) XXX_Marshal

func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryParamsResponse) XXX_Merge

func (m *QueryParamsResponse) XXX_Merge(src proto.Message)

func (*QueryParamsResponse) XXX_Size

func (m *QueryParamsResponse) XXX_Size() int

func (*QueryParamsResponse) XXX_Unmarshal

func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error

type QueryServer

type QueryServer interface {
	// Params queries the parameters of x/magemint module.
	Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
	// Inflation queries x/magemint for the overall cumulative inflation rate of MAGE.
	Inflation(context.Context, *QueryInflationRequest) (*QueryInflationResponse, error)
}

QueryServer is the server API for Query service.

type StakingKeeper

type StakingKeeper interface {
	BondDenom(sdk.Context) string
	TotalBondedTokens(sdk.Context) sdk.Int
}

StakingKeeper defines the expected staking keeper

type UnimplementedQueryServer

type UnimplementedQueryServer struct {
}

UnimplementedQueryServer can be embedded to have forward compatible implementations.

func (*UnimplementedQueryServer) Inflation

func (*UnimplementedQueryServer) Params

Jump to

Keyboard shortcuts

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