Documentation ¶
Index ¶
- Constants
- Variables
- func ParamKeyTable() params.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- func ValidateMinter(minter Minter) error
- type AddrPool
- type GenesisState
- type MintPool
- type Minter
- type MsgWithdrawCoinsToAccFromTreasury
- func (msg MsgWithdrawCoinsToAccFromTreasury) GetSignBytes() []byte
- func (msg MsgWithdrawCoinsToAccFromTreasury) GetSigners() []sdk.AccAddress
- func (msg MsgWithdrawCoinsToAccFromTreasury) Route() string
- func (msg MsgWithdrawCoinsToAccFromTreasury) Type() string
- func (msg MsgWithdrawCoinsToAccFromTreasury) ValidateBasic() error
- type Params
- type StakingKeeper
- type SupplyKeeper
Constants ¶
const ( EventTypeMint = ModuleName EventTypeWithdrawal = "withdrawal" AttributeKeyBondedRatio = "bonded_ratio" AttributeKeyInflation = "inflation" AttributeKeyAnnualProvisions = "annual_provisions" AttributeKeySender = "sender" AttributeKeyReceiver = "receiver" AttributeKeyWithdrawalAmount = "withdrawal_amount" )
Minting module event types
const ( // ModuleName ModuleName = "mint" WrappedModuleName = "odin" + ModuleName // DefaultParamspace params keeper DefaultParamspace = ModuleName // StoreKey is the default store key for mint StoreKey = ModuleName // RouterKey is the message route for mint RouterKey = ModuleName // QuerierRoute is the querier route for the minting store. QuerierRoute = StoreKey // Query endpoints supported by the minting querier QueryRoute = "minting" QueryParameters = "parameters" QueryInflation = "inflation" QueryAnnualProvisions = "annual_provisions" QueryEthIntegrationAddress = "eth_integration_address" QueryTreasuryPool = "treasury_pool" )
nolint
const TypeMsgWithdrawCoinsToAccFromTreasury = "withdraw_coins_from_treasury"
Variables ¶
var ( ErrInvalidMintDenom = sdkerrors.Register(ModuleName, 111, "The given mint denom is invalid") ErrAccountIsNotEligible = sdkerrors.Register(ModuleName, 112, "The given account is not eligible to mint") ErrInvalidWithdrawalAmount = sdkerrors.Register(ModuleName, 113, "The given withdrawal amount is invalid") ErrExceedsWithdrawalLimitPerTime = sdkerrors.Register(ModuleName, 114, "The given amount exceeds the withdrawal limit per time") ErrWithdrawalAmountExceedsModuleBalance = sdkerrors.Register(ModuleName, 115, "The given amount to withdraw exceeds module balance") )
var ( // GlobalStoreKeyPrefix is used as prefix for the store keys GlobalStoreKeyPrefix = []byte{0x00} // MinterKey is used for the keeper store MinterKey = append(GlobalStoreKeyPrefix, []byte("Minter")...) // MintPoolStoreKey is the key for global mint pool state MintPoolStoreKey = append(GlobalStoreKeyPrefix, []byte("MintPool")...) )
var ( KeyMintDenom = []byte("MintDenom") KeyInflationRateChange = []byte("InflationRateChange") KeyInflationMax = []byte("InflationMax") KeyInflationMin = []byte("InflationMin") KeyGoalBonded = []byte("GoalBonded") KeyBlocksPerYear = []byte("BlocksPerYear") KeyMintAir = []byte("MintAir") KeyEthIntegrationAddress = []byte("EthIntegrationAddress") KeyMaxWithdrawalPerTime = []byte("MaxWithdrawalPerTime") )
Parameter store keys
var ModuleCdc = codec.New()
ModuleCdc is the codec for the module.
Functions ¶
func ParamKeyTable ¶
ParamKeyTable defines a key table for minting module.
func RegisterCodec ¶
RegisterCodec registers the module's concrete types on the codec.
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis validates the provided genesis state to ensure the expected invariants holds.
Types ¶
type GenesisState ¶
type GenesisState struct { Minter Minter `json:"minter" yaml:"minter"` // minter object Params Params `json:"params" yaml:"params"` // inflation params MintPool MintPool `json:"mint_pool" yaml:"mint_pool"` // module pool }
GenesisState - minter state
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState creates a default GenesisState object
func NewGenesisState ¶
func NewGenesisState(minter Minter, params Params, mintPool MintPool) GenesisState
NewGenesisState creates a new GenesisState object
type MintPool ¶
type MintPool struct { TreasuryPool sdk.Coins `json:"treasury_pool" yaml:"treasury_pool"` EligiblePool AddrPool `json:"eligible_accounts_pool" yaml:"eligible_accounts_pool"` // eligible to mint accounts }
MintPool
func InitialMintPool ¶
func InitialMintPool() MintPool
InitialMintPool returns the initial state of MintPool
func (MintPool) ValidateGenesis ¶
ValidateGenesis validates the mint pool for a genesis state
type Minter ¶
type Minter struct { Inflation sdk.Dec `json:"inflation" yaml:"inflation"` // current annual inflation rate AnnualProvisions sdk.Dec `json:"annual_provisions" yaml:"annual_provisions"` // current annual expected provisions }
Minter represents the minting state.
func DefaultInitialMinter ¶
func DefaultInitialMinter() Minter
DefaultInitialMinter returns a default initial Minter object for a new chain which uses an inflation rate of 13%.
func InitialMinter ¶
InitialMinter returns an initial Minter object with a given inflation value.
func NewMinter ¶
NewMinter returns a new Minter object with the given inflation and annual provisions values.
func (Minter) BlockProvision ¶
BlockProvision returns the provisions for a block based on the annual provisions rate.
func (Minter) NextAnnualProvisions ¶
NextAnnualProvisions returns the annual provisions based on current total supply and inflation rate.
type MsgWithdrawCoinsToAccFromTreasury ¶
type MsgWithdrawCoinsToAccFromTreasury struct { Amount sdk.Coins `json:"amount" yaml:"amount"` Receiver sdk.AccAddress `json:"receiver" yaml:"receiver"` Sender sdk.AccAddress `json:"sender" yaml:"sender"` }
MsgWithdrawCoinsToAccFromTreasury defines a msg to mint some amount for receiver account
func NewMsgWithdrawCoinsToAccFromTreasury ¶
func NewMsgWithdrawCoinsToAccFromTreasury( amt sdk.Coins, receiver sdk.AccAddress, sender sdk.AccAddress, ) MsgWithdrawCoinsToAccFromTreasury
NewMsgWithdrawCoinsToAccFromTreasury returns a new MsgWithdrawCoinsToAccFromTreasury
func (MsgWithdrawCoinsToAccFromTreasury) GetSignBytes ¶
func (msg MsgWithdrawCoinsToAccFromTreasury) GetSignBytes() []byte
GetSignBytes implements the sdk.Msg interface.
func (MsgWithdrawCoinsToAccFromTreasury) GetSigners ¶
func (msg MsgWithdrawCoinsToAccFromTreasury) GetSigners() []sdk.AccAddress
GetSigners implements the sdk.Msg interface.
func (MsgWithdrawCoinsToAccFromTreasury) Route ¶
func (msg MsgWithdrawCoinsToAccFromTreasury) Route() string
Route implements the sdk.Msg interface.
func (MsgWithdrawCoinsToAccFromTreasury) Type ¶
func (msg MsgWithdrawCoinsToAccFromTreasury) Type() string
Type implements the sdk.Msg interface.
func (MsgWithdrawCoinsToAccFromTreasury) ValidateBasic ¶
func (msg MsgWithdrawCoinsToAccFromTreasury) ValidateBasic() error
ValidateBasic implements the sdk.Msg interface.
type Params ¶
type Params struct { MintDenom string `json:"mint_denom" yaml:"mint_denom"` // type of coin to mint InflationRateChange sdk.Dec `json:"inflation_rate_change" yaml:"inflation_rate_change"` // maximum annual change in inflation rate InflationMax sdk.Dec `json:"inflation_max" yaml:"inflation_max"` // maximum inflation rate InflationMin sdk.Dec `json:"inflation_min" yaml:"inflation_min"` // minimum inflation rate GoalBonded sdk.Dec `json:"goal_bonded" yaml:"goal_bonded"` // goal of percent bonded atoms BlocksPerYear uint64 `json:"blocks_per_year" yaml:"blocks_per_year"` // expected blocks per year MintAir bool `json:"mint_air" yaml:"mint_air"` // weather coins should be minted in vanilla way, or just retrieved from fee pool EthIntegrationAddress string `json:"eth_integration_address" yaml:"eth_integration_address"` // address of the contract for integration with eth MaxWithdrawalPerTime sdk.Coins `json:"max_withdrawal_per_time" yaml:"max_withdrawal_per_time"` // max to mint in one withdraw }
Params defines a mint parameters
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns default minting module parameters
func NewParams ¶
func NewParams( mintDenom string, inflationRateChange, inflationMax, inflationMin, goalBonded sdk.Dec, MaxWithdrawalPerTime sdk.Coins, blocksPerYear uint64, mintAir bool, ethIntegrationAddress string, ) Params
NewParams returns a new mint params
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() params.ParamSetPairs
Implements params.ParamSet
type StakingKeeper ¶
type StakingKeeper interface { StakingTokenSupply(ctx sdk.Context) sdk.Int BondedRatio(ctx sdk.Context) sdk.Dec }
StakingKeeper defines the expected staking keeper
type SupplyKeeper ¶
type SupplyKeeper interface { GetModuleAddress(name string) sdk.AccAddress // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, exported.ModuleAccountI) GetModuleAccount(sdk.Context, string) exported.ModuleAccountI SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error }
SupplyKeeper defines the expected supply keeper