Documentation ¶
Index ¶
- Constants
- func ComputeNewDifficultyTargetHash(prevTargetHash []byte, targetNumRelays, newRelaysEma uint64) []byte
- func GetShareAmountMap(serviceRevShare []*sharedtypes.ServiceRevenueShare, amountToDistribute uint64) (shareAmountMap map[string]uint64)
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- type Keeper
- func (k Keeper) ComputeUnitsToTokensMultiplier(ctx context.Context) uint64
- func (k Keeper) GetAllRelayMiningDifficulty(ctx context.Context) (list []types.RelayMiningDifficulty)
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetParams(ctx context.Context) (params types.Params)
- func (k Keeper) GetRelayMiningDifficulty(ctx context.Context, serviceId string) (difficulty types.RelayMiningDifficulty, found bool)
- func (k Keeper) Logger() log.Logger
- func (k Keeper) Params(ctx context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) ProcessTokenLogicModules(ctx context.Context, claim *prooftypes.Claim) (err error)
- func (k Keeper) RelayMiningDifficulty(ctx context.Context, req *types.QueryGetRelayMiningDifficultyRequest) (*types.QueryGetRelayMiningDifficultyResponse, error)
- func (k Keeper) RelayMiningDifficultyAll(ctx context.Context, req *types.QueryAllRelayMiningDifficultyRequest) (*types.QueryAllRelayMiningDifficultyResponse, error)
- func (k Keeper) RemoveRelayMiningDifficulty(ctx context.Context, serviceId string)
- func (k Keeper) SetParams(ctx context.Context, params types.Params) error
- func (k Keeper) SetRelayMiningDifficulty(ctx context.Context, relayMiningDifficulty types.RelayMiningDifficulty)
- func (k Keeper) SettlePendingClaims(ctx sdk.Context) (settledResult types.PendingClaimsResult, ...)
- func (k Keeper) TokenLogicModuleGlobalMint(ctx context.Context, service *sharedtypes.Service, ...) error
- func (k Keeper) TokenLogicModuleRelayBurnEqualsMint(ctx context.Context, service *sharedtypes.Service, ...) error
- func (k Keeper) UpdateRelayMiningDifficulty(ctx context.Context, relaysPerServiceMap map[string]uint64) (difficultyPerServiceMap map[string]types.RelayMiningDifficulty, err error)
- type TokenLogicModule
- type TokenLogicModuleProcessor
Constants ¶
const ( // TODO_UPNEXT(@olshansk): Make all of the governance params MintAllocationDAO = 0.1 MintAllocationProposer = 0.05 MintAllocationSupplier = 0.7 MintAllocationSourceOwner = 0.15 MintAllocationApplication = 0.0 // TODO_UPNEXT(@olshansk): Remove this. An ephemeral placeholder before // real values are introduced. When this is changed to a governance param, // make sure to also add the necessary unit tests. MintGlobalAllocation = 0.0000000 )
const TargetNumRelays = uint64(10e4)
TargetNumRelays is the target number of relays we want the network to mine for a specific service across all applications & suppliers per session. This number determines the total number of leafs to be created across in the off-chain SMTs, across all suppliers, for each service. It indirectly drives the off-chain resource requirements of the network in additional to playing a critical role in Relay Mining. TODO_BLOCKER(@Olshansk, #542): Make this a governance parameter.
Variables ¶
This section is empty.
Functions ¶
func ComputeNewDifficultyTargetHash ¶ added in v0.0.3
func ComputeNewDifficultyTargetHash(prevTargetHash []byte, targetNumRelays, newRelaysEma uint64) []byte
ComputeNewDifficultyTargetHash computes the new difficulty target hash based on the target number of relays we want the network to mine and the new EMA of the number of relays. NB: Exported for testing purposes only.
func GetShareAmountMap ¶ added in v0.0.6
func GetShareAmountMap( serviceRevShare []*sharedtypes.ServiceRevenueShare, amountToDistribute uint64, ) (shareAmountMap map[string]uint64)
GetShareAmountMap calculates the amount of uPOKT to distribute to each revenue shareholder based on the rev share percentage of the service. It returns a map of the shareholder address to the amount of uPOKT to distribute. The first shareholder gets any remainder due to floating point arithmetic. NB: It is publically exposed to be used in the tests.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService store.KVStoreService, logger log.Logger, authority string, bankKeeper types.BankKeeper, accountKeeper types.AccountKeeper, applicationKeeper types.ApplicationKeeper, supplierKeeper types.SupplierKeeper, proofKeeper types.ProofKeeper, sharedKeeper types.SharedKeeper, sessionKeeper types.SessionKeeper, serviceKeeper types.ServiceKeeper, ) Keeper
func (Keeper) ComputeUnitsToTokensMultiplier ¶
ComputeUnitsToTokensMultiplier returns the ComputeUnitsToTokensMultiplier param
func (Keeper) GetAllRelayMiningDifficulty ¶ added in v0.0.3
func (k Keeper) GetAllRelayMiningDifficulty(ctx context.Context) (list []types.RelayMiningDifficulty)
GetAllRelayMiningDifficulty returns all relayMiningDifficulty
func (Keeper) GetAuthority ¶
GetAuthority returns the x/tokenomics module's authority.
func (Keeper) GetRelayMiningDifficulty ¶ added in v0.0.3
func (k Keeper) GetRelayMiningDifficulty( ctx context.Context, serviceId string, ) (difficulty types.RelayMiningDifficulty, found bool)
GetRelayMiningDifficulty returns a relayMiningDifficulty from its index
func (Keeper) Params ¶
func (k Keeper) Params( ctx context.Context, req *types.QueryParamsRequest, ) (*types.QueryParamsResponse, error)
func (Keeper) ProcessTokenLogicModules ¶ added in v0.0.6
func (k Keeper) ProcessTokenLogicModules( ctx context.Context, claim *prooftypes.Claim, ) (err error)
ProcessTokenLogicModules is responsible for calling all of the token logic modules (i.e. post session claim accounting) necessary to burn, mint or transfer tokens as a result of the amount of work (i.e. compute units) done.
func (Keeper) RelayMiningDifficulty ¶ added in v0.0.3
func (k Keeper) RelayMiningDifficulty(ctx context.Context, req *types.QueryGetRelayMiningDifficultyRequest) (*types.QueryGetRelayMiningDifficultyResponse, error)
func (Keeper) RelayMiningDifficultyAll ¶ added in v0.0.3
func (k Keeper) RelayMiningDifficultyAll(ctx context.Context, req *types.QueryAllRelayMiningDifficultyRequest) (*types.QueryAllRelayMiningDifficultyResponse, error)
func (Keeper) RemoveRelayMiningDifficulty ¶ added in v0.0.3
RemoveRelayMiningDifficulty removes a relayMiningDifficulty from the store
func (Keeper) SetRelayMiningDifficulty ¶ added in v0.0.3
func (k Keeper) SetRelayMiningDifficulty(ctx context.Context, relayMiningDifficulty types.RelayMiningDifficulty)
SetRelayMiningDifficulty set a specific relayMiningDifficulty in the store from its index
func (Keeper) SettlePendingClaims ¶
func (k Keeper) SettlePendingClaims(ctx sdk.Context) ( settledResult types.PendingClaimsResult, expiredResult types.PendingClaimsResult, err error, )
SettlePendingClaims settles all pending (i.e. expiring) claims. If a claim is expired and requires a proof and a proof IS available -> it's settled. If a claim is expired and requires a proof and a proof IS NOT available -> it's deleted. If a claim is expired and does NOT require a proof -> it's settled. Events are emitted for each claim that is settled or removed. On-chain Claims & Proofs are deleted after they're settled or expired to free up space.
TODO_TECHDEBT: Refactor this function to return a struct instead of multiple return values.
func (Keeper) TokenLogicModuleGlobalMint ¶ added in v0.0.6
func (k Keeper) TokenLogicModuleGlobalMint( ctx context.Context, service *sharedtypes.Service, application *apptypes.Application, supplier *sharedtypes.Supplier, settlementCoins cosmostypes.Coin, relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, ) error
TokenLogicModuleGlobalMint processes the business logic for the GlobalMint TLM. TODO_UPNEXT(@olshansk): Delete this in favor of a real TLM that mints tokens and distributes them to the appropriate accounts via boosts.
func (Keeper) TokenLogicModuleRelayBurnEqualsMint ¶ added in v0.0.6
func (k Keeper) TokenLogicModuleRelayBurnEqualsMint( ctx context.Context, service *sharedtypes.Service, application *apptypes.Application, supplier *sharedtypes.Supplier, settlementCoin cosmostypes.Coin, relayMiningDifficulty *tokenomictypes.RelayMiningDifficulty, ) error
TokenLogicModuleRelayBurnEqualsMint processes the business logic for the RelayBurnEqualsMint TLM.
func (Keeper) UpdateRelayMiningDifficulty ¶ added in v0.0.3
func (k Keeper) UpdateRelayMiningDifficulty( ctx context.Context, relaysPerServiceMap map[string]uint64, ) (difficultyPerServiceMap map[string]types.RelayMiningDifficulty, err error)
UpdateRelayMiningDifficulty updates the on-chain relay mining difficulty based on the amount of on-chain relays for each service, given a map of serviceId->numRelays.
type TokenLogicModule ¶ added in v0.0.6
type TokenLogicModule int
const ( TLMRelayBurnEqualsMint TokenLogicModule = iota TLMGlobalMint )
func (TokenLogicModule) EnumIndex ¶ added in v0.0.6
func (tlm TokenLogicModule) EnumIndex() int
func (TokenLogicModule) String ¶ added in v0.0.6
func (tlm TokenLogicModule) String() string
type TokenLogicModuleProcessor ¶ added in v0.0.6
type TokenLogicModuleProcessor func( Keeper, context.Context, *sharedtypes.Service, *apptypes.Application, *sharedtypes.Supplier, cosmostypes.Coin, *tokenomictypes.RelayMiningDifficulty, ) error
TokenLogicModuleProcessor is the method signature that all token logic modules are expected to implement. IMPORTANT SIDE EFFECTS: Please note that TLMS may update the application and supplier objects, which is why they are passed in as pointers. However, this IS NOT persisted. The persistence to the keeper is currently done by ProcessTokenLogicModules only. This may be an interim state of the implementation and may change in the future.