Skip to content

Commit

Permalink
remove margin broker messages
Browse files Browse the repository at this point in the history
  • Loading branch information
jelysn committed Dec 1, 2023
1 parent 09ce2b4 commit e3658d9
Show file tree
Hide file tree
Showing 24 changed files with 185 additions and 1,931 deletions.
33 changes: 0 additions & 33 deletions proto/elys/margin/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import "elys/margin/types.proto";
service Msg {
rpc Open (MsgOpen ) returns (MsgOpenResponse );
rpc Close (MsgClose ) returns (MsgCloseResponse );
rpc BrokerOpen (MsgBrokerOpen ) returns (MsgBrokerOpenResponse );
rpc BrokerClose (MsgBrokerClose ) returns (MsgBrokerCloseResponse );
rpc UpdateParams (MsgUpdateParams) returns (MsgUpdateParamsResponse);
rpc UpdatePools (MsgUpdatePools ) returns (MsgUpdatePoolsResponse );
rpc Whitelist (MsgWhitelist ) returns (MsgWhitelistResponse );
Expand Down Expand Up @@ -49,37 +47,6 @@ message MsgCloseResponse {
];
}

message MsgBrokerOpen {
string creator = 1;
string collateral_asset = 2;
string collateral_amount = 3 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false];
string borrow_asset = 4;
Position position = 5;
string leverage = 6 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
string take_profit_price = 7 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false];
string owner = 8;
}

message MsgBrokerOpenResponse {
uint64 id = 1;
}

message MsgBrokerClose {
string creator = 1;
uint64 id = 2;
string owner = 3;
cosmos.base.v1beta1.Coin amount = 4 [
(gogoproto.nullable) = false
];
}

message MsgBrokerCloseResponse {
uint64 id = 1;
cosmos.base.v1beta1.Coin amount = 3 [
(gogoproto.nullable) = false
];
}

message MsgUpdateParams {

// authority is the address that controls the module (defaults to x/gov unless overwritten).
Expand Down
6 changes: 2 additions & 4 deletions wasmbindings/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,8 @@ type ElysMsg struct {
LeveragelpClose *leveragelptypes.MsgClose `json:"leveragelp_close,omitempty"`

// margin messages
MarginOpen *margintypes.MsgOpen `json:"margin_open,omitempty"`
MarginClose *margintypes.MsgClose `json:"margin_close,omitempty"`
MarginBrokerOpen *margintypes.MsgBrokerOpen `json:"margin_broker_open,omitempty"`
MarginBrokerClose *margintypes.MsgBrokerClose `json:"margin_broker_close,omitempty"`
MarginOpen *margintypes.MsgOpen `json:"margin_open,omitempty"`
MarginClose *margintypes.MsgClose `json:"margin_close,omitempty"`

// oracle messages
// parameter messages
Expand Down
2 changes: 0 additions & 2 deletions x/margin/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ func GetTxCmd() *cobra.Command {

cmd.AddCommand(CmdOpen())
cmd.AddCommand(CmdClose())
cmd.AddCommand(CmdBrokerOpen())
cmd.AddCommand(CmdBrokerClose())
cmd.AddCommand(CmdUpdateParams())
cmd.AddCommand(CmdUpdatePools())
cmd.AddCommand(CmdWhitelist())
Expand Down
64 changes: 0 additions & 64 deletions x/margin/client/cli/tx_broker_close.go

This file was deleted.

99 changes: 0 additions & 99 deletions x/margin/client/cli/tx_broker_open.go

This file was deleted.

4 changes: 0 additions & 4 deletions x/margin/client/wasm/messenger.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ func (m *Messenger) HandleMsg(ctx sdk.Context, contractAddr sdk.AccAddress, cont
return m.msgOpen(ctx, contractAddr, msg.MarginOpen)
case msg.MarginClose != nil:
return m.msgClose(ctx, contractAddr, msg.MarginClose)
case msg.MarginBrokerOpen != nil:
return m.msgBrokerOpen(ctx, contractAddr, msg.MarginBrokerOpen)
case msg.MarginBrokerClose != nil:
return m.msgBrokerClose(ctx, contractAddr, msg.MarginBrokerClose)
default:
// This handler cannot handle the message
return nil, nil, wasmbindingstypes.ErrCannotHandleMsg
Expand Down
58 changes: 0 additions & 58 deletions x/margin/client/wasm/msg_broker_close.go

This file was deleted.

59 changes: 0 additions & 59 deletions x/margin/client/wasm/msg_broker_open.go

This file was deleted.

2 changes: 1 addition & 1 deletion x/margin/client/wasm/query_get_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func (oq *Querier) queryGetStatus(ctx sdk.Context, query *types.StatusRequest) ([]byte, error) {
res, err := oq.keeper.GetStatus(ctx, query)
res, err := oq.keeper.GetStatus(sdk.WrapSDKContext(ctx), query)
if err != nil {
return nil, errorsmod.Wrap(err, "failed to get status")
}
Expand Down
2 changes: 1 addition & 1 deletion x/margin/client/wasm/query_get_whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func (oq *Querier) queryGetWhitelist(ctx sdk.Context, query *types.WhitelistRequest) ([]byte, error) {
res, err := oq.keeper.GetWhitelist(ctx, query)
res, err := oq.keeper.GetWhitelist(sdk.WrapSDKContext(ctx), query)
if err != nil {
return nil, errorsmod.Wrap(err, "failed to get whitelist")
}
Expand Down
2 changes: 1 addition & 1 deletion x/margin/client/wasm/query_is_whitelisted.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func (oq *Querier) queryIsWhitelisted(ctx sdk.Context, query *types.IsWhitelistedRequest) ([]byte, error) {
res, err := oq.keeper.IsWhitelisted(ctx, query)
res, err := oq.keeper.IsWhitelisted(sdk.WrapSDKContext(ctx), query)
if err != nil {
return nil, errorsmod.Wrap(err, "failed to get is whitelisted")
}
Expand Down
2 changes: 1 addition & 1 deletion x/margin/client/wasm/query_mtp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
)

func (oq *Querier) queryMtp(ctx sdk.Context, query *types.MTPRequest) ([]byte, error) {
res, err := oq.keeper.MTP(ctx, query)
res, err := oq.keeper.MTP(sdk.WrapSDKContext(ctx), query)
if err != nil {
return nil, errorsmod.Wrap(err, "failed to get mtp")
}
Expand Down
Loading

0 comments on commit e3658d9

Please sign in to comment.