Documentation ¶
Index ¶
- type AppUpgradeConfig
- type ProtocolDefinition
- type ProtocolKeeper
- func (pk ProtocolKeeper) ClearUpgradeConfig(ctx sdk.Context)
- func (pk ProtocolKeeper) GetCurrentVersion(ctx sdk.Context) uint64
- func (pk ProtocolKeeper) GetCurrentVersionByStore(store sdk.KVStore) uint64
- func (pk ProtocolKeeper) GetLastFailedVersion(ctx sdk.Context) uint64
- func (pk ProtocolKeeper) GetUpgradeConfig(ctx sdk.Context) (upgradeConfig AppUpgradeConfig, found bool)
- func (pk ProtocolKeeper) GetUpgradeConfigByStore(store sdk.KVStore) (upgradeConfig AppUpgradeConfig, found bool)
- func (pk ProtocolKeeper) IsValidVersion(ctx sdk.Context, version uint64) bool
- func (pk ProtocolKeeper) SetCurrentVersion(ctx sdk.Context, currentVersion uint64)
- func (pk ProtocolKeeper) SetLastFailedVersion(ctx sdk.Context, lastFailedVersion uint64)
- func (pk ProtocolKeeper) SetUpgradeConfig(ctx sdk.Context, upgradeConfig AppUpgradeConfig)
- type VersionKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppUpgradeConfig ¶
type AppUpgradeConfig struct { ProposalID uint64 `json:"proposal_id"` ProtocolDef ProtocolDefinition `json:"protocol_def"` }
AppUpgradeConfig is the struct of app-upgrade-specific params
func DefaultUpgradeConfig ¶
func DefaultUpgradeConfig(software string) AppUpgradeConfig
DefaultUpgradeConfig returns a default AppUpgradeConfig object
func NewAppUpgradeConfig ¶
func NewAppUpgradeConfig(proposalID uint64, protocolDef ProtocolDefinition) AppUpgradeConfig
NewAppUpgradeConfig creates a new instance of AppUpgradeConfig
func (AppUpgradeConfig) String ¶
func (auc AppUpgradeConfig) String() string
String returns a human readable string representation of AppUpgradeConfig
type ProtocolDefinition ¶
type ProtocolDefinition struct { Version uint64 `json:"version"` Software string `json:"software"` Height uint64 `json:"height"` Threshold sdk.Dec `json:"threshold"` }
ProtocolDefinition is the struct of app-upgrade detail info
func NewProtocolDefinition ¶
func NewProtocolDefinition(version uint64, software string, height uint64, threshold sdk.Dec) ProtocolDefinition
NewProtocolDefinition creates a new instance of ProtocolDefinition
type ProtocolKeeper ¶
type ProtocolKeeper struct {
// contains filtered or unexported fields
}
ProtocolKeeper is designed for a protocol controller
func NewProtocolKeeper ¶
func NewProtocolKeeper(key sdk.StoreKey) ProtocolKeeper
NewProtocolKeeper creates a new instance of ProtocolKeeper
func (ProtocolKeeper) ClearUpgradeConfig ¶
func (pk ProtocolKeeper) ClearUpgradeConfig(ctx sdk.Context)
ClearUpgradeConfig removes the upgrade config in the store
func (ProtocolKeeper) GetCurrentVersion ¶
func (pk ProtocolKeeper) GetCurrentVersion(ctx sdk.Context) uint64
GetCurrentVersion gets the current version from context
func (ProtocolKeeper) GetCurrentVersionByStore ¶
func (pk ProtocolKeeper) GetCurrentVersionByStore(store sdk.KVStore) uint64
GetCurrentVersionByStore gets the current version of protocol from store
func (ProtocolKeeper) GetLastFailedVersion ¶
func (pk ProtocolKeeper) GetLastFailedVersion(ctx sdk.Context) uint64
GetLastFailedVersion gets last failed version
func (ProtocolKeeper) GetUpgradeConfig ¶
func (pk ProtocolKeeper) GetUpgradeConfig(ctx sdk.Context) (upgradeConfig AppUpgradeConfig, found bool)
GetUpgradeConfig gets upgrade config
func (ProtocolKeeper) GetUpgradeConfigByStore ¶
func (pk ProtocolKeeper) GetUpgradeConfigByStore(store sdk.KVStore) (upgradeConfig AppUpgradeConfig, found bool)
GetUpgradeConfigByStore gets the upgrade config from store
func (ProtocolKeeper) IsValidVersion ¶
func (pk ProtocolKeeper) IsValidVersion(ctx sdk.Context, version uint64) bool
IsValidVersion checks whether the version is available
func (ProtocolKeeper) SetCurrentVersion ¶
func (pk ProtocolKeeper) SetCurrentVersion(ctx sdk.Context, currentVersion uint64)
SetCurrentVersion sets current version
func (ProtocolKeeper) SetLastFailedVersion ¶
func (pk ProtocolKeeper) SetLastFailedVersion(ctx sdk.Context, lastFailedVersion uint64)
SetLastFailedVersion sets last failed version
func (ProtocolKeeper) SetUpgradeConfig ¶
func (pk ProtocolKeeper) SetUpgradeConfig(ctx sdk.Context, upgradeConfig AppUpgradeConfig)
SetUpgradeConfig sets upgrade config
type VersionKeeper ¶
type VersionKeeper interface { GetCurrentVersionByStore(store sdk.KVStore) uint64 GetUpgradeConfigByStore(store sdk.KVStore) (upgradeConfig AppUpgradeConfig, found bool) }
VersionKeeper shows the expected behaviour of a version keeper