Skip to content

Commit

Permalink
rewrite dex_stargate to use new helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Jul 19, 2024
1 parent 0406eae commit 1d58f55
Show file tree
Hide file tree
Showing 8 changed files with 499 additions and 235 deletions.
19 changes: 17 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ incremental = false
overflow-checks = true

[workspace.dependencies]
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" }
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/remove-stargate" }
prost = "0.12.4"
prost-types = "0.12.4"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
Expand Down
64 changes: 49 additions & 15 deletions contracts/dex_stargate/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
"required": [
"amount_in",
"limit_sell_price",
"max_amount_out",
"order_type",
"receiver",
"tick_index_in_to_out",
Expand All @@ -142,20 +143,20 @@
"type": "string"
},
"expiration_time": {
"type": [
"integer",
"null"
],
"format": "int64"
"anyOf": [
{
"$ref": "#/definitions/Timestamp"
},
{
"type": "null"
}
]
},
"limit_sell_price": {
"type": "string"
},
"max_amount_out": {
"type": [
"string",
"null"
]
"type": "string"
},
"order_type": {
"type": "integer",
Expand Down Expand Up @@ -250,10 +251,7 @@
"routes": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
"$ref": "#/definitions/MultiHopRoute"
}
}
}
Expand All @@ -266,12 +264,48 @@
"DepositOptions": {
"type": "object",
"required": [
"disable_autoswap"
"disable_autoswap",
"fail_tx_on_bel"
],
"properties": {
"disable_autoswap": {
"description": "Autoswap provides a mechanism for users to deposit the entirety of their specified deposit amounts by paying a small fee. By default the `autoswap` option is enabled.",
"type": "boolean"
},
"fail_tx_on_bel": {
"type": "boolean"
}
}
},
"MultiHopRoute": {
"type": "object",
"required": [
"hops"
],
"properties": {
"hops": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"Timestamp": {
"type": "object",
"required": [
"nanos",
"seconds"
],
"properties": {
"nanos": {
"description": "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive.",
"type": "integer",
"format": "int32"
},
"seconds": {
"description": "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.",
"type": "integer",
"format": "int64"
}
}
}
Expand Down
81 changes: 55 additions & 26 deletions contracts/dex_stargate/schema/query_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,7 @@
"routes": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "string"
}
"$ref": "#/definitions/MultiHopRoute"
}
}
}
Expand All @@ -414,6 +411,7 @@
"required": [
"amount_in",
"creator",
"max_amount_out",
"order_type",
"receiver",
"tick_index_in_to_out",
Expand All @@ -428,17 +426,17 @@
"type": "string"
},
"expiration_time": {
"type": [
"integer",
"null"
],
"format": "int64"
"anyOf": [
{
"$ref": "#/definitions/Timestamp"
},
{
"type": "null"
}
]
},
"max_amount_out": {
"type": [
"string",
"null"
]
"type": "string"
},
"order_type": {
"type": "integer",
Expand Down Expand Up @@ -563,11 +561,22 @@
}
],
"definitions": {
"Binary": {
"description": "Binary is a wrapper around Vec<u8> to add base64 de/serialization with serde. It also adds some helper methods to help encode inline.\n\nThis is only needed as serde-json-{core,wasm} has a horrible encoding for Vec<u8>. See also <https://github.com/CosmWasm/cosmwasm/blob/main/docs/MESSAGE_TYPES.md>.",
"type": "string"
"MultiHopRoute": {
"type": "object",
"required": [
"hops"
],
"properties": {
"hops": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"PageRequest": {
"description": "PageRequest is to be embedded in gRPC request messages for efficient pagination. Ex:\n\nmessage SomeRequest { Foo some_parameter = 1; PageRequest pagination = 2; }",
"type": "object",
"required": [
"count_total",
Expand All @@ -578,34 +587,54 @@
],
"properties": {
"count_total": {
"description": "**count_total** is set to true to indicate that the result set should include a count of the total number of items available for pagination in UIs. count_total is only respected when offset is used. It is ignored when key is set.",
"description": "count_total is set to true to indicate that the result set should include a count of the total number of items available for pagination in UIs. count_total is only respected when offset is used. It is ignored when key is set.",
"type": "boolean"
},
"key": {
"description": "**key** is a value returned in PageResponse.next_key to begin querying the next page most efficiently. Only one of offset or key should be set.",
"allOf": [
{
"$ref": "#/definitions/Binary"
}
]
"description": "key is a value returned in PageResponse.next_key to begin querying the next page most efficiently. Only one of offset or key should be set.",
"type": "array",
"items": {
"type": "integer",
"format": "uint8",
"minimum": 0.0
}
},
"limit": {
"description": "**limit** is the total number of results to be returned in the result page. If left empty it will default to a value to be set by each app.",
"description": "limit is the total number of results to be returned in the result page. If left empty it will default to a value to be set by each app.",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"offset": {
"description": "**offset** is a numeric offset that can be used when key is unavailable. It is less efficient than using key. Only one of offset or key should be set.",
"description": "offset is a numeric offset that can be used when key is unavailable. It is less efficient than using key. Only one of offset or key should be set.",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"reverse": {
"description": "reverse is set to true if results are to be returned in the descending order.",
"description": "reverse is set to true if results are to be returned in the descending order.\n\nSince: cosmos-sdk 0.43",
"type": "boolean"
}
}
},
"Timestamp": {
"type": "object",
"required": [
"nanos",
"seconds"
],
"properties": {
"nanos": {
"description": "Non-negative fractions of a second at nanosecond resolution. Negative second values with fractions must still have non-negative nanos values that count forward in time. Must be from 0 to 999,999,999 inclusive.",
"type": "integer",
"format": "int32"
},
"seconds": {
"description": "Represents seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.",
"type": "integer",
"format": "int64"
}
}
}
}
}
Loading

0 comments on commit 1d58f55

Please sign in to comment.