From 24f2a897453986758a17259f0d60ea38af4b7441 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Tue, 18 Jun 2024 15:56:53 -0400 Subject: [PATCH 1/5] Add x/revshare module skeleton Signed-off-by: Shrenuj Bansal --- .../src/codegen/dydxprotocol/bundle.ts | 297 +++++++++--------- .../src/codegen/dydxprotocol/rpc.query.ts | 1 + .../v4-protos/src/codegen/gogoproto/bundle.ts | 4 +- .../v4-protos/src/codegen/google/bundle.ts | 24 +- proto/dydxprotocol/revshare/genesis.proto | 7 + proto/dydxprotocol/revshare/query.proto | 7 + proto/dydxprotocol/revshare/tx.proto | 7 + protocol/app/app.go | 20 ++ protocol/app/app_test.go | 2 + protocol/app/basic_manager/basic_manager.go | 2 + .../app/testdata/default_genesis_state.json | 1 + protocol/app/upgrades/v6.0.0/constants.go | 2 + .../scripts/genesis/sample_pregenesis.json | 1 + .../containertest/preupgrade_genesis.json | 1 + protocol/testutil/constants/genesis.go | 1 + protocol/x/revshare/client/cli/query.go | 24 ++ protocol/x/revshare/client/cli/tx.go | 23 ++ protocol/x/revshare/genesis.go | 16 + protocol/x/revshare/keeper/grpc_query.go | 7 + protocol/x/revshare/keeper/keeper.go | 43 +++ protocol/x/revshare/keeper/keeper_test.go | 16 + protocol/x/revshare/keeper/msg_server.go | 17 + protocol/x/revshare/keeper/msg_server_test.go | 26 ++ protocol/x/revshare/module.go | 143 +++++++++ protocol/x/revshare/types/codec.go | 19 ++ protocol/x/revshare/types/errors.go | 5 + protocol/x/revshare/types/expected_keepers.go | 1 + protocol/x/revshare/types/genesis.go | 12 + protocol/x/revshare/types/genesis.pb.go | 265 ++++++++++++++++ protocol/x/revshare/types/keys.go | 10 + protocol/x/revshare/types/query.pb.go | 81 +++++ protocol/x/revshare/types/tx.pb.go | 81 +++++ 32 files changed, 1008 insertions(+), 158 deletions(-) create mode 100644 proto/dydxprotocol/revshare/genesis.proto create mode 100644 proto/dydxprotocol/revshare/query.proto create mode 100644 proto/dydxprotocol/revshare/tx.proto create mode 100644 protocol/x/revshare/client/cli/query.go create mode 100644 protocol/x/revshare/client/cli/tx.go create mode 100644 protocol/x/revshare/genesis.go create mode 100644 protocol/x/revshare/keeper/grpc_query.go create mode 100644 protocol/x/revshare/keeper/keeper.go create mode 100644 protocol/x/revshare/keeper/keeper_test.go create mode 100644 protocol/x/revshare/keeper/msg_server.go create mode 100644 protocol/x/revshare/keeper/msg_server_test.go create mode 100644 protocol/x/revshare/module.go create mode 100644 protocol/x/revshare/types/codec.go create mode 100644 protocol/x/revshare/types/errors.go create mode 100644 protocol/x/revshare/types/expected_keepers.go create mode 100644 protocol/x/revshare/types/genesis.go create mode 100644 protocol/x/revshare/types/genesis.pb.go create mode 100644 protocol/x/revshare/types/keys.go create mode 100644 protocol/x/revshare/types/query.pb.go create mode 100644 protocol/x/revshare/types/tx.pb.go diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts index ebb2583e3c..9de344e7e9 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/bundle.ts @@ -73,100 +73,104 @@ import * as _76 from "./ratelimit/limit_params"; import * as _77 from "./ratelimit/pending_send_packet"; import * as _78 from "./ratelimit/query"; import * as _79 from "./ratelimit/tx"; -import * as _80 from "./rewards/genesis"; -import * as _81 from "./rewards/params"; -import * as _82 from "./rewards/query"; -import * as _83 from "./rewards/reward_share"; -import * as _84 from "./rewards/tx"; -import * as _85 from "./sending/genesis"; -import * as _86 from "./sending/query"; -import * as _87 from "./sending/transfer"; -import * as _88 from "./sending/tx"; -import * as _89 from "./stats/genesis"; -import * as _90 from "./stats/params"; -import * as _91 from "./stats/query"; -import * as _92 from "./stats/stats"; -import * as _93 from "./stats/tx"; -import * as _94 from "./subaccounts/asset_position"; -import * as _95 from "./subaccounts/genesis"; -import * as _96 from "./subaccounts/perpetual_position"; -import * as _97 from "./subaccounts/query"; -import * as _98 from "./subaccounts/subaccount"; -import * as _99 from "./vault/genesis"; -import * as _100 from "./vault/params"; -import * as _101 from "./vault/query"; -import * as _102 from "./vault/tx"; -import * as _103 from "./vault/vault"; -import * as _104 from "./vest/genesis"; -import * as _105 from "./vest/query"; -import * as _106 from "./vest/tx"; -import * as _107 from "./vest/vest_entry"; -import * as _115 from "./assets/query.lcd"; -import * as _116 from "./blocktime/query.lcd"; -import * as _117 from "./bridge/query.lcd"; -import * as _118 from "./clob/query.lcd"; -import * as _119 from "./delaymsg/query.lcd"; -import * as _120 from "./epochs/query.lcd"; -import * as _121 from "./feetiers/query.lcd"; -import * as _122 from "./perpetuals/query.lcd"; -import * as _123 from "./prices/query.lcd"; -import * as _124 from "./ratelimit/query.lcd"; -import * as _125 from "./rewards/query.lcd"; -import * as _126 from "./stats/query.lcd"; -import * as _127 from "./subaccounts/query.lcd"; -import * as _128 from "./vault/query.lcd"; -import * as _129 from "./vest/query.lcd"; -import * as _130 from "./assets/query.rpc.Query"; -import * as _131 from "./blocktime/query.rpc.Query"; -import * as _132 from "./bridge/query.rpc.Query"; -import * as _133 from "./clob/query.rpc.Query"; -import * as _134 from "./delaymsg/query.rpc.Query"; -import * as _135 from "./epochs/query.rpc.Query"; -import * as _136 from "./feetiers/query.rpc.Query"; -import * as _137 from "./govplus/query.rpc.Query"; -import * as _138 from "./listing/query.rpc.Query"; -import * as _139 from "./perpetuals/query.rpc.Query"; -import * as _140 from "./prices/query.rpc.Query"; -import * as _141 from "./ratelimit/query.rpc.Query"; -import * as _142 from "./rewards/query.rpc.Query"; -import * as _143 from "./sending/query.rpc.Query"; -import * as _144 from "./stats/query.rpc.Query"; -import * as _145 from "./subaccounts/query.rpc.Query"; -import * as _146 from "./vault/query.rpc.Query"; -import * as _147 from "./vest/query.rpc.Query"; -import * as _148 from "./blocktime/tx.rpc.msg"; -import * as _149 from "./bridge/tx.rpc.msg"; -import * as _150 from "./clob/tx.rpc.msg"; -import * as _151 from "./delaymsg/tx.rpc.msg"; -import * as _152 from "./feetiers/tx.rpc.msg"; -import * as _153 from "./govplus/tx.rpc.msg"; -import * as _154 from "./perpetuals/tx.rpc.msg"; -import * as _155 from "./prices/tx.rpc.msg"; -import * as _156 from "./ratelimit/tx.rpc.msg"; -import * as _157 from "./rewards/tx.rpc.msg"; -import * as _158 from "./sending/tx.rpc.msg"; -import * as _159 from "./stats/tx.rpc.msg"; -import * as _160 from "./vault/tx.rpc.msg"; -import * as _161 from "./vest/tx.rpc.msg"; -import * as _162 from "./lcd"; -import * as _163 from "./rpc.query"; -import * as _164 from "./rpc.tx"; +import * as _80 from "./revshare/genesis"; +import * as _81 from "./revshare/query"; +import * as _82 from "./revshare/tx"; +import * as _83 from "./rewards/genesis"; +import * as _84 from "./rewards/params"; +import * as _85 from "./rewards/query"; +import * as _86 from "./rewards/reward_share"; +import * as _87 from "./rewards/tx"; +import * as _88 from "./sending/genesis"; +import * as _89 from "./sending/query"; +import * as _90 from "./sending/transfer"; +import * as _91 from "./sending/tx"; +import * as _92 from "./stats/genesis"; +import * as _93 from "./stats/params"; +import * as _94 from "./stats/query"; +import * as _95 from "./stats/stats"; +import * as _96 from "./stats/tx"; +import * as _97 from "./subaccounts/asset_position"; +import * as _98 from "./subaccounts/genesis"; +import * as _99 from "./subaccounts/perpetual_position"; +import * as _100 from "./subaccounts/query"; +import * as _101 from "./subaccounts/subaccount"; +import * as _102 from "./vault/genesis"; +import * as _103 from "./vault/params"; +import * as _104 from "./vault/query"; +import * as _105 from "./vault/tx"; +import * as _106 from "./vault/vault"; +import * as _107 from "./vest/genesis"; +import * as _108 from "./vest/query"; +import * as _109 from "./vest/tx"; +import * as _110 from "./vest/vest_entry"; +import * as _118 from "./assets/query.lcd"; +import * as _119 from "./blocktime/query.lcd"; +import * as _120 from "./bridge/query.lcd"; +import * as _121 from "./clob/query.lcd"; +import * as _122 from "./delaymsg/query.lcd"; +import * as _123 from "./epochs/query.lcd"; +import * as _124 from "./feetiers/query.lcd"; +import * as _125 from "./perpetuals/query.lcd"; +import * as _126 from "./prices/query.lcd"; +import * as _127 from "./ratelimit/query.lcd"; +import * as _128 from "./rewards/query.lcd"; +import * as _129 from "./stats/query.lcd"; +import * as _130 from "./subaccounts/query.lcd"; +import * as _131 from "./vault/query.lcd"; +import * as _132 from "./vest/query.lcd"; +import * as _133 from "./assets/query.rpc.Query"; +import * as _134 from "./blocktime/query.rpc.Query"; +import * as _135 from "./bridge/query.rpc.Query"; +import * as _136 from "./clob/query.rpc.Query"; +import * as _137 from "./delaymsg/query.rpc.Query"; +import * as _138 from "./epochs/query.rpc.Query"; +import * as _139 from "./feetiers/query.rpc.Query"; +import * as _140 from "./govplus/query.rpc.Query"; +import * as _141 from "./listing/query.rpc.Query"; +import * as _142 from "./perpetuals/query.rpc.Query"; +import * as _143 from "./prices/query.rpc.Query"; +import * as _144 from "./ratelimit/query.rpc.Query"; +import * as _145 from "./revshare/query.rpc.Query"; +import * as _146 from "./rewards/query.rpc.Query"; +import * as _147 from "./sending/query.rpc.Query"; +import * as _148 from "./stats/query.rpc.Query"; +import * as _149 from "./subaccounts/query.rpc.Query"; +import * as _150 from "./vault/query.rpc.Query"; +import * as _151 from "./vest/query.rpc.Query"; +import * as _152 from "./blocktime/tx.rpc.msg"; +import * as _153 from "./bridge/tx.rpc.msg"; +import * as _154 from "./clob/tx.rpc.msg"; +import * as _155 from "./delaymsg/tx.rpc.msg"; +import * as _156 from "./feetiers/tx.rpc.msg"; +import * as _157 from "./govplus/tx.rpc.msg"; +import * as _158 from "./perpetuals/tx.rpc.msg"; +import * as _159 from "./prices/tx.rpc.msg"; +import * as _160 from "./ratelimit/tx.rpc.msg"; +import * as _161 from "./rewards/tx.rpc.msg"; +import * as _162 from "./sending/tx.rpc.msg"; +import * as _163 from "./stats/tx.rpc.msg"; +import * as _164 from "./vault/tx.rpc.msg"; +import * as _165 from "./vest/tx.rpc.msg"; +import * as _166 from "./lcd"; +import * as _167 from "./rpc.query"; +import * as _168 from "./rpc.tx"; export namespace dydxprotocol { export const assets = { ..._5, ..._6, ..._7, ..._8, - ..._115, - ..._130 + ..._118, + ..._133 }; export const blocktime = { ..._9, ..._10, ..._11, ..._12, ..._13, - ..._116, - ..._131, - ..._148 + ..._119, + ..._134, + ..._152 }; export const bridge = { ..._14, ..._15, @@ -174,9 +178,9 @@ export namespace dydxprotocol { ..._17, ..._18, ..._19, - ..._117, - ..._132, - ..._149 + ..._120, + ..._135, + ..._153 }; export const clob = { ..._20, ..._21, @@ -192,9 +196,9 @@ export namespace dydxprotocol { ..._31, ..._32, ..._33, - ..._118, - ..._133, - ..._150 + ..._121, + ..._136, + ..._154 }; export namespace daemons { export const bridge = { ..._34 @@ -209,29 +213,29 @@ export namespace dydxprotocol { ..._39, ..._40, ..._41, - ..._119, - ..._134, - ..._151 + ..._122, + ..._137, + ..._155 }; export const epochs = { ..._42, ..._43, ..._44, - ..._120, - ..._135 + ..._123, + ..._138 }; export const feetiers = { ..._45, ..._46, ..._47, ..._48, - ..._121, - ..._136, - ..._152 + ..._124, + ..._139, + ..._156 }; export const govplus = { ..._49, ..._50, ..._51, - ..._137, - ..._153 + ..._140, + ..._157 }; export namespace indexer { export const events = { ..._52 @@ -256,25 +260,25 @@ export namespace dydxprotocol { export const listing = { ..._61, ..._62, ..._63, - ..._138 + ..._141 }; export const perpetuals = { ..._64, ..._65, ..._66, ..._67, ..._68, - ..._122, - ..._139, - ..._154 + ..._125, + ..._142, + ..._158 }; export const prices = { ..._69, ..._70, ..._71, ..._72, ..._73, - ..._123, - ..._140, - ..._155 + ..._126, + ..._143, + ..._159 }; export const ratelimit = { ..._74, ..._75, @@ -282,62 +286,67 @@ export namespace dydxprotocol { ..._77, ..._78, ..._79, - ..._124, - ..._141, - ..._156 + ..._127, + ..._144, + ..._160 }; - export const rewards = { ..._80, + export const revshare = { ..._80, ..._81, ..._82, - ..._83, - ..._84, - ..._125, - ..._142, - ..._157 + ..._145 }; - export const sending = { ..._85, + export const rewards = { ..._83, + ..._84, + ..._85, ..._86, ..._87, - ..._88, - ..._143, - ..._158 + ..._128, + ..._146, + ..._161 }; - export const stats = { ..._89, + export const sending = { ..._88, + ..._89, ..._90, ..._91, - ..._92, - ..._93, - ..._126, - ..._144, - ..._159 + ..._147, + ..._162 }; - export const subaccounts = { ..._94, + export const stats = { ..._92, + ..._93, + ..._94, ..._95, ..._96, - ..._97, - ..._98, - ..._127, - ..._145 + ..._129, + ..._148, + ..._163 }; - export const vault = { ..._99, + export const subaccounts = { ..._97, + ..._98, + ..._99, ..._100, ..._101, - ..._102, - ..._103, - ..._128, - ..._146, - ..._160 + ..._130, + ..._149 }; - export const vest = { ..._104, + export const vault = { ..._102, + ..._103, + ..._104, ..._105, ..._106, - ..._107, - ..._129, - ..._147, - ..._161 - }; - export const ClientFactory = { ..._162, - ..._163, + ..._131, + ..._150, ..._164 }; + export const vest = { ..._107, + ..._108, + ..._109, + ..._110, + ..._132, + ..._151, + ..._165 + }; + export const ClientFactory = { ..._166, + ..._167, + ..._168 + }; } \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts index 6dcf3e0f46..fd38646d93 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/rpc.query.ts @@ -21,6 +21,7 @@ export const createRPCQueryClient = async ({ perpetuals: (await import("./perpetuals/query.rpc.Query")).createRpcQueryExtension(client), prices: (await import("./prices/query.rpc.Query")).createRpcQueryExtension(client), ratelimit: (await import("./ratelimit/query.rpc.Query")).createRpcQueryExtension(client), + revshare: (await import("./revshare/query.rpc.Query")).createRpcQueryExtension(client), rewards: (await import("./rewards/query.rpc.Query")).createRpcQueryExtension(client), sending: (await import("./sending/query.rpc.Query")).createRpcQueryExtension(client), stats: (await import("./stats/query.rpc.Query")).createRpcQueryExtension(client), diff --git a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts index 00f0f6ad8e..df1f6e9c26 100644 --- a/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/gogoproto/bundle.ts @@ -1,3 +1,3 @@ -import * as _108 from "./gogo"; -export const gogoproto = { ..._108 +import * as _111 from "./gogo"; +export const gogoproto = { ..._111 }; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/google/bundle.ts b/indexer/packages/v4-protos/src/codegen/google/bundle.ts index dcaafe793c..300175d5bf 100644 --- a/indexer/packages/v4-protos/src/codegen/google/bundle.ts +++ b/indexer/packages/v4-protos/src/codegen/google/bundle.ts @@ -1,16 +1,16 @@ -import * as _109 from "./api/annotations"; -import * as _110 from "./api/http"; -import * as _111 from "./protobuf/descriptor"; -import * as _112 from "./protobuf/duration"; -import * as _113 from "./protobuf/timestamp"; -import * as _114 from "./protobuf/any"; +import * as _112 from "./api/annotations"; +import * as _113 from "./api/http"; +import * as _114 from "./protobuf/descriptor"; +import * as _115 from "./protobuf/duration"; +import * as _116 from "./protobuf/timestamp"; +import * as _117 from "./protobuf/any"; export namespace google { - export const api = { ..._109, - ..._110 + export const api = { ..._112, + ..._113 }; - export const protobuf = { ..._111, - ..._112, - ..._113, - ..._114 + export const protobuf = { ..._114, + ..._115, + ..._116, + ..._117 }; } \ No newline at end of file diff --git a/proto/dydxprotocol/revshare/genesis.proto b/proto/dydxprotocol/revshare/genesis.proto new file mode 100644 index 0000000000..7346cf9cec --- /dev/null +++ b/proto/dydxprotocol/revshare/genesis.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package dydxprotocol.revshare; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; + +// GenesisState defines `x/listing`'s genesis state. +message GenesisState {} \ No newline at end of file diff --git a/proto/dydxprotocol/revshare/query.proto b/proto/dydxprotocol/revshare/query.proto new file mode 100644 index 0000000000..0097e39bf1 --- /dev/null +++ b/proto/dydxprotocol/revshare/query.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package dydxprotocol.revshare; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; + +// Query defines the gRPC querier service. +service Query {} \ No newline at end of file diff --git a/proto/dydxprotocol/revshare/tx.proto b/proto/dydxprotocol/revshare/tx.proto new file mode 100644 index 0000000000..7ebdcef7e0 --- /dev/null +++ b/proto/dydxprotocol/revshare/tx.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; +package dydxprotocol.revshare; + +option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; + +// Msg defines the Msg service. +service Msg {} \ No newline at end of file diff --git a/protocol/app/app.go b/protocol/app/app.go index 656713122d..5e526f3b20 100644 --- a/protocol/app/app.go +++ b/protocol/app/app.go @@ -169,6 +169,9 @@ import ( ratelimitmodule "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit" ratelimitmodulekeeper "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/keeper" ratelimitmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit/types" + revsharemodule "github.com/dydxprotocol/v4-chain/protocol/x/revshare" + revsharemodulekeeper "github.com/dydxprotocol/v4-chain/protocol/x/revshare/keeper" + revsharemoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" rewardsmodule "github.com/dydxprotocol/v4-chain/protocol/x/rewards" rewardsmodulekeeper "github.com/dydxprotocol/v4-chain/protocol/x/rewards/keeper" rewardsmoduletypes "github.com/dydxprotocol/v4-chain/protocol/x/rewards/types" @@ -310,6 +313,8 @@ type App struct { RewardsKeeper rewardsmodulekeeper.Keeper + RevShareKeeper revsharemodulekeeper.Keeper + StatsKeeper statsmodulekeeper.Keeper SubaccountsKeeper subaccountsmodulekeeper.Keeper @@ -431,6 +436,7 @@ func New( epochsmoduletypes.StoreKey, govplusmoduletypes.StoreKey, vaultmoduletypes.StoreKey, + revsharemoduletypes.StoreKey, ) keys[authtypes.StoreKey] = keys[authtypes.StoreKey].WithLocking() tkeys := storetypes.NewTransientStoreKeys( @@ -1113,6 +1119,15 @@ func New( ) listingModule := listingmodule.NewAppModule(appCodec, app.ListingKeeper) + app.RevShareKeeper = *revsharemodulekeeper.NewKeeper( + appCodec, + keys[revsharemoduletypes.StoreKey], + []string{ + lib.GovModuleAddress.String(), + }, + ) + revShareModule := revsharemodule.NewAppModule(appCodec, app.RevShareKeeper) + /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment @@ -1182,6 +1197,7 @@ func New( rateLimitModule, vaultModule, listingModule, + revShareModule, ) app.ModuleManager.SetOrderPreBlockers( @@ -1230,6 +1246,7 @@ func New( delaymsgmoduletypes.ModuleName, vaultmoduletypes.ModuleName, listingmoduletypes.ModuleName, + revsharemoduletypes.ModuleName, ) app.ModuleManager.SetOrderPrepareCheckStaters( @@ -1271,6 +1288,7 @@ func New( delaymsgmoduletypes.ModuleName, vaultmoduletypes.ModuleName, listingmoduletypes.ModuleName, + revsharemoduletypes.ModuleName, authz.ModuleName, // No-op. blocktimemoduletypes.ModuleName, // Must be last ) @@ -1316,6 +1334,7 @@ func New( delaymsgmoduletypes.ModuleName, vaultmoduletypes.ModuleName, listingmoduletypes.ModuleName, + revsharemoduletypes.ModuleName, authz.ModuleName, ) @@ -1357,6 +1376,7 @@ func New( delaymsgmoduletypes.ModuleName, vaultmoduletypes.ModuleName, listingmoduletypes.ModuleName, + revsharemoduletypes.ModuleName, authz.ModuleName, // Auth must be migrated after staking. diff --git a/protocol/app/app_test.go b/protocol/app/app_test.go index d8ee57a368..eec6a54ced 100644 --- a/protocol/app/app_test.go +++ b/protocol/app/app_test.go @@ -44,6 +44,7 @@ import ( perpetualsmodule "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals" pricesmodule "github.com/dydxprotocol/v4-chain/protocol/x/prices" ratelimitmodule "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit" + revsharemodule "github.com/dydxprotocol/v4-chain/protocol/x/revshare" rewardsmodule "github.com/dydxprotocol/v4-chain/protocol/x/rewards" sendingmodule "github.com/dydxprotocol/v4-chain/protocol/x/sending" statsmodule "github.com/dydxprotocol/v4-chain/protocol/x/stats" @@ -217,6 +218,7 @@ func TestModuleBasics(t *testing.T) { ratelimitmodule.AppModuleBasic{}, vaultmodule.AppModuleBasic{}, listingmodule.AppModuleBasic{}, + revsharemodule.AppModuleBasic{}, ) app := testapp.DefaultTestApp(nil) diff --git a/protocol/app/basic_manager/basic_manager.go b/protocol/app/basic_manager/basic_manager.go index f1cec344bc..564597539b 100644 --- a/protocol/app/basic_manager/basic_manager.go +++ b/protocol/app/basic_manager/basic_manager.go @@ -32,6 +32,7 @@ import ( perpetualsmodule "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals" pricesmodule "github.com/dydxprotocol/v4-chain/protocol/x/prices" ratelimitmodule "github.com/dydxprotocol/v4-chain/protocol/x/ratelimit" + revsharemodule "github.com/dydxprotocol/v4-chain/protocol/x/revshare" rewardsmodule "github.com/dydxprotocol/v4-chain/protocol/x/rewards" sendingmodule "github.com/dydxprotocol/v4-chain/protocol/x/sending" statsmodule "github.com/dydxprotocol/v4-chain/protocol/x/stats" @@ -93,5 +94,6 @@ var ( ratelimitmodule.AppModuleBasic{}, govplusmodule.AppModuleBasic{}, vaultmodule.AppModuleBasic{}, + revsharemodule.AppModuleBasic{}, ) ) diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index 109e2e42a0..3b7d50b937 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -409,6 +409,7 @@ "fee_multiplier_ppm": 990000 } }, + "revshare": {}, "sending": {}, "slashing": { "params": { diff --git a/protocol/app/upgrades/v6.0.0/constants.go b/protocol/app/upgrades/v6.0.0/constants.go index 44632c8218..52ba4eea59 100644 --- a/protocol/app/upgrades/v6.0.0/constants.go +++ b/protocol/app/upgrades/v6.0.0/constants.go @@ -4,6 +4,7 @@ import ( store "cosmossdk.io/store/types" "github.com/dydxprotocol/v4-chain/protocol/app/upgrades" listingtypes "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" + revsharetypes "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" ) const ( @@ -15,6 +16,7 @@ var Upgrade = upgrades.Upgrade{ StoreUpgrades: store.StoreUpgrades{ Added: []string{ listingtypes.StoreKey, + revsharetypes.StoreKey, }, }, } diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 912cf6d4c1..3eb4ea4b2a 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -1760,6 +1760,7 @@ "treasury_account": "rewards_treasury" } }, + "revshare": {}, "sending": {}, "slashing": { "missed_blocks": [], diff --git a/protocol/testing/containertest/preupgrade_genesis.json b/protocol/testing/containertest/preupgrade_genesis.json index 9821fdcf53..fe7d91fd22 100644 --- a/protocol/testing/containertest/preupgrade_genesis.json +++ b/protocol/testing/containertest/preupgrade_genesis.json @@ -2187,6 +2187,7 @@ "fee_multiplier_ppm": 990000 } }, + "revshare": {}, "sending": {}, "slashing": { "params": { diff --git a/protocol/testutil/constants/genesis.go b/protocol/testutil/constants/genesis.go index 3155ecbe51..61f1bdf0af 100644 --- a/protocol/testutil/constants/genesis.go +++ b/protocol/testutil/constants/genesis.go @@ -1357,6 +1357,7 @@ const GenesisState = `{ "fee_multiplier_ppm":990000 } }, + "revshare": {}, "ratelimit": { "limit_params_list": [ { diff --git a/protocol/x/revshare/client/cli/query.go b/protocol/x/revshare/client/cli/query.go new file mode 100644 index 0000000000..ee7d7f555d --- /dev/null +++ b/protocol/x/revshare/client/cli/query.go @@ -0,0 +1,24 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" +) + +// GetQueryCmd returns the cli query commands for this module. +func GetQueryCmd(queryRoute string) *cobra.Command { + // Group x/listing queries under a subcommand. + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + return cmd +} diff --git a/protocol/x/revshare/client/cli/tx.go b/protocol/x/revshare/client/cli/tx.go new file mode 100644 index 0000000000..e922972066 --- /dev/null +++ b/protocol/x/revshare/client/cli/tx.go @@ -0,0 +1,23 @@ +package cli + +import ( + "fmt" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" +) + +// GetTxCmd returns the transaction commands for this module. +func GetTxCmd() *cobra.Command { + cmd := &cobra.Command{ + Use: types.ModuleName, + Short: fmt.Sprintf("%s transactions subcommands", types.ModuleName), + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + return cmd +} diff --git a/protocol/x/revshare/genesis.go b/protocol/x/revshare/genesis.go new file mode 100644 index 0000000000..8bdcdbcde8 --- /dev/null +++ b/protocol/x/revshare/genesis.go @@ -0,0 +1,16 @@ +package revshare + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/keeper" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" +) + +// InitGenesis initializes the module's state from a provided genesis state. +func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { +} + +// ExportGenesis returns the module's exported genesis. +func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { + return &types.GenesisState{} +} diff --git a/protocol/x/revshare/keeper/grpc_query.go b/protocol/x/revshare/keeper/grpc_query.go new file mode 100644 index 0000000000..3b81bdb67b --- /dev/null +++ b/protocol/x/revshare/keeper/grpc_query.go @@ -0,0 +1,7 @@ +package keeper + +import ( + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" +) + +var _ types.QueryServer = Keeper{} diff --git a/protocol/x/revshare/keeper/keeper.go b/protocol/x/revshare/keeper/keeper.go new file mode 100644 index 0000000000..0ae10090b4 --- /dev/null +++ b/protocol/x/revshare/keeper/keeper.go @@ -0,0 +1,43 @@ +package keeper + +import ( + "fmt" + + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/dydxprotocol/v4-chain/protocol/lib" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" +) + +type ( + Keeper struct { + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + authorities map[string]struct{} + } +) + +func NewKeeper( + cdc codec.BinaryCodec, + storeKey storetypes.StoreKey, + authorities []string, +) *Keeper { + return &Keeper{ + cdc: cdc, + storeKey: storeKey, + authorities: lib.UniqueSliceToSet(authorities), + } +} + +func (k Keeper) HasAuthority(authority string) bool { + _, ok := k.authorities[authority] + return ok +} + +func (k Keeper) Logger(ctx sdk.Context) log.Logger { + return ctx.Logger().With(log.ModuleKey, fmt.Sprintf("x/%s", types.ModuleName)) +} + +func (k Keeper) InitializeForGenesis(ctx sdk.Context) {} diff --git a/protocol/x/revshare/keeper/keeper_test.go b/protocol/x/revshare/keeper/keeper_test.go new file mode 100644 index 0000000000..9c3c803630 --- /dev/null +++ b/protocol/x/revshare/keeper/keeper_test.go @@ -0,0 +1,16 @@ +package keeper_test + +import ( + "testing" + + testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" + "github.com/stretchr/testify/require" +) + +func TestLogger(t *testing.T) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + + logger := tApp.App.VaultKeeper.Logger(ctx) + require.NotNil(t, logger) +} diff --git a/protocol/x/revshare/keeper/msg_server.go b/protocol/x/revshare/keeper/msg_server.go new file mode 100644 index 0000000000..f4c769767b --- /dev/null +++ b/protocol/x/revshare/keeper/msg_server.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ types.MsgServer = msgServer{} diff --git a/protocol/x/revshare/keeper/msg_server_test.go b/protocol/x/revshare/keeper/msg_server_test.go new file mode 100644 index 0000000000..5115f74989 --- /dev/null +++ b/protocol/x/revshare/keeper/msg_server_test.go @@ -0,0 +1,26 @@ +package keeper_test + +import ( + "context" + "testing" + + testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/keeper" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" + "github.com/stretchr/testify/require" +) + +func setupMsgServer(t *testing.T) (keeper.Keeper, types.MsgServer, context.Context) { + tApp := testapp.NewTestAppBuilder(t).Build() + ctx := tApp.InitChain() + k := tApp.App.VaultKeeper + + return k, keeper.NewMsgServerImpl(k), ctx +} + +func TestMsgServer(t *testing.T) { + k, ms, ctx := setupMsgServer(t) + require.NotNil(t, k) + require.NotNil(t, ms) + require.NotNil(t, ctx) +} diff --git a/protocol/x/revshare/module.go b/protocol/x/revshare/module.go new file mode 100644 index 0000000000..460b204145 --- /dev/null +++ b/protocol/x/revshare/module.go @@ -0,0 +1,143 @@ +package revshare + +import ( + "encoding/json" + "fmt" + + "cosmossdk.io/core/appmodule" + + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/client/cli" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/keeper" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" +) + +var ( + _ module.AppModuleBasic = AppModuleBasic{} + _ module.HasGenesisBasics = AppModuleBasic{} + + _ appmodule.AppModule = AppModule{} + _ module.HasConsensusVersion = AppModule{} + _ module.HasGenesis = AppModule{} + _ module.HasServices = AppModule{} +) + +// ---------------------------------------------------------------------------- +// AppModuleBasic +// ---------------------------------------------------------------------------- + +// AppModuleBasic implements the AppModuleBasic interface that defines the independent methods a Cosmos SDK module +// needs to implement. +type AppModuleBasic struct { + cdc codec.BinaryCodec +} + +func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic { + return AppModuleBasic{cdc: cdc} +} + +// Name returns the name of the module as a string. +func (AppModuleBasic) Name() string { + return types.ModuleName +} + +// RegisterLegacyAminoCodec registers the amino codec for the module, which is used to marshal and unmarshal structs +// to/from []byte in order to persist them in the module's KVStore. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + types.RegisterCodec(cdc) +} + +// RegisterInterfaces registers a module's interface types and their concrete implementations as proto.Message. +func (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry) { + types.RegisterInterfaces(reg) +} + +// DefaultGenesis returns a default GenesisState for the module, marshalled to json.RawMessage. The default +// GenesisState need to be defined by the module developer and is primarily used for testing. +func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + return cdc.MustMarshalJSON(types.DefaultGenesis()) +} + +// ValidateGenesis used to validate the GenesisState, given in its json.RawMessage form. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var genState types.GenesisState + if err := cdc.UnmarshalJSON(bz, &genState); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) + } + return genState.Validate() +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module. +func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux) {} + +// GetTxCmd returns the root Tx command for the module. The subcommands of this root command are used by end-users to +// generate new transactions containing messages defined in the module. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + +// GetQueryCmd returns the root query command for the module. The subcommands of this root command are used by +// end-users to generate new queries to the subset of the state defined by the module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return cli.GetQueryCmd(types.StoreKey) +} + +// ---------------------------------------------------------------------------- +// AppModule +// ---------------------------------------------------------------------------- + +// AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement. +type AppModule struct { + AppModuleBasic + + keeper keeper.Keeper +} + +func NewAppModule( + cdc codec.Codec, + keeper keeper.Keeper, +) AppModule { + return AppModule{ + AppModuleBasic: NewAppModuleBasic(cdc), + keeper: keeper, + } +} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + +// IsOnePerModuleType is a marker function just indicates that this is a one-per-module type. +func (am AppModule) IsOnePerModuleType() {} + +// RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries. +func (am AppModule) RegisterServices(cfg module.Configurator) { + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) + types.RegisterQueryServer(cfg.QueryServer(), am.keeper) +} + +// InitGenesis performs the module's genesis initialization. It returns no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) { + var genState types.GenesisState + // Initialize global index to index in genesis state. + cdc.MustUnmarshalJSON(gs, &genState) + + InitGenesis(ctx, am.keeper, genState) +} + +// ExportGenesis returns the module's exported genesis state as raw JSON bytes. +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + genState := ExportGenesis(ctx, am.keeper) + return cdc.MustMarshalJSON(genState) +} + +// ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each +// consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should +// be set to 1. +func (AppModule) ConsensusVersion() uint64 { return 1 } diff --git a/protocol/x/revshare/types/codec.go b/protocol/x/revshare/types/codec.go new file mode 100644 index 0000000000..b68229b0d6 --- /dev/null +++ b/protocol/x/revshare/types/codec.go @@ -0,0 +1,19 @@ +package types + +import ( + "github.com/cosmos/cosmos-sdk/codec" + cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + "github.com/dydxprotocol/v4-chain/protocol/app/module" +) + +func RegisterCodec(cdc *codec.LegacyAmino) {} + +func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + Amino = codec.NewLegacyAmino() + ModuleCdc = codec.NewProtoCodec(module.InterfaceRegistry) +) diff --git a/protocol/x/revshare/types/errors.go b/protocol/x/revshare/types/errors.go new file mode 100644 index 0000000000..a9fa89a594 --- /dev/null +++ b/protocol/x/revshare/types/errors.go @@ -0,0 +1,5 @@ +package types + +var ( +// Add x/listing specific errors here +) diff --git a/protocol/x/revshare/types/expected_keepers.go b/protocol/x/revshare/types/expected_keepers.go new file mode 100644 index 0000000000..ab1254f4c2 --- /dev/null +++ b/protocol/x/revshare/types/expected_keepers.go @@ -0,0 +1 @@ +package types diff --git a/protocol/x/revshare/types/genesis.go b/protocol/x/revshare/types/genesis.go new file mode 100644 index 0000000000..09583a5f2e --- /dev/null +++ b/protocol/x/revshare/types/genesis.go @@ -0,0 +1,12 @@ +package types + +// DefaultGenesis returns the default stats genesis state. +func DefaultGenesis() *GenesisState { + return &GenesisState{} +} + +// Validate performs basic genesis state validation returning an error upon any +// failure. +func (gs GenesisState) Validate() error { + return nil +} diff --git a/protocol/x/revshare/types/genesis.pb.go b/protocol/x/revshare/types/genesis.pb.go new file mode 100644 index 0000000000..87b0c56009 --- /dev/null +++ b/protocol/x/revshare/types/genesis.pb.go @@ -0,0 +1,265 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/revshare/genesis.proto + +package types + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines `x/listing`'s genesis state. +type GenesisState struct { +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_f930be52e9995581, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func init() { + proto.RegisterType((*GenesisState)(nil), "dydxprotocol.revshare.GenesisState") +} + +func init() { + proto.RegisterFile("dydxprotocol/revshare/genesis.proto", fileDescriptor_f930be52e9995581) +} + +var fileDescriptor_f930be52e9995581 = []byte{ + // 144 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4a, 0x2d, 0x2b, 0xce, 0x48, 0x2c, + 0x4a, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x03, 0xcb, 0x08, 0x89, 0x22, 0x2b, + 0xd2, 0x83, 0x29, 0x52, 0xe2, 0xe3, 0xe2, 0x71, 0x87, 0xa8, 0x0b, 0x2e, 0x49, 0x2c, 0x49, 0x75, + 0x0a, 0x39, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, + 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xab, 0xf4, 0xcc, 0x92, + 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x14, 0x0b, 0xcb, 0x4c, 0x74, 0x93, 0x33, 0x12, + 0x33, 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x08, 0x47, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, + 0xa5, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xd9, 0xba, 0xb5, 0xb2, 0xaa, 0x00, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/protocol/x/revshare/types/keys.go b/protocol/x/revshare/types/keys.go new file mode 100644 index 0000000000..0b7d7a4a8e --- /dev/null +++ b/protocol/x/revshare/types/keys.go @@ -0,0 +1,10 @@ +package types + +// Module name and store keys. +const ( + // ModuleName defines the module name. + ModuleName = "revshare" + + // StoreKey defines the primary module store key. + StoreKey = ModuleName +) diff --git a/protocol/x/revshare/types/query.pb.go b/protocol/x/revshare/types/query.pb.go new file mode 100644 index 0000000000..b65c117d77 --- /dev/null +++ b/protocol/x/revshare/types/query.pb.go @@ -0,0 +1,81 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/revshare/query.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("dydxprotocol/revshare/query.proto", fileDescriptor_13d50c6e3048e744) } + +var fileDescriptor_13d50c6e3048e744 = []byte{ + // 137 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4a, 0x2d, 0x2b, 0xce, 0x48, 0x2c, + 0x4a, 0xd5, 0x2f, 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x03, 0x8b, 0x0b, 0x89, 0x22, 0x2b, 0xd1, 0x83, + 0x29, 0x31, 0x62, 0xe7, 0x62, 0x0d, 0x04, 0xa9, 0x72, 0x0a, 0x39, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, + 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, + 0xc6, 0x63, 0x39, 0x86, 0x28, 0xab, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, + 0x7d, 0x14, 0x7b, 0xca, 0x4c, 0x74, 0x93, 0x33, 0x12, 0x33, 0xf3, 0xf4, 0xe1, 0x22, 0x15, 0x08, + 0xbb, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x52, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x67, 0x77, 0xeb, 0xea, 0xa1, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// 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. +type QueryClient interface { +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +// QueryServer is the server API for Query service. +type QueryServer interface { +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.revshare.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/revshare/query.proto", +} diff --git a/protocol/x/revshare/types/tx.pb.go b/protocol/x/revshare/types/tx.pb.go new file mode 100644 index 0000000000..1a80d9199e --- /dev/null +++ b/protocol/x/revshare/types/tx.pb.go @@ -0,0 +1,81 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: dydxprotocol/revshare/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + math "math" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +func init() { proto.RegisterFile("dydxprotocol/revshare/tx.proto", fileDescriptor_460d8062a262197e) } + +var fileDescriptor_460d8062a262197e = []byte{ + // 133 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xa9, 0x4c, 0xa9, + 0x28, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0xce, 0xcf, 0xd1, 0x2f, 0x4a, 0x2d, 0x2b, 0xce, 0x48, 0x2c, + 0x4a, 0xd5, 0x2f, 0xa9, 0xd0, 0x03, 0x0b, 0x0a, 0x89, 0x22, 0xcb, 0xeb, 0xc1, 0xe4, 0x8d, 0x58, + 0xb9, 0x98, 0x7d, 0x8b, 0xd3, 0x9d, 0x42, 0x4e, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, + 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, + 0x21, 0xca, 0x2a, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xc5, 0x8a, + 0x32, 0x13, 0xdd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x7d, 0xb8, 0x48, 0x05, 0x92, 0xb5, 0x95, 0x05, + 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x29, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x79, 0x82, + 0xc6, 0x9c, 0x00, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "dydxprotocol.revshare.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "dydxprotocol/revshare/tx.proto", +} From a437fefe19067dfd1cd96fac98cf37651fc4b317 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Tue, 18 Jun 2024 16:26:26 -0400 Subject: [PATCH 2/5] make ci happy maybe Signed-off-by: Shrenuj Bansal --- .../codegen/dydxprotocol/revshare/genesis.ts | 42 +++++++++++++++++++ .../dydxprotocol/revshare/query.rpc.Query.ts | 18 ++++++++ .../codegen/dydxprotocol/revshare/query.ts | 1 + .../src/codegen/dydxprotocol/revshare/tx.ts | 1 + .../app/testdata/default_genesis_state.json | 2 +- .../scripts/genesis/sample_pregenesis.json | 2 +- .../containertest/preupgrade_genesis.json | 2 +- protocol/testutil/constants/genesis.go | 2 +- protocol/x/listing/keeper/keeper.go | 2 +- protocol/x/listing/keeper/msg_server_test.go | 6 +-- protocol/x/revshare/keeper/msg_server_test.go | 2 +- 11 files changed, 71 insertions(+), 9 deletions(-) create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts create mode 100644 indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.ts diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts new file mode 100644 index 0000000000..9bec4aff2b --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts @@ -0,0 +1,42 @@ +import * as _m0 from "protobufjs/minimal"; +import { DeepPartial } from "../../helpers"; +/** GenesisState defines `x/listing`'s genesis state. */ + +export interface GenesisState {} +/** GenesisState defines `x/listing`'s genesis state. */ + +export interface GenesisStateSDKType {} + +function createBaseGenesisState(): GenesisState { + return {}; +} + +export const GenesisState = { + encode(_: GenesisState, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): GenesisState { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenesisState(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(_: DeepPartial): GenesisState { + const message = createBaseGenesisState(); + return message; + } + +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts new file mode 100644 index 0000000000..ab81adee85 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.rpc.Query.ts @@ -0,0 +1,18 @@ +import { Rpc } from "../../helpers"; +import { QueryClient, createProtobufRpcClient } from "@cosmjs/stargate"; +/** Query defines the gRPC querier service. */ + +export interface Query {} +export class QueryClientImpl implements Query { + private readonly rpc: Rpc; + + constructor(rpc: Rpc) { + this.rpc = rpc; + } + +} +export const createRpcQueryExtension = (base: QueryClient) => { + const rpc = createProtobufRpcClient(base); + const queryService = new QueryClientImpl(rpc); + return {}; +}; \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts new file mode 100644 index 0000000000..693da49fc4 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/query.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.ts new file mode 100644 index 0000000000..693da49fc4 --- /dev/null +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/tx.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/protocol/app/testdata/default_genesis_state.json b/protocol/app/testdata/default_genesis_state.json index 3b7d50b937..8d645dbd27 100644 --- a/protocol/app/testdata/default_genesis_state.json +++ b/protocol/app/testdata/default_genesis_state.json @@ -400,6 +400,7 @@ } ] }, + "revshare": {}, "rewards": { "params": { "treasury_account": "rewards_treasury", @@ -409,7 +410,6 @@ "fee_multiplier_ppm": 990000 } }, - "revshare": {}, "sending": {}, "slashing": { "params": { diff --git a/protocol/scripts/genesis/sample_pregenesis.json b/protocol/scripts/genesis/sample_pregenesis.json index 3eb4ea4b2a..8f2d0cc3ec 100644 --- a/protocol/scripts/genesis/sample_pregenesis.json +++ b/protocol/scripts/genesis/sample_pregenesis.json @@ -1751,6 +1751,7 @@ } ] }, + "revshare": {}, "rewards": { "params": { "denom": "asample", @@ -1760,7 +1761,6 @@ "treasury_account": "rewards_treasury" } }, - "revshare": {}, "sending": {}, "slashing": { "missed_blocks": [], diff --git a/protocol/testing/containertest/preupgrade_genesis.json b/protocol/testing/containertest/preupgrade_genesis.json index fe7d91fd22..7aad403879 100644 --- a/protocol/testing/containertest/preupgrade_genesis.json +++ b/protocol/testing/containertest/preupgrade_genesis.json @@ -2178,6 +2178,7 @@ } ] }, + "revshare": {}, "rewards": { "params": { "treasury_account": "rewards_treasury", @@ -2187,7 +2188,6 @@ "fee_multiplier_ppm": 990000 } }, - "revshare": {}, "sending": {}, "slashing": { "params": { diff --git a/protocol/testutil/constants/genesis.go b/protocol/testutil/constants/genesis.go index 61f1bdf0af..f818eb033c 100644 --- a/protocol/testutil/constants/genesis.go +++ b/protocol/testutil/constants/genesis.go @@ -1348,6 +1348,7 @@ const GenesisState = `{ } ] }, + "revshare": {}, "rewards": { "params": { "treasury_account":"rewards_treasury", @@ -1357,7 +1358,6 @@ const GenesisState = `{ "fee_multiplier_ppm":990000 } }, - "revshare": {}, "ratelimit": { "limit_params_list": [ { diff --git a/protocol/x/listing/keeper/keeper.go b/protocol/x/listing/keeper/keeper.go index 319158f723..032067c2ad 100644 --- a/protocol/x/listing/keeper/keeper.go +++ b/protocol/x/listing/keeper/keeper.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dydxprotocol/v4-chain/protocol/lib" - "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" ) type ( diff --git a/protocol/x/listing/keeper/msg_server_test.go b/protocol/x/listing/keeper/msg_server_test.go index a49577ab61..bccbd4a199 100644 --- a/protocol/x/listing/keeper/msg_server_test.go +++ b/protocol/x/listing/keeper/msg_server_test.go @@ -5,15 +5,15 @@ import ( "testing" testapp "github.com/dydxprotocol/v4-chain/protocol/testutil/app" - "github.com/dydxprotocol/v4-chain/protocol/x/vault/keeper" - "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/keeper" + "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" "github.com/stretchr/testify/require" ) func setupMsgServer(t *testing.T) (keeper.Keeper, types.MsgServer, context.Context) { tApp := testapp.NewTestAppBuilder(t).Build() ctx := tApp.InitChain() - k := tApp.App.VaultKeeper + k := tApp.App.ListingKeeper return k, keeper.NewMsgServerImpl(k), ctx } diff --git a/protocol/x/revshare/keeper/msg_server_test.go b/protocol/x/revshare/keeper/msg_server_test.go index 5115f74989..5b19004a2c 100644 --- a/protocol/x/revshare/keeper/msg_server_test.go +++ b/protocol/x/revshare/keeper/msg_server_test.go @@ -13,7 +13,7 @@ import ( func setupMsgServer(t *testing.T) (keeper.Keeper, types.MsgServer, context.Context) { tApp := testapp.NewTestAppBuilder(t).Build() ctx := tApp.InitChain() - k := tApp.App.VaultKeeper + k := tApp.App.RevShareKeeper return k, keeper.NewMsgServerImpl(k), ctx } From 855c16e7a5f13d723722a1543b780b048cac9f22 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Tue, 18 Jun 2024 17:14:55 -0400 Subject: [PATCH 3/5] fix module names Signed-off-by: Shrenuj Bansal --- proto/dydxprotocol/revshare/genesis.proto | 2 +- protocol/x/revshare/client/cli/query.go | 4 ++-- protocol/x/revshare/keeper/grpc_query.go | 2 +- protocol/x/revshare/types/errors.go | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/proto/dydxprotocol/revshare/genesis.proto b/proto/dydxprotocol/revshare/genesis.proto index 7346cf9cec..fbcaaef8ad 100644 --- a/proto/dydxprotocol/revshare/genesis.proto +++ b/proto/dydxprotocol/revshare/genesis.proto @@ -3,5 +3,5 @@ package dydxprotocol.revshare; option go_package = "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types"; -// GenesisState defines `x/listing`'s genesis state. +// GenesisState defines `x/revshare`'s genesis state. message GenesisState {} \ No newline at end of file diff --git a/protocol/x/revshare/client/cli/query.go b/protocol/x/revshare/client/cli/query.go index ee7d7f555d..d218c26234 100644 --- a/protocol/x/revshare/client/cli/query.go +++ b/protocol/x/revshare/client/cli/query.go @@ -6,12 +6,12 @@ import ( "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - "github.com/dydxprotocol/v4-chain/protocol/x/vault/types" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" ) // GetQueryCmd returns the cli query commands for this module. func GetQueryCmd(queryRoute string) *cobra.Command { - // Group x/listing queries under a subcommand. + // Group x/revshare queries under a subcommand. cmd := &cobra.Command{ Use: types.ModuleName, Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), diff --git a/protocol/x/revshare/keeper/grpc_query.go b/protocol/x/revshare/keeper/grpc_query.go index 3b81bdb67b..b7e9c56acf 100644 --- a/protocol/x/revshare/keeper/grpc_query.go +++ b/protocol/x/revshare/keeper/grpc_query.go @@ -1,7 +1,7 @@ package keeper import ( - "github.com/dydxprotocol/v4-chain/protocol/x/listing/types" + "github.com/dydxprotocol/v4-chain/protocol/x/revshare/types" ) var _ types.QueryServer = Keeper{} diff --git a/protocol/x/revshare/types/errors.go b/protocol/x/revshare/types/errors.go index a9fa89a594..63bf5c3486 100644 --- a/protocol/x/revshare/types/errors.go +++ b/protocol/x/revshare/types/errors.go @@ -1,5 +1,5 @@ package types var ( -// Add x/listing specific errors here +// Add x/revshare specific errors here ) From 92776db4af3e81f824bf986ebe3267f19d1fa04c Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Tue, 18 Jun 2024 17:39:49 -0400 Subject: [PATCH 4/5] indexer gen again Signed-off-by: Shrenuj Bansal --- .../v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts index 9bec4aff2b..0e9258f8ea 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/revshare/genesis.ts @@ -1,9 +1,9 @@ import * as _m0 from "protobufjs/minimal"; import { DeepPartial } from "../../helpers"; -/** GenesisState defines `x/listing`'s genesis state. */ +/** GenesisState defines `x/revshare`'s genesis state. */ export interface GenesisState {} -/** GenesisState defines `x/listing`'s genesis state. */ +/** GenesisState defines `x/revshare`'s genesis state. */ export interface GenesisStateSDKType {} From 05c335bcd4cb8c40f79c48435ce4d6d9869ab437 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Tue, 18 Jun 2024 17:50:16 -0400 Subject: [PATCH 5/5] proto gen hopefully last time Signed-off-by: Shrenuj Bansal --- protocol/x/revshare/types/genesis.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocol/x/revshare/types/genesis.pb.go b/protocol/x/revshare/types/genesis.pb.go index 87b0c56009..6c8f98cadd 100644 --- a/protocol/x/revshare/types/genesis.pb.go +++ b/protocol/x/revshare/types/genesis.pb.go @@ -22,7 +22,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GenesisState defines `x/listing`'s genesis state. +// GenesisState defines `x/revshare`'s genesis state. type GenesisState struct { }