Skip to content

Commit

Permalink
Fix tradeshield types (#940)
Browse files Browse the repository at this point in the history
* Fix tradeshield types

* update pb.go files

* tradeshield amino signing fix

* reducing upgrade time to 1 hour in ci

---------

Co-authored-by: avkr003 <abhinav@elys.network>
  • Loading branch information
Wgil and avkr003 authored Nov 14, 2024
1 parent 0a69b09 commit 0c9ae68
Show file tree
Hide file tree
Showing 12 changed files with 909 additions and 847 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
# helper functions
extract_txhash() { awk -F 'txhash: ' '/txhash:/{print $2; exit}'; }
extract_proposal_id() { awk -F 'key: proposal_id|value: ' '/key: proposal_id/ { getline; gsub(/"/, "", $2); print $2; exit }'; }
extract_and_calc_upgrade_height() { awk -F'"latest_block_height":"' '{ split($2,a,"\""); print a[1]+15000; exit }'; }
extract_and_calc_upgrade_height() { awk -F'"latest_block_height":"' '{ split($2,a,"\""); print a[1]+900; exit }'; }
extract_checksum() { awk "/elysd-${{ github.ref_name }}-linux-amd64.tar.gz/ {print \$1; exit}"; }
# environment variables
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ require (
cosmossdk.io/x/tx v0.13.5
cosmossdk.io/x/upgrade v0.1.4
github.com/CosmWasm/wasmd v0.53.0
github.com/CosmWasm/wasmvm/v2 v2.1.3
github.com/CosmWasm/wasmvm/v2 v2.1.3 // indirect
github.com/bandprotocol/bandchain-packet v0.0.2
github.com/cometbft/cometbft v0.38.12 // not using v0.38.11 due to vulnerabiltiy https://osv.dev/vulnerability/GHSA-g5xx-c4hv-9ccc https://osv.dev/vulnerability/GO-2024-3112
github.com/cometbft/cometbft-db v0.12.0 // indirect
Expand Down
14 changes: 0 additions & 14 deletions proto/elys/clock/v1/genesis.proto

This file was deleted.

14 changes: 0 additions & 14 deletions proto/elys/clock/v1/params.proto

This file was deleted.

36 changes: 0 additions & 36 deletions proto/elys/clock/v1/query.proto

This file was deleted.

43 changes: 0 additions & 43 deletions proto/elys/clock/v1/tx.proto

This file was deleted.

40 changes: 40 additions & 0 deletions proto/elys/tradeshield/order.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
syntax = "proto3";

package elys.tradeshield;

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos_proto/cosmos.proto";

option go_package = "github.com/elys-network/elys/x/tradeshield/types";

message OrderPrice {
string base_denom = 1;
string quote_denom = 2;
string rate = 3 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}

// Spot order
enum SpotOrderType {
STOPLOSS = 0;
LIMITSELL = 1;
LIMITBUY = 2;
MARKETBUY = 3;
}

message TriggerPrice {
string trading_asset_denom = 1;
string rate = 3 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}

enum PerpetualPosition {
UNSPECIFIED = 0;
LONG = 1;
SHORT = 2;
}
15 changes: 8 additions & 7 deletions proto/elys/tradeshield/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ syntax = "proto3";
package elys.tradeshield;

import "gogoproto/gogo.proto";
import "elys/tradeshield/types.proto";
import "elys/tradeshield/order.proto";
import "elys/tradeshield/params.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/msg/v1/msg.proto";
Expand Down Expand Up @@ -33,9 +33,10 @@ service Msg {
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
rpc ExecuteOrders(MsgExecuteOrders) returns (MsgExecuteOrdersResponse);
}

message MsgCreateSpotOrder {
option (cosmos.msg.v1.signer) = "owner_address";
option (amino.name) = "tradeshield/MsgCreatePendingSpotOrder";
option (amino.name) = "tradeshield/MsgCreateSpotOrder";
SpotOrderType order_type = 1;
OrderPrice order_price = 2;
cosmos.base.v1beta1.Coin order_amount = 3;
Expand All @@ -47,7 +48,7 @@ message MsgCreateSpotOrderResponse { uint64 order_id = 1; }

message MsgUpdateSpotOrder {
option (cosmos.msg.v1.signer) = "owner_address";
option (amino.name) = "tradeshield/MsgUpdatePendingSpotOrder";
option (amino.name) = "tradeshield/MsgUpdateSpotOrder";
string owner_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
uint64 order_id = 2;
OrderPrice order_price = 3;
Expand All @@ -57,7 +58,7 @@ message MsgUpdateSpotOrderResponse {}

message MsgCancelSpotOrder {
option (cosmos.msg.v1.signer) = "owner_address";
option (amino.name) = "tradeshield/MsgCancelPerpetualOrders";
option (amino.name) = "tradeshield/MsgCancelSpotOrder";
string owner_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
uint64 order_id = 2;
}
Expand All @@ -66,7 +67,7 @@ message MsgCancelSpotOrderResponse { uint64 order_id = 1; }

message MsgCancelSpotOrders {
option (cosmos.msg.v1.signer) = "creator";
option (amino.name) = "tradeshield/MsgCancelPerpetualOrders";
option (amino.name) = "tradeshield/MsgCancelSpotOrders";
string creator = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
repeated uint64 spot_order_ids = 2;
}
Expand All @@ -75,7 +76,7 @@ message MsgCancelSpotOrdersResponse {}

message MsgCreatePerpetualOpenOrder {
option (cosmos.msg.v1.signer) = "owner_address";
option (amino.name) = "tradeshield/MsgCancelPerpetualOrders";
option (amino.name) = "tradeshield/MsgCreatePerpetualOpenOrder";
string owner_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
TriggerPrice trigger_price = 2;
cosmos.base.v1beta1.Coin collateral = 3 [ (gogoproto.nullable) = false ];
Expand All @@ -100,7 +101,7 @@ message MsgCreatePerpetualOpenOrderResponse { uint64 order_id = 1; }

message MsgCreatePerpetualCloseOrder {
option (cosmos.msg.v1.signer) = "owner_address";
option (amino.name) = "tradeshield/MsgCancelPerpetualOrders";
option (amino.name) = "tradeshield/CreatePerpetualCloseOrder";
string owner_address = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ];
TriggerPrice trigger_price = 2;
uint64 position_id = 3;
Expand Down
32 changes: 1 addition & 31 deletions proto/elys/tradeshield/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,7 @@ option go_package = "github.com/elys-network/elys/x/tradeshield/types";

import "gogoproto/gogo.proto";
import "cosmos/base/v1beta1/coin.proto";

// Spot order
enum SpotOrderType {
STOPLOSS = 0;
LIMITSELL = 1;
LIMITBUY = 2;
MARKETBUY = 3;
}
import "elys/tradeshield/order.proto";

enum Status {
PENDING = 0;
Expand All @@ -22,23 +15,6 @@ enum Status {
ALL = 3;
}

message OrderPrice {
string base_denom = 1;
string quote_denom = 2;
string rate = 3 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}

message TriggerPrice {
string trading_asset_denom = 1;
string rate = 3 [
(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec",
(gogoproto.nullable) = false
];
}

message Date {
uint64 height = 1;
uint64 timestamp = 2;
Expand All @@ -63,12 +39,6 @@ enum PerpetualOrderType {
STOPLOSSPERP = 2;
}

enum PerpetualPosition {
UNSPECIFIED = 0;
LONG = 1;
SHORT = 2;
}

message LegacyPerpetualOrder {
uint64 order_id = 1;
string owner_address = 2;
Expand Down
Loading

0 comments on commit 0c9ae68

Please sign in to comment.