Skip to content

Commit

Permalink
feat: msgupdateparams implementaion
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpioborn committed May 29, 2024
1 parent 89894fe commit 980ae0e
Show file tree
Hide file tree
Showing 79 changed files with 4,748 additions and 210 deletions.
8 changes: 8 additions & 0 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ func NewAppKeeper(
appKeepers.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(&appKeepers.WasmKeeper)
appKeepers.Ics20WasmHooks.ContractKeeper = &appKeepers.WasmKeeper

authority := authtypes.NewModuleAddress(govtypes.ModuleName).String()
// // SGE keepers \\\\

appKeepers.OrderbookKeeper = orderbookmodulekeeper.NewKeeper(
Expand All @@ -486,20 +487,23 @@ func NewAppKeeper(
AccountKeeper: appKeepers.AccountKeeper,
FeeGrantKeeper: appKeepers.FeeGrantKeeper,
},
authority,
)

appKeepers.OVMKeeper = ovmmodulekeeper.NewKeeper(
appCodec,
appKeepers.keys[ovmmoduletypes.StoreKey],
appKeepers.keys[ovmmoduletypes.MemStoreKey],
appKeepers.GetSubspace(ovmmoduletypes.ModuleName),
authority,
)

appKeepers.MarketKeeper = marketmodulekeeper.NewKeeper(
appCodec,
appKeepers.keys[marketmoduletypes.StoreKey],
appKeepers.keys[marketmoduletypes.MemStoreKey],
appKeepers.GetSubspace(marketmoduletypes.ModuleName),
authority,
)
appKeepers.MarketKeeper.SetOVMKeeper(appKeepers.OVMKeeper)
appKeepers.MarketKeeper.SetOrderbookKeeper(appKeepers.OrderbookKeeper)
Expand All @@ -509,6 +513,7 @@ func NewAppKeeper(
appKeepers.keys[betmoduletypes.StoreKey],
appKeepers.keys[betmoduletypes.MemStoreKey],
appKeepers.GetSubspace(betmoduletypes.ModuleName),
authority,
)
appKeepers.BetKeeper.SetMarketKeeper(appKeepers.MarketKeeper)
appKeepers.BetKeeper.SetOrderbookKeeper(appKeepers.OrderbookKeeper)
Expand All @@ -527,6 +532,7 @@ func NewAppKeeper(
housemodulekeeper.SdkExpectedKeepers{
AuthzKeeper: appKeepers.AuthzKeeper,
},
authority,
)
appKeepers.OrderbookKeeper.SetHouseKeeper(appKeepers.HouseKeeper)

Expand All @@ -540,6 +546,7 @@ func NewAppKeeper(
appKeepers.BetKeeper,
appKeepers.OrderbookKeeper,
appKeepers.HouseKeeper,
authority,
)

appKeepers.RewardKeeper = rewardmodulekeeper.NewKeeper(
Expand All @@ -555,6 +562,7 @@ func NewAppKeeper(
BankKeeper: appKeepers.BankKeeper,
AccountKeeper: appKeepers.AccountKeeper,
},
authority,
)

// ** Hooks ** \\
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ require (
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de
google.golang.org/grpc v1.63.2
gopkg.in/yaml.v2 v2.4.0
gotest.tools/v3 v3.5.1
mvdan.cc/gofumpt v0.5.0
)

Expand Down
1 change: 0 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2273,7 +2273,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU=
gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU=
Expand Down
4 changes: 2 additions & 2 deletions proto/buf.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 1f6ed065c9f04b5cb843d6e7603d6454
digest: shake256:7149cf5e9955c692d381e557830555d4e93f205a0f1b8e2dfdae46d029369aa3fc1980e35df0d310f7cc3b622f93e19ad276769a283a967dd3065ddfd3a40e13
commit: f0e53af8f2fc4556b94f482688b57223
digest: shake256:de26a277fc28b8b411ecf58729d78d32fcf15090ffd998a4469225b17889bfb51442eaab04bb7a8d88d203ecdf0a9febd4ffd52c18ed1c2229160c7bd353ca95
- remote: buf.build
owner: protocolbuffers
repository: wellknowntypes
Expand Down
32 changes: 31 additions & 1 deletion proto/sgenetwork/sge/bet/tx.proto
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
syntax = "proto3";
package sgenetwork.sge.bet;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "sgenetwork/sge/bet/wager.proto";
import "sgenetwork/sge/bet/params.proto";

option go_package = "github.com/sge-network/sge/x/bet/types";

// Msg defines the Msg service.
service Msg {

// Wager defines a method to place a bet with the given data.
rpc Wager(MsgWager) returns (MsgWagerResponse);

// UpdateParams defines a governance operation for updating the x/bet module
// parameters. The authority is defined in the keeper.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (cosmos_proto.method_added_in) = "sge-network 1.7.1";
}
}

// MsgWager defines a message to place a bet with the given data.
Expand All @@ -23,3 +33,23 @@ message MsgWager {
// MsgWagerResponse is the returning value in the response
// of MsgWagerResponse request.
message MsgWagerResponse { WagerProps props = 1; }

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
option (cosmos.msg.v1.signer) = "authority";

// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/bet parameters.
Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
}
30 changes: 30 additions & 0 deletions proto/sgenetwork/sge/house/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ syntax = "proto3";
package sgenetwork.sge.house;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "sgenetwork/sge/house/withdraw.proto";
import "sgenetwork/sge/house/params.proto";

option go_package = "github.com/sge-network/sge/x/house/types";

Expand All @@ -16,6 +20,12 @@ service Msg {
// Withdraw defines a method for performing a withdrawal of tokens of unused
// amount corresponding to a deposit.
rpc Withdraw(MsgWithdraw) returns (MsgWithdrawResponse);

// UpdateParams defines a governance operation for updating the x/house module
// parameters. The authority is defined in the keeper.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (cosmos_proto.method_added_in) = "sge-network 1.7.1";
}
}

// MsgDeposit defines a SDK message for performing a deposit of coins to become
Expand Down Expand Up @@ -104,3 +114,23 @@ message MsgWithdrawResponse {
uint64 participation_index = 3
[ (gogoproto.moretags) = "yaml:\"participation_index\"" ];
}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
option (cosmos.msg.v1.signer) = "authority";

// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/bet parameters.
Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
}
29 changes: 29 additions & 0 deletions proto/sgenetwork/sge/market/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ syntax = "proto3";
package sgenetwork.sge.market;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "sgenetwork/sge/market/market.proto";
import "sgenetwork/sge/market/params.proto";

option go_package = "github.com/sge-network/sge/x/market/types";

Expand All @@ -14,6 +18,11 @@ service Msg {
rpc Resolve(MsgResolve) returns (MsgResolveResponse);
// Update defines a method to update a market.
rpc Update(MsgUpdate) returns (MsgUpdateResponse);
// UpdateParams defines a governance operation for updating the x/market
// module parameters. The authority is defined in the keeper.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (cosmos_proto.method_added_in) = "sge-network 1.7.1";
}
}

// MsgAdd is the message type for adding the market into the
Expand Down Expand Up @@ -65,3 +74,23 @@ message MsgUpdateResponse {
// data is the data of market
Market data = 2 [ (gogoproto.nullable) = true ];
}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
option (cosmos.msg.v1.signer) = "authority";

// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/bet parameters.
Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
}
39 changes: 39 additions & 0 deletions proto/sgenetwork/sge/orderbook/tx.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
syntax = "proto3";
package sgenetwork.sge.orderbook;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "sgenetwork/sge/orderbook/params.proto";

option go_package = "github.com/sge-network/sge/x/orderbook/types";

// Msg defines the Msg service.
service Msg {
// UpdateParams defines a governance operation for updating the x/market
// module parameters. The authority is defined in the keeper.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (cosmos_proto.method_added_in) = "sge-network 1.7.1";
}
}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
option (cosmos.msg.v1.signer) = "authority";

// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/bet parameters.
Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
}
31 changes: 31 additions & 0 deletions proto/sgenetwork/sge/ovm/tx.proto
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
syntax = "proto3";
package sgenetwork.sge.ovm;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "sgenetwork/sge/ovm/params.proto";

option go_package = "github.com/sge-network/sge/x/ovm/types";

// Msg defines the Msg service.
Expand All @@ -13,6 +19,11 @@ service Msg {
// allowed public keys.
rpc VotePubkeysChange(MsgVotePubkeysChangeRequest)
returns (MsgVotePubkeysChangeResponse);
// UpdateParams defines a governance operation for updating the x/ovm module
// parameters. The authority is defined in the keeper.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (cosmos_proto.method_added_in) = "sge-network 1.7.1";
}
}

// MsgPubkeysChangeProposalRequest is the type of request for modification of
Expand Down Expand Up @@ -43,3 +54,23 @@ message MsgVotePubkeysChangeRequest {
// MsgVotePubkeysChangeResponse is the type of response vote for public keys
// modification.
message MsgVotePubkeysChangeResponse { bool success = 1; }

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
option (cosmos.msg.v1.signer) = "authority";

// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/bet parameters.
Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
}
29 changes: 29 additions & 0 deletions proto/sgenetwork/sge/reward/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ syntax = "proto3";
package sgenetwork.sge.reward;

import "gogoproto/gogo.proto";
import "cosmos_proto/cosmos.proto";
import "cosmos/msg/v1/msg.proto";
import "amino/amino.proto";
import "sgenetwork/sge/reward/params.proto";

option go_package = "github.com/sge-network/sge/x/reward/types";

Expand All @@ -20,6 +24,11 @@ service Msg {
rpc WithdrawFunds(MsgWithdrawFunds) returns (MsgWithdrawFundsResponse);
// GrantReward is method to allocate rewards
rpc GrantReward(MsgGrantReward) returns (MsgGrantRewardResponse);
// UpdateParams defines a governance operation for updating the x/ovm module
// parameters. The authority is defined in the keeper.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse) {
option (cosmos_proto.method_added_in) = "sge-network 1.7.1";
}
}

// MsgCreatePromoter is msg to create a promoter.
Expand Down Expand Up @@ -117,3 +126,23 @@ message MsgWithdrawFunds {

// MsgWithdrawFundsResponse withdraw funds message response type.
message MsgWithdrawFundsResponse {}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
option (cosmos.msg.v1.signer) = "authority";

// authority is the address that controls the module (defaults to x/gov unless
// overwritten).
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];

// params defines the x/bet parameters.
Params params = 2
[ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {
option (cosmos_proto.message_added_in) = "sge-network 1.7.1";
}
Loading

0 comments on commit 980ae0e

Please sign in to comment.