Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scaffolded Tokenomics module #251

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ import (
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/spf13/cast"

appparams "github.com/pokt-network/poktroll/app/params"
"github.com/pokt-network/poktroll/docs"
applicationmodule "github.com/pokt-network/poktroll/x/application"
Expand All @@ -132,6 +130,10 @@ import (
suppliermodule "github.com/pokt-network/poktroll/x/supplier"
suppliermodulekeeper "github.com/pokt-network/poktroll/x/supplier/keeper"
suppliermoduletypes "github.com/pokt-network/poktroll/x/supplier/types"
tokenomicsmodule "github.com/pokt-network/poktroll/x/tokenomics"
tokenomicsmodulekeeper "github.com/pokt-network/poktroll/x/tokenomics/keeper"
tokenomicsmoduletypes "github.com/pokt-network/poktroll/x/tokenomics/types"
"github.com/spf13/cast"
)

const (
Expand Down Expand Up @@ -197,6 +199,7 @@ var (
applicationmodule.AppModuleBasic{},
suppliermodule.AppModuleBasic{},
gatewaymodule.AppModuleBasic{},
tokenomicsmodule.AppModuleBasic{},
// this line is used by starport scaffolding # stargate/app/moduleBasic
)

Expand Down Expand Up @@ -283,6 +286,8 @@ type App struct {
SupplierKeeper suppliermodulekeeper.Keeper

GatewayKeeper gatewaymodulekeeper.Keeper

TokenomicsKeeper tokenomicsmodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down Expand Up @@ -335,6 +340,7 @@ func New(
applicationmoduletypes.StoreKey,
suppliermoduletypes.StoreKey,
gatewaymoduletypes.StoreKey,
tokenomicsmoduletypes.StoreKey,
// this line is used by starport scaffolding # stargate/app/storeKey
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
Expand Down Expand Up @@ -634,6 +640,14 @@ func New(
supplierModule := suppliermodule.NewAppModule(appCodec, app.SupplierKeeper, app.AccountKeeper, app.BankKeeper)
sessionModule := sessionmodule.NewAppModule(appCodec, app.SessionKeeper, app.AccountKeeper, app.BankKeeper)

app.TokenomicsKeeper = *tokenomicsmodulekeeper.NewKeeper(
appCodec,
keys[tokenomicsmoduletypes.StoreKey],
keys[tokenomicsmoduletypes.MemStoreKey],
app.GetSubspace(tokenomicsmoduletypes.ModuleName),
)
tokenomicsModule := tokenomicsmodule.NewAppModule(appCodec, app.TokenomicsKeeper, app.AccountKeeper, app.BankKeeper)

// this line is used by starport scaffolding # stargate/app/keeperDefinition

/**** IBC Routing ****/
Expand Down Expand Up @@ -701,6 +715,7 @@ func New(
applicationModule,
supplierModule,
gatewayModule,
tokenomicsModule,
// this line is used by starport scaffolding # stargate/app/appModule

crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
Expand Down Expand Up @@ -739,6 +754,7 @@ func New(
applicationmoduletypes.ModuleName,
suppliermoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/beginBlockers
)

Expand Down Expand Up @@ -770,6 +786,7 @@ func New(
applicationmoduletypes.ModuleName,
suppliermoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/endBlockers
)

Expand Down Expand Up @@ -806,6 +823,7 @@ func New(
applicationmoduletypes.ModuleName,
suppliermoduletypes.ModuleName,
gatewaymoduletypes.ModuleName,
tokenomicsmoduletypes.ModuleName,
// this line is used by starport scaffolding # stargate/app/initGenesis
}
app.mm.SetOrderInitGenesis(genesisModuleOrder...)
Expand Down Expand Up @@ -1036,6 +1054,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(applicationmoduletypes.ModuleName)
paramsKeeper.Subspace(suppliermoduletypes.ModuleName)
paramsKeeper.Subspace(gatewaymoduletypes.ModuleName)
paramsKeeper.Subspace(tokenomicsmoduletypes.ModuleName)
// this line is used by starport scaffolding # stargate/app/paramSubspace

return paramsKeeper
Expand Down
86 changes: 66 additions & 20 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47176,7 +47176,7 @@ paths:
service:
title: >-
The Service for which the application is
configured
configured for
type: object
properties:
id:
Expand Down Expand Up @@ -47243,7 +47243,7 @@ paths:
service:
title: >-
The Service for which the supplier is
configured
configured for
type: object
properties:
id:
Expand Down Expand Up @@ -47931,14 +47931,12 @@ paths:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -48082,14 +48080,12 @@ paths:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -48237,6 +48233,46 @@ paths:
type: boolean
tags:
- Query
/pokt-network/poktroll/tokenomics/params:
get:
summary: Parameters queries the parameters of the module.
operationId: PoktrollTokenomicsParams
responses:
'200':
description: A successful response.
schema:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
properties:
computeToTokensMultiplier:
type: string
format: uint64
description: >-
QueryParamsResponse is response type for the Query/Params RPC
method.
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
tags:
- Query
definitions:
cosmos.auth.v1beta1.AddressBytesToStringResponse:
type: object
Expand Down Expand Up @@ -77500,7 +77536,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the application is configured
title: The Service for which the application is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -77564,7 +77600,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -77754,7 +77790,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the application is configured
title: The Service for which the application is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -77816,7 +77852,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -77996,7 +78032,6 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
Expand Down Expand Up @@ -78031,7 +78066,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -78064,7 +78099,6 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
Expand Down Expand Up @@ -78122,7 +78156,6 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
Expand Down Expand Up @@ -78162,7 +78195,7 @@ definitions:
type: object
properties:
service:
title: The Service for which the supplier is configured
title: The Service for which the supplier is configured for
type: object
properties:
id:
Expand Down Expand Up @@ -78194,7 +78227,6 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
Expand Down Expand Up @@ -78449,14 +78481,12 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -78631,14 +78661,12 @@ definitions:
- GRPC
- WEBSOCKET
- JSON_RPC
- REST
default: UNKNOWN_RPC
description: |-
- UNKNOWN_RPC: Undefined RPC type
- GRPC: gRPC
- WEBSOCKET: WebSocket
- JSON_RPC: JSON-RPC
- REST: REST
configs:
type: array
items:
Expand Down Expand Up @@ -78685,3 +78713,21 @@ definitions:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
poktroll.tokenomics.Params:
type: object
properties:
computeToTokensMultiplier:
type: string
format: uint64
description: Params defines the parameters for the module.
poktroll.tokenomics.QueryParamsResponse:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
properties:
computeToTokensMultiplier:
type: string
format: uint64
description: QueryParamsResponse is response type for the Query/Params RPC method.
12 changes: 12 additions & 0 deletions proto/poktroll/tokenomics/genesis.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
syntax = "proto3";
package poktroll.tokenomics;

import "gogoproto/gogo.proto";
import "poktroll/tokenomics/params.proto";

option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types";

// GenesisState defines the tokenomics module's genesis state.
message GenesisState {
Params params = 1 [(gogoproto.nullable) = false];
}
13 changes: 13 additions & 0 deletions proto/poktroll/tokenomics/params.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
syntax = "proto3";
package poktroll.tokenomics;

import "gogoproto/gogo.proto";

option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types";

// Params defines the parameters for the module.
message Params {
option (gogoproto.goproto_stringer) = false;

uint64 computeToTokensMultiplier = 1 [(gogoproto.moretags) = "yaml:\"compute_to_tokens_multiplier\""];
}
26 changes: 26 additions & 0 deletions proto/poktroll/tokenomics/query.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
syntax = "proto3";
package poktroll.tokenomics;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "poktroll/tokenomics/params.proto";

option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types";

// Query defines the gRPC querier service.
service Query {
// Parameters queries the parameters of the module.
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
option (google.api.http).get = "/pokt-network/poktroll/tokenomics/params";
}
}

// QueryParamsRequest is request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
// params holds all the parameters of this module.
Params params = 1 [(gogoproto.nullable) = false];
}
7 changes: 7 additions & 0 deletions proto/poktroll/tokenomics/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
syntax = "proto3";
package poktroll.tokenomics;

option go_package = "github.com/pokt-network/poktroll/x/tokenomics/types";

// Msg defines the Msg service.
service Msg {}
Loading