-
Notifications
You must be signed in to change notification settings - Fork 631
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: x/cosmwasmpool proto and query boilerplate (#4764)
* feat: x/cosmwasmpool proto and query boilerplate * add basic wiring to keeper * updates * Update x/cosmwasmpool/types/expected_keepers.go * remove instantiate message from pool model * Update x/cosmwasmpool/types/params.go Co-authored-by: Adam Tucker <[email protected]> * Update x/cosmwasmpool/types/params.go Co-authored-by: Adam Tucker <[email protected]> * Update x/cosmwasmpool/model/msgs.go Co-authored-by: Adam Tucker <[email protected]> * Update x/cosmwasmpool/model/msgs.go Co-authored-by: Adam Tucker <[email protected]> --------- Co-authored-by: Adam Tucker <[email protected]>
- Loading branch information
1 parent
b8689c9
commit 1fb9da8
Showing
23 changed files
with
2,776 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
syntax = "proto3"; | ||
package osmosis.cosmwasmpool.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/any.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "google/protobuf/duration.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/types"; | ||
|
||
// Params holds parameters for the cosmwasmpool module | ||
message Params {} | ||
|
||
// GenesisState defines the cosmwasmpool module's genesis state. | ||
message GenesisState { | ||
// params is the container of cosmwasmpool parameters. | ||
Params params = 1 [ (gogoproto.nullable) = false ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
syntax = "proto3"; | ||
|
||
package osmosis.cosmwasmpool.v1beta1; | ||
|
||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/model"; | ||
|
||
message CosmWasmPool { | ||
option (gogoproto.goproto_getters) = false; | ||
option (gogoproto.goproto_stringer) = false; | ||
option (cosmos_proto.implements_interface) = "PoolI"; | ||
string pool_address = 1 [ (gogoproto.moretags) = "yaml:\"pool_address\"" ]; | ||
string contract_address = 2 | ||
[ (gogoproto.moretags) = "yaml:\"contract_address\"" ]; | ||
uint64 pool_id = 3; | ||
uint64 code_id = 4; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
syntax = "proto3"; | ||
package osmosis.cosmwasmpool.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/model"; | ||
|
||
service MsgCreator { | ||
rpc CreateCosmWasmPool(MsgCreateCosmWasmPool) | ||
returns (MsgCreateCosmWasmPoolResponse); | ||
} | ||
|
||
// ===================== MsgCreateCosmwasmPool | ||
message MsgCreateCosmWasmPool { | ||
uint64 code_id = 1 [ (gogoproto.moretags) = "yaml:\"code_id\"" ]; | ||
bytes instantiate_msg = 2 | ||
[ (gogoproto.moretags) = "yaml:\"instantiate_msg\"" ]; | ||
string sender = 3 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; | ||
} | ||
|
||
// Returns a unique poolID to identify the pool with. | ||
message MsgCreateCosmWasmPoolResponse { | ||
uint64 pool_id = 1 [ (gogoproto.customname) = "PoolID" ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
syntax = "proto3"; | ||
package osmosis.cosmwasmpool.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "osmosis/cosmwasmpool/v1beta1/genesis.proto"; | ||
import "osmosis/cosmwasmpool/v1beta1/tx.proto"; | ||
|
||
import "cosmos/base/v1beta1/coin.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
import "google/api/annotations.proto"; | ||
import "google/protobuf/any.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "google/protobuf/timestamp.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/client/queryproto"; | ||
|
||
service Query { | ||
rpc Params(ParamsRequest) returns (ParamsResponse) { | ||
option (google.api.http).get = "/osmosis/cosmwasmpool/v1beta1/Params"; | ||
} | ||
} | ||
|
||
//=============================== Params | ||
message ParamsRequest {} | ||
message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
keeper: | ||
path: "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool" | ||
struct: "Keeper" | ||
client_path: "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/client" | ||
queries: | ||
Params: | ||
proto_wrapper: | ||
query_func: "k.GetParams" | ||
cli: | ||
cmd: "GetParams" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
syntax = "proto3"; | ||
package osmosis.cosmwasmpool.v1beta1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/types"; | ||
|
||
service Msg {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package grpc | ||
|
||
// THIS FILE IS GENERATED CODE, DO NOT EDIT | ||
// SOURCE AT `proto/osmosis/cosmwasmpool/v1beta1/query.yml` | ||
|
||
import ( | ||
context "context" | ||
|
||
"google.golang.org/grpc/codes" | ||
"google.golang.org/grpc/status" | ||
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/client" | ||
"github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/client/queryproto" | ||
) | ||
|
||
type Querier struct { | ||
Q client.Querier | ||
} | ||
|
||
var _ queryproto.QueryServer = Querier{} | ||
|
||
func (q Querier) Params(grpcCtx context.Context, | ||
req *queryproto.ParamsRequest, | ||
) (*queryproto.ParamsResponse, error) { | ||
if req == nil { | ||
return nil, status.Error(codes.InvalidArgument, "empty request") | ||
} | ||
ctx := sdk.UnwrapSDKContext(grpcCtx) | ||
return q.Q.Params(ctx, *req) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package client | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool" | ||
"github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/client/queryproto" | ||
) | ||
|
||
// This file should evolve to being code gen'd, off of `proto/poolmanager/v1beta/query.yml` | ||
|
||
type Querier struct { | ||
K cosmwasmpool.Keeper | ||
} | ||
|
||
func NewQuerier(k cosmwasmpool.Keeper) Querier { | ||
return Querier{k} | ||
} | ||
|
||
func (q Querier) Params(ctx sdk.Context, | ||
req queryproto.ParamsRequest, | ||
) (*queryproto.ParamsResponse, error) { | ||
params := q.K.GetParams(ctx) | ||
return &queryproto.ParamsResponse{Params: params}, nil | ||
} |
Oops, something went wrong.