Skip to content

Commit

Permalink
fix schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
kent-3 committed May 26, 2024
1 parent ef26a68 commit 5fbf834
Show file tree
Hide file tree
Showing 82 changed files with 12,254 additions and 191 deletions.
2,037 changes: 2,037 additions & 0 deletions Cargo.lock

Large diffs are not rendered by default.

22 changes: 9 additions & 13 deletions contracts/liquidity_book/lb_factory/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,26 @@ exclude = ["contract.wasm", "hash.txt"]
crate-type = ["cdylib", "rlib"]


[[example]]
[[bin]]
name = "schema"
path = "schema/schema.rs"
path = "src/bin/schema.rs"


[features]
default = ["schema"]
schema = []
# for quicker tests, cargo test --lib
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]


[dependencies]
shade-protocol = { path = "../../../packages/shade_protocol" }
shade-protocol = { path = "../../../packages/shade_protocol", features = ["liquidity-book"] }
lb-libraries = { path = "../../../packages/lb_libraries" }
schemars = "0.8.16"
serde = { version = "1.0" }
schemars = "0.8.21"
serde = { version = "1.0.203" }
cosmwasm-schema = "2.0.3"
thiserror = { version = "1.0" }
ethnum = { version = "1.5" }
serde_json = "1"
thiserror = { version = "1.0.61" }
ethnum = { version = "1.5.0" }
serde_json = "1.0.117"


[dev-dependencies]
anyhow = "1"
anyhow = "1.0.86"
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.11" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "AllBinStepsResponse",
"type": "object",
"required": [
"bin_step_with_preset"
],
"properties": {
"bin_step_with_preset": {
"type": "array",
"items": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
}
}
},
"additionalProperties": false
}
140 changes: 140 additions & 0 deletions contracts/liquidity_book/lb_factory/schema/all_lb_pairs_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "AllLbPairsResponse",
"type": "object",
"required": [
"lb_pairs_available"
],
"properties": {
"lb_pairs_available": {
"type": "array",
"items": {
"$ref": "#/definitions/LBPairInformation"
}
}
},
"additionalProperties": false,
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
},
"ContractInfo": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"$ref": "#/definitions/Addr"
},
"code_hash": {
"default": "",
"type": "string"
}
}
},
"LBPair": {
"type": "object",
"required": [
"bin_step",
"contract",
"token_x",
"token_y"
],
"properties": {
"bin_step": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
},
"contract": {
"$ref": "#/definitions/ContractInfo"
},
"token_x": {
"$ref": "#/definitions/TokenType"
},
"token_y": {
"$ref": "#/definitions/TokenType"
}
},
"additionalProperties": false
},
"LBPairInformation": {
"type": "object",
"required": [
"bin_step",
"created_by_owner",
"ignored_for_routing",
"info"
],
"properties": {
"bin_step": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
},
"created_by_owner": {
"type": "boolean"
},
"ignored_for_routing": {
"type": "boolean"
},
"info": {
"$ref": "#/definitions/LBPair"
}
},
"additionalProperties": false
},
"TokenType": {
"oneOf": [
{
"type": "object",
"required": [
"custom_token"
],
"properties": {
"custom_token": {
"type": "object",
"required": [
"contract_addr",
"token_code_hash"
],
"properties": {
"contract_addr": {
"$ref": "#/definitions/Addr"
},
"token_code_hash": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"native_token"
],
"properties": {
"native_token": {
"type": "object",
"required": [
"denom"
],
"properties": {
"denom": {
"type": "string"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
}
]
}
}
}
Loading

0 comments on commit 5fbf834

Please sign in to comment.