diff --git a/go.mod b/go.mod index dc12d8dfac3..86887beaab1 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/CosmWasm/wasmd v0.30.0 github.com/cosmos/cosmos-proto v1.0.0-alpha8 - github.com/cosmos/cosmos-sdk v0.46.11 + github.com/cosmos/cosmos-sdk v0.47.1 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/ibc-go/v4 v4.3.0 github.com/gogo/protobuf v1.3.3 diff --git a/proto/osmosis/cosmwasmpool/v1beta1/genesis.proto b/proto/osmosis/cosmwasmpool/v1beta1/genesis.proto new file mode 100644 index 00000000000..990e48639bf --- /dev/null +++ b/proto/osmosis/cosmwasmpool/v1beta1/genesis.proto @@ -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 ]; +} diff --git a/proto/osmosis/cosmwasmpool/v1beta1/model/pool.proto b/proto/osmosis/cosmwasmpool/v1beta1/model/pool.proto new file mode 100644 index 00000000000..d2254f783a6 --- /dev/null +++ b/proto/osmosis/cosmwasmpool/v1beta1/model/pool.proto @@ -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; +} diff --git a/proto/osmosis/cosmwasmpool/v1beta1/model/tx.proto b/proto/osmosis/cosmwasmpool/v1beta1/model/tx.proto new file mode 100644 index 00000000000..81410c40291 --- /dev/null +++ b/proto/osmosis/cosmwasmpool/v1beta1/model/tx.proto @@ -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" ]; +} diff --git a/proto/osmosis/cosmwasmpool/v1beta1/query.proto b/proto/osmosis/cosmwasmpool/v1beta1/query.proto new file mode 100644 index 00000000000..f262fc91700 --- /dev/null +++ b/proto/osmosis/cosmwasmpool/v1beta1/query.proto @@ -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 ]; } diff --git a/proto/osmosis/cosmwasmpool/v1beta1/query.yml b/proto/osmosis/cosmwasmpool/v1beta1/query.yml new file mode 100644 index 00000000000..cf35492de0a --- /dev/null +++ b/proto/osmosis/cosmwasmpool/v1beta1/query.yml @@ -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" diff --git a/proto/osmosis/cosmwasmpool/v1beta1/tx.proto b/proto/osmosis/cosmwasmpool/v1beta1/tx.proto new file mode 100644 index 00000000000..5020ae02dd5 --- /dev/null +++ b/proto/osmosis/cosmwasmpool/v1beta1/tx.proto @@ -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 {} diff --git a/proto/osmosis/poolmanager/v1beta1/module_route.proto b/proto/osmosis/poolmanager/v1beta1/module_route.proto index a547ba71249..e5d6098e9c9 100644 --- a/proto/osmosis/poolmanager/v1beta1/module_route.proto +++ b/proto/osmosis/poolmanager/v1beta1/module_route.proto @@ -17,6 +17,9 @@ enum PoolType { // Concentrated is the pool model specific to concentrated liquidity. It is // defined in x/concentrated-liquidity. Concentrated = 2; + // CosmWasm is the pool model specific to CosmWasm. It is defined in + // x/cosmwasmpool. + CosmWasm = 3; } // ModuleRouter defines a route encapsulating pool type. diff --git a/proto/osmosis/poolmanager/v1beta1/query.proto b/proto/osmosis/poolmanager/v1beta1/query.proto index a71152f1707..3c445c47dbb 100644 --- a/proto/osmosis/poolmanager/v1beta1/query.proto +++ b/proto/osmosis/poolmanager/v1beta1/query.proto @@ -30,8 +30,8 @@ service Query { rpc EstimateSinglePoolSwapExactAmountIn( EstimateSinglePoolSwapExactAmountInRequest) returns (EstimateSwapExactAmountInResponse) { - option (google.api.http).get = - "/osmosis/poolmanager/v1beta1/{pool_id}/estimate/single_pool_swap_exact_amount_in"; + option (google.api.http).get = "/osmosis/poolmanager/v1beta1/{pool_id}/" + "estimate/single_pool_swap_exact_amount_in"; } // Estimates swap amount in given out. @@ -45,7 +45,8 @@ service Query { EstimateSinglePoolSwapExactAmountOutRequest) returns (EstimateSwapExactAmountOutResponse) { option (google.api.http).get = - "/osmosis/poolmanager/v1beta1/{pool_id}/estimate_out/single_pool_swap_exact_amount_out"; + "/osmosis/poolmanager/v1beta1/{pool_id}/estimate_out/" + "single_pool_swap_exact_amount_out"; } // Returns the total number of pools existing in Osmosis. diff --git a/x/cosmwasmpool/client/grpc/grpc_query.go b/x/cosmwasmpool/client/grpc/grpc_query.go new file mode 100644 index 00000000000..9d58888d32f --- /dev/null +++ b/x/cosmwasmpool/client/grpc/grpc_query.go @@ -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) +} + diff --git a/x/cosmwasmpool/client/query_proto_wrap.go b/x/cosmwasmpool/client/query_proto_wrap.go new file mode 100644 index 00000000000..cf9c4e8d002 --- /dev/null +++ b/x/cosmwasmpool/client/query_proto_wrap.go @@ -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 +} diff --git a/x/cosmwasmpool/client/queryproto/query.pb.go b/x/cosmwasmpool/client/queryproto/query.pb.go new file mode 100644 index 00000000000..2c611a4fe85 --- /dev/null +++ b/x/cosmwasmpool/client/queryproto/query.pb.go @@ -0,0 +1,544 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/cosmwasmpool/v1beta1/query.proto + +package queryproto + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/query" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + types "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/types" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// =============================== Params +type ParamsRequest struct { +} + +func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } +func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } +func (*ParamsRequest) ProtoMessage() {} +func (*ParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_733c758985c393b2, []int{0} +} +func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsRequest.Merge(m, src) +} +func (m *ParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *ParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo + +type ParamsResponse struct { + Params types.Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } +func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } +func (*ParamsResponse) ProtoMessage() {} +func (*ParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_733c758985c393b2, []int{1} +} +func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ParamsResponse.Merge(m, src) +} +func (m *ParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *ParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo + +func (m *ParamsResponse) GetParams() types.Params { + if m != nil { + return m.Params + } + return types.Params{} +} + +func init() { + proto.RegisterType((*ParamsRequest)(nil), "osmosis.cosmwasmpool.v1beta1.ParamsRequest") + proto.RegisterType((*ParamsResponse)(nil), "osmosis.cosmwasmpool.v1beta1.ParamsResponse") +} + +func init() { + proto.RegisterFile("osmosis/cosmwasmpool/v1beta1/query.proto", fileDescriptor_733c758985c393b2) +} + +var fileDescriptor_733c758985c393b2 = []byte{ + // 366 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xc1, 0x4a, 0x2b, 0x31, + 0x18, 0x85, 0x67, 0x2e, 0xf7, 0x76, 0x31, 0x97, 0x7b, 0x85, 0xc1, 0x85, 0x96, 0x32, 0x95, 0x52, + 0xa5, 0x68, 0x9d, 0xd0, 0x8a, 0x2f, 0x50, 0x7c, 0x00, 0x2d, 0xae, 0x5c, 0x28, 0x99, 0x21, 0xc6, + 0xc0, 0x24, 0x7f, 0xda, 0x64, 0x6a, 0xbb, 0xf5, 0x09, 0x14, 0x97, 0xbe, 0x50, 0x97, 0x05, 0x37, + 0xae, 0x44, 0x5a, 0x1f, 0x44, 0x9a, 0x64, 0x4a, 0x75, 0x31, 0x74, 0x35, 0x93, 0x9c, 0xef, 0x9c, + 0x9c, 0xe4, 0x0f, 0x5a, 0xa0, 0x38, 0x28, 0xa6, 0x50, 0x0a, 0x8a, 0xdf, 0x63, 0xc5, 0x25, 0x40, + 0x86, 0x46, 0x9d, 0x84, 0x68, 0xdc, 0x41, 0x83, 0x9c, 0x0c, 0x27, 0xb1, 0x1c, 0x82, 0x86, 0xb0, + 0xe6, 0xc8, 0x78, 0x9d, 0x8c, 0x1d, 0x59, 0xdd, 0xa6, 0x40, 0xc1, 0x80, 0x68, 0xf9, 0x67, 0x3d, + 0xd5, 0xc3, 0xd2, 0x74, 0x4a, 0x04, 0x59, 0x06, 0x5a, 0x76, 0xbf, 0x94, 0xd5, 0x63, 0x87, 0x45, + 0xa9, 0xe1, 0x50, 0x82, 0x15, 0x59, 0xa9, 0x29, 0x30, 0x51, 0x1c, 0xb9, 0xae, 0x9b, 0xfe, 0x2b, + 0x4a, 0x62, 0xca, 0x04, 0xd6, 0x0c, 0x0a, 0xb6, 0x46, 0x01, 0x68, 0x46, 0x10, 0x96, 0x0c, 0x61, + 0x21, 0x40, 0x1b, 0xb1, 0x28, 0xb4, 0xeb, 0x54, 0xb3, 0x4a, 0xf2, 0x5b, 0x84, 0xc5, 0xa4, 0x90, + 0xec, 0x21, 0x37, 0xf6, 0xc2, 0x76, 0xe1, 0xa4, 0xfa, 0x4f, 0x97, 0x66, 0x9c, 0x28, 0x8d, 0xb9, + 0xb4, 0x40, 0x63, 0x2b, 0xf8, 0x77, 0x8e, 0x87, 0x98, 0xab, 0x3e, 0x19, 0xe4, 0x44, 0xe9, 0xc6, + 0x65, 0xf0, 0xbf, 0xd8, 0x50, 0x12, 0x84, 0x22, 0x61, 0x2f, 0xa8, 0x48, 0xb3, 0xb3, 0xe3, 0xef, + 0xf9, 0xad, 0xbf, 0xdd, 0x66, 0x5c, 0xf6, 0xf6, 0xb1, 0x75, 0xf7, 0x7e, 0x4f, 0xdf, 0xeb, 0x5e, + 0xdf, 0x39, 0xbb, 0x2f, 0x7e, 0xf0, 0xe7, 0x62, 0x79, 0xfd, 0xf0, 0xc9, 0x0f, 0x2a, 0x16, 0x09, + 0x8f, 0x36, 0x09, 0x72, 0xbd, 0xaa, 0xed, 0xcd, 0x60, 0xdb, 0xb9, 0xd1, 0x7e, 0x78, 0xfd, 0x7c, + 0xfe, 0x75, 0x10, 0x36, 0x51, 0xe9, 0x1c, 0x5d, 0xd7, 0xeb, 0xe9, 0x3c, 0xf2, 0x67, 0xf3, 0xc8, + 0xff, 0x98, 0x47, 0xfe, 0xe3, 0x22, 0xf2, 0x66, 0x8b, 0xc8, 0x7b, 0x5b, 0x44, 0xde, 0xd5, 0x19, + 0x65, 0xfa, 0x2e, 0x4f, 0xe2, 0x14, 0x78, 0x91, 0x74, 0x9c, 0xe1, 0x44, 0xad, 0x62, 0x47, 0x9d, + 0x53, 0x34, 0xfe, 0x1e, 0x9e, 0x66, 0x8c, 0x08, 0x6d, 0xa7, 0x6d, 0xdf, 0xbd, 0x62, 0x3e, 0x27, + 0x5f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x79, 0x12, 0x48, 0xaa, 0xdf, 0x02, 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 { + Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { + out := new(ParamsResponse) + err := c.cc.Invoke(ctx, "/osmosis.cosmwasmpool.v1beta1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + Params(context.Context, *ParamsRequest) (*ParamsResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.cosmwasmpool.v1beta1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "osmosis.cosmwasmpool.v1beta1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/cosmwasmpool/v1beta1/query.proto", +} + +func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *ParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *ParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *ParamsRequest) 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 ErrIntOverflowQuery + } + 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: ParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *ParamsResponse) 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 ErrIntOverflowQuery + } + 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: ParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrIntOverflowQuery + } + 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, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/cosmwasmpool/client/queryproto/query.pb.gw.go b/x/cosmwasmpool/client/queryproto/query.pb.gw.go new file mode 100644 index 00000000000..ecf890cd673 --- /dev/null +++ b/x/cosmwasmpool/client/queryproto/query.pb.gw.go @@ -0,0 +1,153 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: osmosis/cosmwasmpool/v1beta1/query.proto + +/* +Package queryproto is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package queryproto + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"osmosis", "cosmwasmpool", "v1beta1", "Params"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage +) diff --git a/x/cosmwasmpool/keeper.go b/x/cosmwasmpool/keeper.go new file mode 100644 index 00000000000..bd8049949f6 --- /dev/null +++ b/x/cosmwasmpool/keeper.go @@ -0,0 +1,45 @@ +package cosmwasmpool + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/types" + + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type Keeper struct { + storeKey sdk.StoreKey + paramSpace paramtypes.Subspace + + // keepers + // TODO: remove nolint once added. + // nolint: unused + poolmanagerKeeper types.PoolManagerKeeper + // TODO: remove nolint once added. + // nolint: unused + contractKeeper types.ContractKeeper + // TODO: remove nolint once added. + // nolint: unused + wasmKeeper types.WasmKeeper +} + +func NewKeeper(storeKey sdk.StoreKey, paramSpace paramtypes.Subspace) *Keeper { + // set KeyTable if it has not already been set + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + + return &Keeper{storeKey: storeKey, paramSpace: paramSpace} +} + +// GetParams returns the total set of cosmwasmpool parameters. +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { + k.paramSpace.GetParamSet(ctx, ¶ms) + return params +} + +// SetParams sets the total set of cosmwasmpool parameters. +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { + k.paramSpace.SetParamSet(ctx, ¶ms) +} diff --git a/x/cosmwasmpool/model/msgs.go b/x/cosmwasmpool/model/msgs.go new file mode 100644 index 00000000000..028ad0c71b7 --- /dev/null +++ b/x/cosmwasmpool/model/msgs.go @@ -0,0 +1,83 @@ +package model + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + + "github.com/osmosis-labs/osmosis/v15/x/cosmwasmpool/types" + poolmanagertypes "github.com/osmosis-labs/osmosis/v15/x/poolmanager/types" +) + +// constants. +const ( + TypeMsgCreateCosmWasmPool = "create_cosmwasm_pool" +) + +var ( + _ sdk.Msg = &MsgCreateCosmWasmPool{} + _ poolmanagertypes.CreatePoolMsg = &MsgCreateCosmWasmPool{} +) + +func NewMsgCreateCosmWasmPool( + sender sdk.AccAddress, +) MsgCreateCosmWasmPool { + return MsgCreateCosmWasmPool{ + Sender: sender.String(), + } +} + +func (msg MsgCreateCosmWasmPool) Route() string { return types.RouterKey } +func (msg MsgCreateCosmWasmPool) Type() string { return TypeMsgCreateCosmWasmPool } +func (msg MsgCreateCosmWasmPool) ValidateBasic() error { + // TODO: add more validation. + + _, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid sender address (%s)", err) + } + + return nil +} + +func (msg MsgCreateCosmWasmPool) GetSignBytes() []byte { + // TODO: uncomment once merging state-breaks. + // return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) + return nil +} + +func (msg MsgCreateCosmWasmPool) GetSigners() []sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return []sdk.AccAddress{sender} +} + +// Implement the CreatePoolMsg interface +func (msg MsgCreateCosmWasmPool) PoolCreator() sdk.AccAddress { + sender, err := sdk.AccAddressFromBech32(msg.Sender) + if err != nil { + panic(err) + } + return sender +} + +func (msg MsgCreateCosmWasmPool) Validate(ctx sdk.Context) error { + return msg.ValidateBasic() +} + +func (msg MsgCreateCosmWasmPool) InitialLiquidity() sdk.Coins { + return sdk.Coins{} +} + +func (msg MsgCreateCosmWasmPool) CreatePool(ctx sdk.Context, poolID uint64) (poolmanagertypes.PoolI, error) { + // TODO: uncomment once merging state-breaks. + // poolI := NewCosmWasmPool(poolID, msg.CodeId, msg.InstantiateMsg) + // return &poolI, nil + return nil, nil +} + +func (msg MsgCreateCosmWasmPool) GetPoolType() poolmanagertypes.PoolType { + return poolmanagertypes.CosmWasm +} diff --git a/x/cosmwasmpool/model/pool.pb.go b/x/cosmwasmpool/model/pool.pb.go new file mode 100644 index 00000000000..6fe2778d232 --- /dev/null +++ b/x/cosmwasmpool/model/pool.pb.go @@ -0,0 +1,422 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/cosmwasmpool/v1beta1/model/pool.proto + +package model + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + 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 + +type CosmWasmPool struct { + PoolAddress string `protobuf:"bytes,1,opt,name=pool_address,json=poolAddress,proto3" json:"pool_address,omitempty" yaml:"pool_address"` + ContractAddress string `protobuf:"bytes,2,opt,name=contract_address,json=contractAddress,proto3" json:"contract_address,omitempty" yaml:"contract_address"` + PoolId uint64 `protobuf:"varint,3,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + CodeId uint64 `protobuf:"varint,4,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty"` +} + +func (m *CosmWasmPool) Reset() { *m = CosmWasmPool{} } +func (*CosmWasmPool) ProtoMessage() {} +func (*CosmWasmPool) Descriptor() ([]byte, []int) { + return fileDescriptor_a0cb64564a744af1, []int{0} +} +func (m *CosmWasmPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *CosmWasmPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_CosmWasmPool.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 *CosmWasmPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_CosmWasmPool.Merge(m, src) +} +func (m *CosmWasmPool) XXX_Size() int { + return m.Size() +} +func (m *CosmWasmPool) XXX_DiscardUnknown() { + xxx_messageInfo_CosmWasmPool.DiscardUnknown(m) +} + +var xxx_messageInfo_CosmWasmPool proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CosmWasmPool)(nil), "osmosis.cosmwasmpool.v1beta1.CosmWasmPool") +} + +func init() { + proto.RegisterFile("osmosis/cosmwasmpool/v1beta1/model/pool.proto", fileDescriptor_a0cb64564a744af1) +} + +var fileDescriptor_a0cb64564a744af1 = []byte{ + // 335 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0x4d, 0x4a, 0xc3, 0x40, + 0x14, 0xc7, 0x33, 0x5a, 0x2b, 0xc6, 0x82, 0x5a, 0x85, 0xd6, 0x2a, 0x49, 0xc9, 0xaa, 0x9b, 0x66, + 0x28, 0x22, 0x48, 0x77, 0x56, 0x10, 0xba, 0x93, 0x6c, 0x04, 0x37, 0x65, 0x92, 0x19, 0x63, 0x60, + 0xc6, 0x57, 0x3a, 0xd3, 0xaa, 0x37, 0x70, 0xe9, 0xd2, 0x65, 0x0f, 0xe1, 0x21, 0xc4, 0x55, 0x77, + 0xba, 0x2a, 0xd2, 0xde, 0xa0, 0x27, 0x90, 0x99, 0x49, 0xa5, 0xba, 0xcb, 0xef, 0xff, 0x91, 0xc7, + 0xbc, 0xe7, 0x36, 0x41, 0x0a, 0x90, 0x99, 0xc4, 0x09, 0x48, 0xf1, 0x40, 0xa4, 0xe8, 0x03, 0x70, + 0x3c, 0x6a, 0xc5, 0x4c, 0x91, 0x16, 0x16, 0x40, 0x19, 0xc7, 0x5a, 0x0a, 0xfb, 0x03, 0x50, 0x50, + 0x3e, 0xce, 0xe3, 0xe1, 0x6a, 0x3c, 0xcc, 0xe3, 0xb5, 0xc3, 0xc4, 0xd8, 0x3d, 0x93, 0xc5, 0x16, + 0x6c, 0xb1, 0x76, 0x90, 0x42, 0x0a, 0x56, 0xd7, 0x5f, 0xb9, 0xea, 0xa7, 0x00, 0x29, 0x67, 0xd8, + 0x50, 0x3c, 0xbc, 0xc5, 0x2a, 0x13, 0x4c, 0x2a, 0x22, 0xfa, 0x36, 0x10, 0x7c, 0x22, 0xb7, 0x74, + 0x01, 0x52, 0x5c, 0x13, 0x29, 0xae, 0x00, 0x78, 0xb9, 0xed, 0x96, 0xf4, 0xc8, 0x1e, 0xa1, 0x74, + 0xc0, 0xa4, 0xac, 0xa2, 0x3a, 0x6a, 0x6c, 0x75, 0x2a, 0x8b, 0xa9, 0xbf, 0xff, 0x44, 0x04, 0x6f, + 0x07, 0xab, 0x6e, 0x10, 0x6d, 0x6b, 0x3c, 0xb7, 0x54, 0xbe, 0x74, 0x77, 0x13, 0xb8, 0x57, 0x03, + 0x92, 0xa8, 0xdf, 0xfe, 0x9a, 0xe9, 0x1f, 0x2d, 0xa6, 0x7e, 0xc5, 0xf6, 0xff, 0x27, 0x82, 0x68, + 0x67, 0x29, 0x2d, 0xff, 0x53, 0x71, 0x37, 0xcd, 0x94, 0x8c, 0x56, 0xd7, 0xeb, 0xa8, 0x51, 0x88, + 0x8a, 0x1a, 0xbb, 0x54, 0x1b, 0x09, 0x50, 0xa6, 0x8d, 0x82, 0x35, 0x34, 0x76, 0x69, 0x7b, 0xef, + 0x79, 0xec, 0x3b, 0xaf, 0x63, 0xdf, 0xf9, 0x78, 0x6b, 0x6e, 0xe8, 0x77, 0x74, 0x3b, 0xd1, 0xfb, + 0xcc, 0x43, 0x93, 0x99, 0x87, 0xbe, 0x67, 0x1e, 0x7a, 0x99, 0x7b, 0xce, 0x64, 0xee, 0x39, 0x5f, + 0x73, 0xcf, 0xb9, 0x39, 0x4b, 0x33, 0x75, 0x37, 0x8c, 0xc3, 0x04, 0x04, 0xce, 0xd7, 0xdd, 0xe4, + 0x24, 0x96, 0x4b, 0xc0, 0xa3, 0xd6, 0x29, 0x7e, 0xfc, 0x7b, 0x30, 0x73, 0xa8, 0xb8, 0x68, 0x96, + 0x76, 0xf2, 0x13, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x92, 0xde, 0xee, 0xd5, 0x01, 0x00, 0x00, +} + +func (m *CosmWasmPool) 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 *CosmWasmPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *CosmWasmPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.CodeId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x20 + } + if m.PoolId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x18 + } + if len(m.ContractAddress) > 0 { + i -= len(m.ContractAddress) + copy(dAtA[i:], m.ContractAddress) + i = encodeVarintPool(dAtA, i, uint64(len(m.ContractAddress))) + i-- + dAtA[i] = 0x12 + } + if len(m.PoolAddress) > 0 { + i -= len(m.PoolAddress) + copy(dAtA[i:], m.PoolAddress) + i = encodeVarintPool(dAtA, i, uint64(len(m.PoolAddress))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintPool(dAtA []byte, offset int, v uint64) int { + offset -= sovPool(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *CosmWasmPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.PoolAddress) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = len(m.ContractAddress) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + if m.PoolId != 0 { + n += 1 + sovPool(uint64(m.PoolId)) + } + if m.CodeId != 0 { + n += 1 + sovPool(uint64(m.CodeId)) + } + return n +} + +func sovPool(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozPool(x uint64) (n int) { + return sovPool(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *CosmWasmPool) 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 ErrIntOverflowPool + } + 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: CosmWasmPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: CosmWasmPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.PoolAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ContractAddress", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ContractAddress = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipPool(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, ErrIntOverflowPool + } + 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, ErrIntOverflowPool + } + 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, ErrIntOverflowPool + } + 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, ErrInvalidLengthPool + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupPool + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthPool + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthPool = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowPool = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupPool = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/cosmwasmpool/model/store_model.go b/x/cosmwasmpool/model/store_model.go new file mode 100644 index 00000000000..cce1cb92284 --- /dev/null +++ b/x/cosmwasmpool/model/store_model.go @@ -0,0 +1,14 @@ +package model + +import ( + "encoding/json" +) + +// String returns the json marshalled string of the pool +func (p CosmWasmPool) String() string { + out, err := json.Marshal(p) + if err != nil { + panic(err) + } + return string(out) +} diff --git a/x/cosmwasmpool/model/tx.pb.go b/x/cosmwasmpool/model/tx.pb.go new file mode 100644 index 00000000000..083641a63e3 --- /dev/null +++ b/x/cosmwasmpool/model/tx.pb.go @@ -0,0 +1,661 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/cosmwasmpool/v1beta1/model/tx.proto + +package model + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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 + +// ===================== MsgCreateCosmwasmPool +type MsgCreateCosmWasmPool struct { + CodeId uint64 `protobuf:"varint,1,opt,name=code_id,json=codeId,proto3" json:"code_id,omitempty" yaml:"code_id"` + InstantiateMsg []byte `protobuf:"bytes,2,opt,name=instantiate_msg,json=instantiateMsg,proto3" json:"instantiate_msg,omitempty" yaml:"instantiate_msg"` + Sender string `protobuf:"bytes,3,opt,name=sender,proto3" json:"sender,omitempty" yaml:"sender"` +} + +func (m *MsgCreateCosmWasmPool) Reset() { *m = MsgCreateCosmWasmPool{} } +func (m *MsgCreateCosmWasmPool) String() string { return proto.CompactTextString(m) } +func (*MsgCreateCosmWasmPool) ProtoMessage() {} +func (*MsgCreateCosmWasmPool) Descriptor() ([]byte, []int) { + return fileDescriptor_2ff1ac8555d314d1, []int{0} +} +func (m *MsgCreateCosmWasmPool) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateCosmWasmPool) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateCosmWasmPool.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 *MsgCreateCosmWasmPool) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateCosmWasmPool.Merge(m, src) +} +func (m *MsgCreateCosmWasmPool) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateCosmWasmPool) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateCosmWasmPool.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateCosmWasmPool proto.InternalMessageInfo + +func (m *MsgCreateCosmWasmPool) GetCodeId() uint64 { + if m != nil { + return m.CodeId + } + return 0 +} + +func (m *MsgCreateCosmWasmPool) GetInstantiateMsg() []byte { + if m != nil { + return m.InstantiateMsg + } + return nil +} + +func (m *MsgCreateCosmWasmPool) GetSender() string { + if m != nil { + return m.Sender + } + return "" +} + +// Returns a unique poolID to identify the pool with. +type MsgCreateCosmWasmPoolResponse struct { + PoolID uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` +} + +func (m *MsgCreateCosmWasmPoolResponse) Reset() { *m = MsgCreateCosmWasmPoolResponse{} } +func (m *MsgCreateCosmWasmPoolResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateCosmWasmPoolResponse) ProtoMessage() {} +func (*MsgCreateCosmWasmPoolResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_2ff1ac8555d314d1, []int{1} +} +func (m *MsgCreateCosmWasmPoolResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateCosmWasmPoolResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateCosmWasmPoolResponse.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 *MsgCreateCosmWasmPoolResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateCosmWasmPoolResponse.Merge(m, src) +} +func (m *MsgCreateCosmWasmPoolResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateCosmWasmPoolResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateCosmWasmPoolResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateCosmWasmPoolResponse proto.InternalMessageInfo + +func (m *MsgCreateCosmWasmPoolResponse) GetPoolID() uint64 { + if m != nil { + return m.PoolID + } + return 0 +} + +func init() { + proto.RegisterType((*MsgCreateCosmWasmPool)(nil), "osmosis.cosmwasmpool.v1beta1.MsgCreateCosmWasmPool") + proto.RegisterType((*MsgCreateCosmWasmPoolResponse)(nil), "osmosis.cosmwasmpool.v1beta1.MsgCreateCosmWasmPoolResponse") +} + +func init() { + proto.RegisterFile("osmosis/cosmwasmpool/v1beta1/model/tx.proto", fileDescriptor_2ff1ac8555d314d1) +} + +var fileDescriptor_2ff1ac8555d314d1 = []byte{ + // 380 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xcf, 0x8a, 0xd3, 0x50, + 0x14, 0xc6, 0x7b, 0x55, 0x52, 0xbc, 0x68, 0xc5, 0x8b, 0x4a, 0x09, 0x9a, 0x94, 0xb8, 0xa9, 0x14, + 0x73, 0xa9, 0x45, 0x10, 0xdd, 0xa5, 0xdd, 0x74, 0x51, 0x90, 0x6c, 0x04, 0x37, 0xe5, 0x26, 0xb9, + 0xc4, 0x40, 0x6e, 0x4e, 0xc9, 0xb9, 0xd6, 0xfa, 0x02, 0xae, 0xdd, 0xf8, 0x26, 0x3e, 0xc4, 0x2c, + 0xbb, 0x9c, 0x55, 0x18, 0xd2, 0x37, 0xe8, 0x13, 0x0c, 0xf9, 0xd3, 0x99, 0xce, 0x50, 0x66, 0x31, + 0xbb, 0x93, 0x73, 0x7e, 0xdf, 0xc9, 0xc7, 0x77, 0x0f, 0x1d, 0x01, 0x2a, 0xc0, 0x04, 0x79, 0x08, + 0xa8, 0x7e, 0x09, 0x54, 0x2b, 0x80, 0x94, 0xaf, 0xc7, 0x81, 0xd4, 0x62, 0xcc, 0x15, 0x44, 0x32, + 0xe5, 0x7a, 0xe3, 0xae, 0x72, 0xd0, 0xc0, 0x5e, 0xb7, 0xb0, 0x7b, 0x0c, 0xbb, 0x2d, 0x6c, 0xbe, + 0x88, 0x21, 0x86, 0x1a, 0xe4, 0x55, 0xd5, 0x68, 0x4c, 0x2b, 0xac, 0x45, 0x3c, 0x10, 0x28, 0xaf, + 0xf6, 0x86, 0x90, 0x64, 0xcd, 0xdc, 0xf9, 0x4f, 0xe8, 0xcb, 0x05, 0xc6, 0xd3, 0x5c, 0x0a, 0x2d, + 0xa7, 0x80, 0xea, 0x9b, 0x40, 0xf5, 0x15, 0x20, 0x65, 0x23, 0xda, 0x0d, 0x21, 0x92, 0xcb, 0x24, + 0xea, 0x93, 0x01, 0x19, 0x3e, 0xf2, 0xd8, 0xbe, 0xb0, 0x7b, 0xbf, 0x85, 0x4a, 0x3f, 0x3b, 0xed, + 0xc0, 0xf1, 0x8d, 0xaa, 0x9a, 0x47, 0x6c, 0x4a, 0x9f, 0x25, 0x19, 0x6a, 0x91, 0xe9, 0x44, 0x68, + 0xb9, 0x54, 0x18, 0xf7, 0x1f, 0x0c, 0xc8, 0xf0, 0x89, 0x67, 0xee, 0x0b, 0xfb, 0x55, 0x23, 0xba, + 0x05, 0x38, 0x7e, 0xef, 0xa8, 0xb3, 0xc0, 0x98, 0xbd, 0xa3, 0x06, 0xca, 0x2c, 0x92, 0x79, 0xff, + 0xe1, 0x80, 0x0c, 0x1f, 0x7b, 0xcf, 0xf7, 0x85, 0xfd, 0xb4, 0xd1, 0x36, 0x7d, 0xc7, 0x6f, 0x01, + 0x67, 0x46, 0xdf, 0x9c, 0x74, 0xed, 0x4b, 0x5c, 0x41, 0x86, 0x92, 0xbd, 0xa5, 0xdd, 0x2a, 0x9d, + 0x6b, 0xf7, 0xb4, 0x2c, 0x6c, 0xa3, 0x42, 0xe6, 0x33, 0xdf, 0xa8, 0x46, 0xf3, 0xe8, 0xc3, 0x3f, + 0x42, 0xe9, 0x61, 0x0d, 0xe4, 0xec, 0x0f, 0xa1, 0xec, 0x44, 0x10, 0x13, 0xf7, 0xae, 0xdc, 0xdd, + 0x93, 0x3e, 0xcc, 0x2f, 0xf7, 0x10, 0x1d, 0xcc, 0x7b, 0xfe, 0x59, 0x69, 0x91, 0x6d, 0x69, 0x91, + 0x8b, 0xd2, 0x22, 0x7f, 0x77, 0x56, 0x67, 0xbb, 0xb3, 0x3a, 0xe7, 0x3b, 0xab, 0xf3, 0xfd, 0x53, + 0x9c, 0xe8, 0x1f, 0x3f, 0x03, 0x37, 0x04, 0xc5, 0xdb, 0x1f, 0xbc, 0x4f, 0x45, 0x80, 0x87, 0x0f, + 0xbe, 0x1e, 0x7f, 0xe4, 0x9b, 0x9b, 0xd7, 0x54, 0x5f, 0x51, 0x60, 0xd4, 0xef, 0x3d, 0xb9, 0x0c, + 0x00, 0x00, 0xff, 0xff, 0x02, 0x25, 0xec, 0x43, 0x72, 0x02, 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 + +// MsgCreatorClient is the client API for MsgCreator service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgCreatorClient interface { + CreateCosmWasmPool(ctx context.Context, in *MsgCreateCosmWasmPool, opts ...grpc.CallOption) (*MsgCreateCosmWasmPoolResponse, error) +} + +type msgCreatorClient struct { + cc grpc1.ClientConn +} + +func NewMsgCreatorClient(cc grpc1.ClientConn) MsgCreatorClient { + return &msgCreatorClient{cc} +} + +func (c *msgCreatorClient) CreateCosmWasmPool(ctx context.Context, in *MsgCreateCosmWasmPool, opts ...grpc.CallOption) (*MsgCreateCosmWasmPoolResponse, error) { + out := new(MsgCreateCosmWasmPoolResponse) + err := c.cc.Invoke(ctx, "/osmosis.cosmwasmpool.v1beta1.MsgCreator/CreateCosmWasmPool", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgCreatorServer is the server API for MsgCreator service. +type MsgCreatorServer interface { + CreateCosmWasmPool(context.Context, *MsgCreateCosmWasmPool) (*MsgCreateCosmWasmPoolResponse, error) +} + +// UnimplementedMsgCreatorServer can be embedded to have forward compatible implementations. +type UnimplementedMsgCreatorServer struct { +} + +func (*UnimplementedMsgCreatorServer) CreateCosmWasmPool(ctx context.Context, req *MsgCreateCosmWasmPool) (*MsgCreateCosmWasmPoolResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateCosmWasmPool not implemented") +} + +func RegisterMsgCreatorServer(s grpc1.Server, srv MsgCreatorServer) { + s.RegisterService(&_MsgCreator_serviceDesc, srv) +} + +func _MsgCreator_CreateCosmWasmPool_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateCosmWasmPool) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgCreatorServer).CreateCosmWasmPool(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/osmosis.cosmwasmpool.v1beta1.MsgCreator/CreateCosmWasmPool", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgCreatorServer).CreateCosmWasmPool(ctx, req.(*MsgCreateCosmWasmPool)) + } + return interceptor(ctx, in, info, handler) +} + +var _MsgCreator_serviceDesc = grpc.ServiceDesc{ + ServiceName: "osmosis.cosmwasmpool.v1beta1.MsgCreator", + HandlerType: (*MsgCreatorServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateCosmWasmPool", + Handler: _MsgCreator_CreateCosmWasmPool_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/cosmwasmpool/v1beta1/model/tx.proto", +} + +func (m *MsgCreateCosmWasmPool) 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 *MsgCreateCosmWasmPool) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateCosmWasmPool) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Sender) > 0 { + i -= len(m.Sender) + copy(dAtA[i:], m.Sender) + i = encodeVarintTx(dAtA, i, uint64(len(m.Sender))) + i-- + dAtA[i] = 0x1a + } + if len(m.InstantiateMsg) > 0 { + i -= len(m.InstantiateMsg) + copy(dAtA[i:], m.InstantiateMsg) + i = encodeVarintTx(dAtA, i, uint64(len(m.InstantiateMsg))) + i-- + dAtA[i] = 0x12 + } + if m.CodeId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.CodeId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgCreateCosmWasmPoolResponse) 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 *MsgCreateCosmWasmPoolResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateCosmWasmPoolResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.PoolID != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.PoolID)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateCosmWasmPool) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.CodeId != 0 { + n += 1 + sovTx(uint64(m.CodeId)) + } + l = len(m.InstantiateMsg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Sender) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgCreateCosmWasmPoolResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolID != 0 { + n += 1 + sovTx(uint64(m.PoolID)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateCosmWasmPool) 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 ErrIntOverflowTx + } + 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: MsgCreateCosmWasmPool: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateCosmWasmPool: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field CodeId", wireType) + } + m.CodeId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.CodeId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InstantiateMsg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InstantiateMsg = append(m.InstantiateMsg[:0], dAtA[iNdEx:postIndex]...) + if m.InstantiateMsg == nil { + m.InstantiateMsg = []byte{} + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Sender = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateCosmWasmPoolResponse) 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 ErrIntOverflowTx + } + 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: MsgCreateCosmWasmPoolResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateCosmWasmPoolResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolID", wireType) + } + m.PoolID = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolID |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrIntOverflowTx + } + 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, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/cosmwasmpool/types/expected_keepers.go b/x/cosmwasmpool/types/expected_keepers.go new file mode 100644 index 00000000000..503eefa29c4 --- /dev/null +++ b/x/cosmwasmpool/types/expected_keepers.go @@ -0,0 +1,37 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + + poolmanagertypes "github.com/osmosis-labs/osmosis/v15/x/poolmanager/types" +) + +// PoolManagerKeeper defines the interface needed to be fulfilled for +// the poolmanager keeper. +type PoolManagerKeeper interface { + CreatePool(ctx sdk.Context, msg poolmanagertypes.CreatePoolMsg) (uint64, error) + GetNextPoolId(ctx sdk.Context) uint64 +} + +// ContractKeeper defines the interface needed to be fulfilled for +// the contract keeper. +type ContractKeeper interface { + Instantiate( + ctx sdk.Context, + codeID uint64, + creator, admin sdk.AccAddress, + initMsg []byte, + label string, + deposit sdk.Coins, + ) (sdk.AccAddress, []byte, error) + + Sudo(ctx sdk.Context, contractAddress sdk.AccAddress, msg []byte) ([]byte, error) + + Execute(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, msg []byte, coins sdk.Coins) ([]byte, error) +} + +// ContractKeeper defines the interface needed to be fulfilled for +// the WasmKeeper. +type WasmKeeper interface { + QuerySmart(ctx sdk.Context, contractAddress sdk.AccAddress, queryMsg []byte) ([]byte, error) +} diff --git a/x/cosmwasmpool/types/genesis.pb.go b/x/cosmwasmpool/types/genesis.pb.go new file mode 100644 index 00000000000..f76c463d123 --- /dev/null +++ b/x/cosmwasmpool/types/genesis.pb.go @@ -0,0 +1,452 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/cosmwasmpool/v1beta1/genesis.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + _ "github.com/gogo/protobuf/types" + 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 + +// Params holds parameters for the cosmwasmpool module +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_8fd7fc7fdf8fd2f4, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +// GenesisState defines the cosmwasmpool module's genesis state. +type GenesisState struct { + // params is the container of cosmwasmpool parameters. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +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_8fd7fc7fdf8fd2f4, []int{1} +} +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 (m *GenesisState) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func init() { + proto.RegisterType((*Params)(nil), "osmosis.cosmwasmpool.v1beta1.Params") + proto.RegisterType((*GenesisState)(nil), "osmosis.cosmwasmpool.v1beta1.GenesisState") +} + +func init() { + proto.RegisterFile("osmosis/cosmwasmpool/v1beta1/genesis.proto", fileDescriptor_8fd7fc7fdf8fd2f4) +} + +var fileDescriptor_8fd7fc7fdf8fd2f4 = []byte{ + // 266 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0x31, 0x4b, 0xf5, 0x30, + 0x14, 0x86, 0x5b, 0xf8, 0x28, 0x1f, 0xd5, 0xe9, 0xe2, 0xa0, 0x17, 0x89, 0x72, 0x71, 0x10, 0xc1, + 0x1c, 0xaa, 0x08, 0xce, 0x5d, 0x5c, 0xa5, 0x6e, 0x2e, 0x92, 0xd4, 0x18, 0x0b, 0x4d, 0x4f, 0xe9, + 0x49, 0xaf, 0xde, 0x7f, 0xe1, 0xcf, 0xba, 0xe3, 0x1d, 0x9d, 0x44, 0xda, 0x3f, 0x22, 0x26, 0xa9, + 0xa8, 0x83, 0x5b, 0x0e, 0xcf, 0xf3, 0xbe, 0x9c, 0x93, 0xf4, 0x04, 0xc9, 0x20, 0x55, 0x04, 0x25, + 0x92, 0x79, 0x12, 0x64, 0x5a, 0xc4, 0x1a, 0x96, 0x99, 0x54, 0x56, 0x64, 0xa0, 0x55, 0xa3, 0xa8, + 0x22, 0xde, 0x76, 0x68, 0x71, 0xb6, 0x1f, 0x5c, 0xfe, 0xdd, 0xe5, 0xc1, 0x9d, 0xef, 0x68, 0xd4, + 0xe8, 0x44, 0xf8, 0x7c, 0xf9, 0xcc, 0x7c, 0x4f, 0x23, 0xea, 0x5a, 0x81, 0x9b, 0x64, 0xff, 0x00, + 0xa2, 0x59, 0x4d, 0xa8, 0x74, 0x7d, 0x77, 0x3e, 0xe3, 0x87, 0x80, 0xd8, 0xef, 0xd4, 0x7d, 0xdf, + 0x09, 0x5b, 0x61, 0x33, 0x71, 0x6f, 0x83, 0x14, 0xa4, 0xbe, 0x96, 0x2d, 0xb1, 0x0a, 0x7c, 0xf1, + 0x3f, 0x4d, 0xae, 0x45, 0x27, 0x0c, 0x2d, 0x8a, 0x74, 0xfb, 0xca, 0x1f, 0x71, 0x63, 0x85, 0x55, + 0xb3, 0x3c, 0x4d, 0x5a, 0x47, 0x76, 0xe3, 0xc3, 0xf8, 0x78, 0xeb, 0xec, 0x88, 0xff, 0x75, 0x14, + 0xf7, 0x2d, 0xf9, 0xbf, 0xf5, 0xdb, 0x41, 0x54, 0x84, 0x64, 0x5e, 0xac, 0x07, 0x16, 0x6f, 0x06, + 0x16, 0xbf, 0x0f, 0x2c, 0x7e, 0x19, 0x59, 0xb4, 0x19, 0x59, 0xf4, 0x3a, 0xb2, 0xe8, 0xf6, 0x52, + 0x57, 0xf6, 0xb1, 0x97, 0xbc, 0x44, 0x03, 0xa1, 0xf7, 0xb4, 0x16, 0x92, 0xa6, 0x01, 0x96, 0xd9, + 0x05, 0x3c, 0xff, 0xfc, 0x6b, 0xbb, 0x6a, 0x15, 0xc9, 0xc4, 0x2d, 0x7e, 0xfe, 0x11, 0x00, 0x00, + 0xff, 0xff, 0x2a, 0xff, 0xde, 0x88, 0x90, 0x01, 0x00, 0x00, +} + +func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +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 + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + 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 *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(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 *Params) 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: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: 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 (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 { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + 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/x/cosmwasmpool/types/keys.go b/x/cosmwasmpool/types/keys.go new file mode 100644 index 00000000000..88b4651c887 --- /dev/null +++ b/x/cosmwasmpool/types/keys.go @@ -0,0 +1,22 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + ModuleName = "cosmwasmpool" + + StoreKey = ModuleName + + RouterKey = ModuleName +) + +var ( + // PoolKey defines the store key for pools. + PoolsKey = []byte{0x01} +) + +func FormatPoolsPrefix(poolId uint64) []byte { + return append(PoolsKey, sdk.Uint64ToBigEndian(poolId)...) +} diff --git a/x/cosmwasmpool/types/params.go b/x/cosmwasmpool/types/params.go new file mode 100644 index 00000000000..f0b88035905 --- /dev/null +++ b/x/cosmwasmpool/types/params.go @@ -0,0 +1,37 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Parameter store keys. +var ( +// KeyParamField = []byte("TODO: CHANGE ME") +) + +// ParamTable for cosmwasmpool module. +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +func NewParams(poolCreationFee sdk.Coins) Params { + return Params{} +} + +// DefaultParams are the default cosmwasmpool module parameters. +func DefaultParams() Params { + return Params{} +} + +// Validate validates params. +func (p Params) Validate() error { + return nil +} + +// Implements params.ParamSet. +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + // paramtypes.NewParamSetPair(KeyParamField, &p.Field, validateFn), + } +} diff --git a/x/cosmwasmpool/types/pool.go b/x/cosmwasmpool/types/pool.go new file mode 100644 index 00000000000..9c7355418fa --- /dev/null +++ b/x/cosmwasmpool/types/pool.go @@ -0,0 +1,24 @@ +package types + +import ( + "github.com/gogo/protobuf/proto" + + poolmanagertypes "github.com/osmosis-labs/osmosis/v15/x/poolmanager/types" +) + +// CosmWasmExtension +type CosmWasmExtension interface { + poolmanagertypes.PoolI + + GetCodeId() uint64 + + GetInstantiateMsg() []byte + + GetContractAddress() string + + SetContractAddress(contractAddress string) + + GetStoreModel() proto.Message + + SetWasmKeeper(wasmKeeper WasmKeeper) +} diff --git a/x/cosmwasmpool/types/tx.pb.go b/x/cosmwasmpool/types/tx.pb.go new file mode 100644 index 00000000000..90fa2b27992 --- /dev/null +++ b/x/cosmwasmpool/types/tx.pb.go @@ -0,0 +1,88 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: osmosis/cosmwasmpool/v1beta1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types" + _ "github.com/gogo/protobuf/gogoproto" + grpc1 "github.com/gogo/protobuf/grpc" + proto "github.com/gogo/protobuf/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("osmosis/cosmwasmpool/v1beta1/tx.proto", fileDescriptor_93020a1fe95e1be8) +} + +var fileDescriptor_93020a1fe95e1be8 = []byte{ + // 179 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xcd, 0x2f, 0xce, 0xcd, + 0x2f, 0xce, 0x2c, 0xd6, 0x4f, 0xce, 0x2f, 0xce, 0x2d, 0x4f, 0x2c, 0xce, 0x2d, 0xc8, 0xcf, 0xcf, + 0xd1, 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x92, 0x81, 0x2a, 0xd3, 0x43, 0x56, 0xa6, 0x07, 0x55, 0x26, 0x25, 0x92, 0x9e, 0x9f, + 0x9e, 0x0f, 0x56, 0xa8, 0x0f, 0x62, 0x41, 0xf4, 0x48, 0xc9, 0x25, 0x83, 0x35, 0xe9, 0x27, 0x25, + 0x16, 0xa7, 0xc2, 0x4d, 0x4c, 0xce, 0xcf, 0xcc, 0x83, 0xc8, 0x1b, 0xb1, 0x72, 0x31, 0xfb, 0x16, + 0xa7, 0x3b, 0x05, 0x9d, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, + 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x45, 0x7a, + 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x7e, 0xdd, 0x9c, 0xc4, 0xa4, + 0x62, 0x18, 0x47, 0xbf, 0xcc, 0xd0, 0x54, 0xbf, 0x02, 0xd5, 0xe5, 0x25, 0x95, 0x05, 0xa9, 0xc5, + 0x49, 0x6c, 0x60, 0x1b, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x5e, 0xc4, 0x73, 0x71, 0xde, + 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: "osmosis.cosmwasmpool.v1beta1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{}, + Metadata: "osmosis/cosmwasmpool/v1beta1/tx.proto", +} diff --git a/x/poolmanager/types/module_route.pb.go b/x/poolmanager/types/module_route.pb.go index e719d4e985b..e213da6a244 100644 --- a/x/poolmanager/types/module_route.pb.go +++ b/x/poolmanager/types/module_route.pb.go @@ -35,18 +35,23 @@ const ( // Concentrated is the pool model specific to concentrated liquidity. It is // defined in x/concentrated-liquidity. Concentrated PoolType = 2 + // CosmWasm is the pool model specific to CosmWasm. It is defined in + // x/cosmwasmpool. + CosmWasm PoolType = 3 ) var PoolType_name = map[int32]string{ 0: "Balancer", 1: "Stableswap", 2: "Concentrated", + 3: "CosmWasm", } var PoolType_value = map[string]int32{ "Balancer": 0, "Stableswap": 1, "Concentrated": 2, + "CosmWasm": 3, } func (x PoolType) String() string { @@ -124,27 +129,27 @@ func init() { } var fileDescriptor_96bfcc7b6d387cee = []byte{ - // 308 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xcb, 0x2f, 0xce, 0xcd, - 0x2f, 0xce, 0x2c, 0xd6, 0x2f, 0xc8, 0xcf, 0xcf, 0xc9, 0x4d, 0xcc, 0x4b, 0x4c, 0x4f, 0x2d, 0xd2, - 0x2f, 0x33, 0x4c, 0x4a, 0x2d, 0x49, 0x34, 0xd4, 0xcf, 0xcd, 0x4f, 0x29, 0xcd, 0x49, 0x8d, 0x2f, - 0xca, 0x2f, 0x2d, 0x49, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x86, 0xaa, 0xd7, 0x43, - 0x52, 0xaf, 0x07, 0x55, 0x2f, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, 0xa7, 0x0f, 0x62, 0x41, - 0xb4, 0x28, 0x35, 0x31, 0x72, 0x71, 0xfb, 0x82, 0x4d, 0x0a, 0x02, 0x19, 0x24, 0xe4, 0xc4, 0xc5, - 0x09, 0xd2, 0x1c, 0x5f, 0x52, 0x59, 0x90, 0x2a, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x67, 0xa4, 0xaa, - 0x87, 0xc7, 0x58, 0xbd, 0x80, 0xfc, 0xfc, 0x9c, 0x90, 0xca, 0x82, 0xd4, 0x20, 0x8e, 0x02, 0x28, - 0x4b, 0x48, 0x9f, 0x8b, 0x1d, 0x6c, 0x46, 0x66, 0x8a, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x8b, 0x93, - 0xd8, 0x89, 0x7b, 0xf2, 0x8c, 0x9f, 0xee, 0xc9, 0xf3, 0x55, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0x41, - 0x25, 0x95, 0x82, 0xd8, 0x40, 0x2c, 0xcf, 0x14, 0x2d, 0x07, 0x2e, 0x0e, 0x98, 0x31, 0x42, 0x3c, - 0x5c, 0x1c, 0x4e, 0x89, 0x39, 0x89, 0x79, 0xc9, 0xa9, 0x45, 0x02, 0x0c, 0x42, 0x7c, 0x5c, 0x5c, - 0xc1, 0x25, 0x89, 0x49, 0x39, 0xa9, 0xc5, 0xe5, 0x89, 0x05, 0x02, 0x8c, 0x42, 0x02, 0x5c, 0x3c, - 0xce, 0xf9, 0x79, 0xc9, 0xa9, 0x79, 0x25, 0x45, 0x89, 0x25, 0xa9, 0x29, 0x02, 0x4c, 0x52, 0x2c, - 0x1d, 0x8b, 0xe5, 0x18, 0x9c, 0x02, 0x4f, 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, 0x3c, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0xea, 0x0f, 0xdd, - 0x9c, 0xc4, 0xa4, 0x62, 0x18, 0x47, 0xbf, 0xcc, 0xd0, 0x54, 0xbf, 0x02, 0x25, 0x84, 0x41, 0x7e, - 0x2f, 0x4e, 0x62, 0x03, 0x07, 0x90, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x4d, 0x4b, 0x53, 0xff, - 0x85, 0x01, 0x00, 0x00, + // 320 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x90, 0xc1, 0x4a, 0x2b, 0x31, + 0x18, 0x85, 0x27, 0xbd, 0xa5, 0xb7, 0xc6, 0x52, 0x86, 0x41, 0xa4, 0x54, 0x48, 0x4b, 0x41, 0x28, + 0x82, 0x09, 0x55, 0x44, 0x70, 0x39, 0x5d, 0xb9, 0x50, 0xb4, 0x0a, 0x82, 0x9b, 0x92, 0xe9, 0x84, + 0xb1, 0x90, 0xcc, 0x1f, 0x26, 0x69, 0xb5, 0x5b, 0x57, 0x2e, 0x7d, 0x07, 0x5f, 0xa6, 0xcb, 0x2e, + 0x5d, 0x15, 0x69, 0xdf, 0xc0, 0x27, 0x90, 0x8c, 0x53, 0xd0, 0x8d, 0xbb, 0x13, 0xf2, 0x9d, 0x0f, + 0xfe, 0x83, 0x29, 0x18, 0x05, 0x66, 0x6c, 0x98, 0x06, 0x90, 0x8a, 0xa7, 0x3c, 0x11, 0x19, 0x9b, + 0xf6, 0x22, 0x61, 0x79, 0x8f, 0x29, 0x88, 0x27, 0x52, 0x0c, 0x33, 0x98, 0x58, 0x41, 0x75, 0x06, + 0x16, 0x82, 0xbd, 0x82, 0xa7, 0x3f, 0x78, 0x5a, 0xf0, 0xcd, 0x9d, 0x04, 0x12, 0xc8, 0x39, 0xe6, + 0xd2, 0x77, 0xa5, 0xf3, 0x8c, 0xf0, 0xf6, 0x45, 0x6e, 0x1a, 0x38, 0x51, 0x10, 0xe2, 0x2d, 0x57, + 0x1e, 0xda, 0x99, 0x16, 0x0d, 0xd4, 0x46, 0xdd, 0xfa, 0xd1, 0x3e, 0xfd, 0x43, 0x4b, 0xaf, 0x00, + 0xe4, 0xed, 0x4c, 0x8b, 0x41, 0x55, 0x17, 0x29, 0x60, 0xf8, 0x7f, 0xee, 0x18, 0xc7, 0x8d, 0x52, + 0x1b, 0x75, 0xcb, 0xe1, 0xee, 0x7c, 0xd9, 0x42, 0x9f, 0xcb, 0x56, 0x7d, 0xc6, 0x95, 0x3c, 0xeb, + 0x14, 0x9f, 0x9d, 0x41, 0xc5, 0xa5, 0xf3, 0xf8, 0xe0, 0x12, 0x57, 0x37, 0x9a, 0xa0, 0x86, 0xab, + 0x21, 0x97, 0x3c, 0x1d, 0x89, 0xcc, 0xf7, 0x82, 0x3a, 0xc6, 0x37, 0x96, 0x47, 0x52, 0x98, 0x47, + 0xae, 0x7d, 0x14, 0xf8, 0xb8, 0xd6, 0x87, 0x74, 0x24, 0x52, 0x9b, 0x71, 0x2b, 0x62, 0xbf, 0xe4, + 0xf8, 0x3e, 0x18, 0x75, 0xc7, 0x8d, 0xf2, 0xff, 0x35, 0xcb, 0x2f, 0x6f, 0xc4, 0x0b, 0xaf, 0xe7, + 0x2b, 0x82, 0x16, 0x2b, 0x82, 0x3e, 0x56, 0x04, 0xbd, 0xae, 0x89, 0xb7, 0x58, 0x13, 0xef, 0x7d, + 0x4d, 0xbc, 0xfb, 0xd3, 0x64, 0x6c, 0x1f, 0x26, 0x11, 0x1d, 0x81, 0x62, 0xc5, 0x55, 0x87, 0x92, + 0x47, 0x66, 0xf3, 0x60, 0xd3, 0xde, 0x09, 0x7b, 0xfa, 0xb5, 0xb7, 0x5b, 0xc2, 0x44, 0x95, 0x7c, + 0xae, 0xe3, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x92, 0x27, 0x7b, 0x9c, 0x93, 0x01, 0x00, 0x00, } func (m *ModuleRoute) Marshal() (dAtA []byte, err error) {