Skip to content

Commit

Permalink
Add create-pool TX
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Apr 17, 2024
1 parent 00c8c50 commit 1f2ba9b
Show file tree
Hide file tree
Showing 12 changed files with 1,780 additions and 92 deletions.
1,070 changes: 1,045 additions & 25 deletions api/onex/market/tx.pulsar.go

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions api/onex/market/tx_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

136 changes: 91 additions & 45 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13100,10 +13100,66 @@ paths:
title: MsgUpdateParams is the Msg/UpdateParams request type
tags:
- Msg
/onex/denom/params:
/onex.denom.Msg/UpdateParams:
post:
summary: |-
UpdateParams defines a (governance) operation for updating the module
parameters. The authority defaults to the x/gov module account.
operationId: OnexDenomMsg_UpdateParams
responses:
'200':
description: A successful response.
schema:
type: object
description: >-
MsgUpdateParamsResponse defines the response structure for
executing a

MsgUpdateParams message.
default:
description: An unexpected error response.
schema:
type: object
properties:
code:
type: integer
format: int32
message:
type: string
details:
type: array
items:
type: object
properties:
'@type':
type: string
additionalProperties: {}
parameters:
- name: body
description: MsgUpdateParams is the Msg/UpdateParams request type.
in: body
required: true
schema:
type: object
properties:
authority:
type: string
description: >-
authority is the address that controls the module (defaults to
x/gov unless overwritten).
params:
description: |-
params defines the module parameters to update.

NOTE: All parameters must be supplied.
type: object
description: MsgUpdateParams is the Msg/UpdateParams request type.
tags:
- Msg
/onex/market/params:
get:
summary: Parameters queries the parameters of the module.
operationId: OnexDenomQuery_Params
operationId: OnexMarketQuery_Params
responses:
'200':
description: A successful response.
Expand Down Expand Up @@ -13136,22 +13192,14 @@ paths:
additionalProperties: {}
tags:
- Query
/onex.denom.Msg/UpdateParams:
/onex.market.Msg/CreatePool:
post:
summary: |-
UpdateParams defines a (governance) operation for updating the module
parameters. The authority defaults to the x/gov module account.
operationId: OnexDenomMsg_UpdateParams
operationId: OnexMarketMsg_CreatePool
responses:
'200':
description: A successful response.
schema:
type: object
description: >-
MsgUpdateParamsResponse defines the response structure for
executing a

MsgUpdateParams message.
default:
description: An unexpected error response.
schema:
Expand All @@ -13172,24 +13220,17 @@ paths:
additionalProperties: {}
parameters:
- name: body
description: MsgUpdateParams is the Msg/UpdateParams request type.
in: body
required: true
schema:
type: object
properties:
authority:
creator:
type: string
coinA:
type: string
coinB:
type: string
description: >-
authority is the address that controls the module (defaults to
x/gov unless overwritten).
params:
description: |-
params defines the module parameters to update.

NOTE: All parameters must be supplied.
type: object
description: MsgUpdateParams is the Msg/UpdateParams request type.
tags:
- Msg
/onex.market.Msg/UpdateParams:
Expand Down Expand Up @@ -13240,10 +13281,7 @@ paths:
authority is the address that controls the module (defaults to
x/gov unless overwritten).
params:
description: |-
params defines the module parameters to update.

NOTE: All parameters must be supplied.
description: 'NOTE: All parameters must be supplied.'
type: object
description: MsgUpdateParams is the Msg/UpdateParams request type.
tags:
Expand Down Expand Up @@ -20360,16 +20398,6 @@ definitions:
NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
title: Params defines the parameters for CCV Provider module
onex.denom.Params:
type: object
description: Params defines the parameters for the module.
onex.denom.QueryParamsResponse:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
onex.denom.MsgUpdateParams:
type: object
properties:
Expand All @@ -20390,6 +20418,30 @@ definitions:
description: |-
MsgUpdateParamsResponse defines the response structure for executing a
MsgUpdateParams message.
onex.denom.Params:
type: object
description: Params defines the parameters for the module.
onex.market.Params:
type: object
description: Params defines the parameters for the module.
onex.market.QueryParamsResponse:
type: object
properties:
params:
description: params holds all the parameters of this module.
type: object
description: QueryParamsResponse is response type for the Query/Params RPC method.
onex.market.MsgCreatePool:
type: object
properties:
creator:
type: string
coinA:
type: string
coinB:
type: string
onex.market.MsgCreatePoolResponse:
type: object
onex.market.MsgUpdateParams:
type: object
properties:
Expand All @@ -20399,17 +20451,11 @@ definitions:
authority is the address that controls the module (defaults to x/gov
unless overwritten).
params:
description: |-
params defines the module parameters to update.

NOTE: All parameters must be supplied.
description: 'NOTE: All parameters must be supplied.'
type: object
description: MsgUpdateParams is the Msg/UpdateParams request type.
onex.market.MsgUpdateParamsResponse:
type: object
description: |-
MsgUpdateParamsResponse defines the response structure for executing a
MsgUpdateParams message.
onex.market.Params:
type: object
description: Params defines the parameters for the module.
32 changes: 20 additions & 12 deletions proto/onex/market/tx.proto
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
syntax = "proto3";

package onex.market;

import "amino/amino.proto";
Expand All @@ -12,29 +13,36 @@ option go_package = "onex/x/market/types";
// Msg defines the Msg service.
service Msg {
option (cosmos.msg.v1.service) = true;

// UpdateParams defines a (governance) operation for updating the module
// parameters. The authority defaults to the x/gov module account.
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse);
rpc CreatePool (MsgCreatePool ) returns (MsgCreatePoolResponse );
}

// MsgUpdateParams is the Msg/UpdateParams request type.
message MsgUpdateParams {
option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "onex/x/market/MsgUpdateParams";

option (cosmos.msg.v1.signer) = "authority";
option (amino.name) = "onex/x/market/MsgUpdateParams";
// authority is the address that controls the module (defaults to x/gov unless overwritten).
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

// params defines the module parameters to update.
//

// NOTE: All parameters must be supplied.
Params params = 2 [
(gogoproto.nullable) = false,
(amino.dont_omitempty) = true
];
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
}

// MsgUpdateParamsResponse defines the response structure for executing a
// MsgUpdateParams message.
message MsgUpdateParamsResponse {}
message MsgUpdateParamsResponse {}

message MsgCreatePool {
option (cosmos.msg.v1.signer) = "creator";
string creator = 1;
string coinA = 2;
string coinB = 3;
}

message MsgCreatePoolResponse {}

18 changes: 18 additions & 0 deletions x/market/keeper/msg_server_create_pool.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package keeper

import (
"context"

"onex/x/market/types"

sdk "github.com/cosmos/cosmos-sdk/types"
)

func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (*types.MsgCreatePoolResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

// TODO: Handling the message
_ = ctx

return &types.MsgCreatePoolResponse{}, nil
}
6 changes: 6 additions & 0 deletions x/market/module/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
RpcMethod: "UpdateParams",
Skip: true, // skipped because authority gated
},
{
RpcMethod: "CreatePool",
Use: "create-pool [coin-a] [coin-b]",
Short: "Send a create-pool tx",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "coinA"}, {ProtoField: "coinB"}},
},
// this line is used by ignite scaffolding # autocli/tx
},
},
Expand Down
Loading

0 comments on commit 1f2ba9b

Please sign in to comment.