Skip to content

Commit

Permalink
fix: update schemas; validate input to lowercase (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
wedancedalot authored Nov 29, 2021
1 parent e2007fb commit 2016df9
Show file tree
Hide file tree
Showing 18 changed files with 368 additions and 196 deletions.
85 changes: 56 additions & 29 deletions contracts/factory/schema/config_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"required": [
"generator_address",
"owner",
"pair_configs",
"token_code_id"
],
"properties": {
Expand All @@ -21,38 +22,14 @@
"generator_address": {
"$ref": "#/definitions/Addr"
},
"gov": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
},
{
"type": "null"
}
]
},
"owner": {
"$ref": "#/definitions/Addr"
},
"pair_stable_config": {
"anyOf": [
{
"$ref": "#/definitions/PairConfig"
},
{
"type": "null"
}
]
},
"pair_xyk_config": {
"anyOf": [
{
"$ref": "#/definitions/PairConfig"
},
{
"type": "null"
}
]
"pair_configs": {
"type": "array",
"items": {
"$ref": "#/definitions/PairConfig"
}
},
"token_code_id": {
"type": "integer",
Expand All @@ -70,6 +47,7 @@
"required": [
"code_id",
"maker_fee_bps",
"pair_type",
"total_fee_bps"
],
"properties": {
Expand All @@ -78,17 +56,66 @@
"format": "uint64",
"minimum": 0.0
},
"is_disabled": {
"type": [
"boolean",
"null"
]
},
"maker_fee_bps": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
},
"pair_type": {
"$ref": "#/definitions/PairType"
},
"total_fee_bps": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
}
}
},
"PairType": {
"oneOf": [
{
"type": "object",
"required": [
"xyk"
],
"properties": {
"xyk": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"stable"
],
"properties": {
"stable": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"custom"
],
"properties": {
"custom": {
"type": "string"
}
},
"additionalProperties": false
}
]
}
}
}
157 changes: 70 additions & 87 deletions contracts/factory/schema/execute_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,21 @@
"type": "object",
"properties": {
"fee_address": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
},
{
"type": "null"
}
"type": [
"string",
"null"
]
},
"generator_address": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
},
{
"type": "null"
}
]
},
"gov": {
"anyOf": [
{
"$ref": "#/definitions/UpdateAddr"
},
{
"type": "null"
}
"type": [
"string",
"null"
]
},
"owner": {
"anyOf": [
{
"$ref": "#/definitions/Addr"
},
{
"type": "null"
}
]
},
"pair_stable_config": {
"anyOf": [
{
"$ref": "#/definitions/PairConfig"
},
{
"type": "null"
}
]
},
"pair_xyk_config": {
"anyOf": [
{
"$ref": "#/definitions/PairConfig"
},
{
"type": "null"
}
"type": [
"string",
"null"
]
},
"token_code_id": {
Expand All @@ -86,51 +44,39 @@
"additionalProperties": false
},
{
"description": "CreatePair instantiates pair contract",
"type": "object",
"required": [
"create_pair"
"update_pair_config"
],
"properties": {
"create_pair": {
"update_pair_config": {
"type": "object",
"required": [
"asset_infos"
"config"
],
"properties": {
"asset_infos": {
"description": "Asset infos",
"type": "array",
"items": {
"$ref": "#/definitions/AssetInfo"
},
"maxItems": 2,
"minItems": 2
"config": {
"$ref": "#/definitions/PairConfig"
}
}
}
},
"additionalProperties": false
},
{
"description": "CreatePair instantiates pair contract",
"type": "object",
"required": [
"create_pair_stable"
"create_pair"
],
"properties": {
"create_pair_stable": {
"create_pair": {
"type": "object",
"required": [
"amp",
"asset_infos"
"asset_infos",
"pair_type"
],
"properties": {
"amp": {
"description": "Amplification point",
"type": "integer",
"format": "uint64",
"minimum": 0.0
},
"asset_infos": {
"description": "Asset infos",
"type": "array",
Expand All @@ -139,6 +85,25 @@
},
"maxItems": 2,
"minItems": 2
},
"init_params": {
"description": "Optional binary serialised parameters for custom pool types",
"anyOf": [
{
"$ref": "#/definitions/Binary"
},
{
"type": "null"
}
]
},
"pair_type": {
"description": "Type of pair contract",
"allOf": [
{
"$ref": "#/definitions/PairType"
}
]
}
}
}
Expand Down Expand Up @@ -220,11 +185,16 @@
}
]
},
"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>",
"type": "string"
},
"PairConfig": {
"type": "object",
"required": [
"code_id",
"maker_fee_bps",
"pair_type",
"total_fee_bps"
],
"properties": {
Expand All @@ -233,51 +203,64 @@
"format": "uint64",
"minimum": 0.0
},
"is_disabled": {
"type": [
"boolean",
"null"
]
},
"maker_fee_bps": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
},
"pair_type": {
"$ref": "#/definitions/PairType"
},
"total_fee_bps": {
"type": "integer",
"format": "uint16",
"minimum": 0.0
}
}
},
"UpdateAddr": {
"PairType": {
"oneOf": [
{
"type": "object",
"required": [
"set"
"xyk"
],
"properties": {
"set": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string"
}
}
"xyk": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"remove"
"stable"
],
"properties": {
"remove": {
"stable": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"custom"
],
"properties": {
"custom": {
"type": "string"
}
},
"additionalProperties": false
}
]
}
Expand Down
Loading

0 comments on commit 2016df9

Please sign in to comment.