Skip to content

Commit

Permalink
refactor: add docs to messages and queries
Browse files Browse the repository at this point in the history
  • Loading branch information
kerber0x committed May 2, 2024
1 parent cabb525 commit 96be33f
Show file tree
Hide file tree
Showing 18 changed files with 563 additions and 160 deletions.
301 changes: 237 additions & 64 deletions contracts/liquidity_hub/pool-manager/schema/pool-manager.json

Large diffs are not rendered by default.

29 changes: 22 additions & 7 deletions contracts/liquidity_hub/pool-manager/schema/raw/execute.json
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@
]
},
"FeatureToggle": {
"description": "Pool feature toggle",
"description": "Pool feature toggle, can control whether swaps, deposits, and withdrawals are enabled.",
"type": "object",
"required": [
"deposits_enabled",
Expand All @@ -502,12 +502,15 @@
],
"properties": {
"deposits_enabled": {
"description": "Whether or not deposits are enabled",
"type": "boolean"
},
"swaps_enabled": {
"description": "Whether or not swaps are enabled",
"type": "boolean"
},
"withdrawals_enabled": {
"description": "Whether or not swaps are enabled",
"type": "boolean"
}
},
Expand Down Expand Up @@ -570,14 +573,10 @@
"additionalProperties": false
},
"PoolType": {
"description": "Possible pool types, it can be either a constant product (xyk) pool or a stable swap pool.",
"oneOf": [
{
"type": "string",
"enum": [
"constant_product"
]
},
{
"description": "A stable swap pool.",
"type": "object",
"required": [
"stable_swap"
Expand All @@ -600,12 +599,21 @@
}
},
"additionalProperties": false
},
{
"description": "xyk pool",
"type": "string",
"enum": [
"constant_product"
]
}
]
},
"SwapOperation": {
"description": "The type of swap operation to perform.",
"oneOf": [
{
"description": "A swap operation that uses the WhaleSwap router.",
"type": "object",
"required": [
"whale_swap"
Expand All @@ -620,12 +628,15 @@
],
"properties": {
"pool_identifier": {
"description": "The identifier of the pool to use for the swap.",
"type": "string"
},
"token_in_denom": {
"description": "The token denom to swap in.",
"type": "string"
},
"token_out_denom": {
"description": "The token denom returning from the swap.",
"type": "string"
}
},
Expand All @@ -637,6 +648,7 @@
]
},
"SwapRoute": {
"description": "The swap route structure",
"type": "object",
"required": [
"ask_asset_denom",
Expand All @@ -645,12 +657,15 @@
],
"properties": {
"ask_asset_denom": {
"description": "The ask asset denom, i.e. the asset that is being received.",
"type": "string"
},
"offer_asset_denom": {
"description": "The offer asset denom, i.e. the asset that is being swapped.",
"type": "string"
},
"swap_operations": {
"description": "The swap operations to perform to get from offer asset to ask asset.",
"type": "array",
"items": {
"$ref": "#/definitions/SwapOperation"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@
],
"properties": {
"bonding_manager_addr": {
"description": "The address of the bonding manager contract.",
"type": "string"
},
"incentive_manager_addr": {
"description": "The address of the incentive manager contract.",
"type": "string"
},
"pool_creation_fee": {
"$ref": "#/definitions/Coin"
"description": "How much it costs to create a pool. It helps prevent spamming of new pools.",
"allOf": [
{
"$ref": "#/definitions/Coin"
}
]
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "MigrateMsg",
"description": "The migrate message",
"type": "object",
"additionalProperties": false
}
76 changes: 47 additions & 29 deletions contracts/liquidity_hub/pool-manager/schema/raw/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@
"oneOf": [
{
"description": "Retrieves the contract's config.",
"type": "object",
"required": [
"type": "string",
"enum": [
"config"
],
"properties": {
"config": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
]
},
{
"description": "Retrieves the decimals for the given asset.",
Expand All @@ -31,9 +24,11 @@
],
"properties": {
"denom": {
"description": "The queried denom in the given pool_identifier.",
"type": "string"
},
"pool_identifier": {
"description": "The pool identifier to do the query for.",
"type": "string"
}
},
Expand All @@ -57,9 +52,15 @@
],
"properties": {
"offer_asset": {
"$ref": "#/definitions/Coin"
"description": "The offer asset to swap.",
"allOf": [
{
"$ref": "#/definitions/Coin"
}
]
},
"pool_identifier": {
"description": "The pool identifier to swap in.",
"type": "string"
}
},
Expand All @@ -79,17 +80,19 @@
"type": "object",
"required": [
"ask_asset",
"offer_asset",
"pool_identifier"
],
"properties": {
"ask_asset": {
"$ref": "#/definitions/Coin"
},
"offer_asset": {
"$ref": "#/definitions/Coin"
"description": "The ask asset to get after the swap.",
"allOf": [
{
"$ref": "#/definitions/Coin"
}
]
},
"pool_identifier": {
"description": "The pool identifier to swap in.",
"type": "string"
}
},
Expand All @@ -113,9 +116,11 @@
],
"properties": {
"ask_asset_denom": {
"description": "The ask asset denom, i.e. the asset that is being received.",
"type": "string"
},
"offer_asset_denom": {
"description": "The offer asset denom, i.e. the asset that is being swapped.",
"type": "string"
}
},
Expand All @@ -126,17 +131,10 @@
},
{
"description": "Gets all swap routes registered",
"type": "object",
"required": [
"type": "string",
"enum": [
"swap_routes"
],
"properties": {
"swap_routes": {
"type": "object",
"additionalProperties": false
}
},
"additionalProperties": false
]
},
{
"description": "Simulates swap operations.",
Expand All @@ -153,9 +151,15 @@
],
"properties": {
"offer_amount": {
"$ref": "#/definitions/Uint128"
"description": "The amount to swap.",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"operations": {
"description": "The operations to perform.",
"type": "array",
"items": {
"$ref": "#/definitions/SwapOperation"
Expand All @@ -182,9 +186,15 @@
],
"properties": {
"ask_amount": {
"$ref": "#/definitions/Uint128"
"description": "The amount to get after the swap.",
"allOf": [
{
"$ref": "#/definitions/Uint128"
}
]
},
"operations": {
"description": "The operations to perform.",
"type": "array",
"items": {
"$ref": "#/definitions/SwapOperation"
Expand All @@ -197,6 +207,7 @@
"additionalProperties": false
},
{
"description": "Retrieves the pool information for the given pool identifier.",
"type": "object",
"required": [
"pool"
Expand All @@ -218,7 +229,7 @@
"additionalProperties": false
},
{
"description": "Retrieves the creator of the swap routes that can then remove them.",
"description": "Retrieves the creator of the swap route to get from offer to ask asset. The creator of the swap route can remove it.",
"type": "object",
"required": [
"swap_route_creator"
Expand All @@ -232,9 +243,11 @@
],
"properties": {
"ask_asset_denom": {
"description": "The ask asset denom, i.e. the asset that is being received.",
"type": "string"
},
"offer_asset_denom": {
"description": "The offer asset denom, i.e. the asset that is being swapped.",
"type": "string"
}
},
Expand Down Expand Up @@ -275,8 +288,10 @@
}
},
"SwapOperation": {
"description": "The type of swap operation to perform.",
"oneOf": [
{
"description": "A swap operation that uses the WhaleSwap router.",
"type": "object",
"required": [
"whale_swap"
Expand All @@ -291,12 +306,15 @@
],
"properties": {
"pool_identifier": {
"description": "The identifier of the pool to use for the swap.",
"type": "string"
},
"token_in_denom": {
"description": "The token denom to swap in.",
"type": "string"
},
"token_out_denom": {
"description": "The token denom returning from the swap.",
"type": "string"
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ConfigResponse",
"description": "The response for the `Config` query.",
"type": "object",
"required": [
"config"
],
"properties": {
"config": {
"$ref": "#/definitions/Config"
"description": "The contract configuration.",
"allOf": [
{
"$ref": "#/definitions/Config"
}
]
}
},
"additionalProperties": false,
Expand All @@ -32,6 +38,7 @@
}
},
"Config": {
"description": "The contract configuration.",
"type": "object",
"required": [
"bonding_manager_addr",
Expand Down Expand Up @@ -60,13 +67,18 @@
]
},
"pool_creation_fee": {
"$ref": "#/definitions/Coin"
"description": "How much it costs to create a pool. It helps prevent spamming of new pools.",
"allOf": [
{
"$ref": "#/definitions/Coin"
}
]
}
},
"additionalProperties": false
},
"FeatureToggle": {
"description": "Pool feature toggle",
"description": "Pool feature toggle, can control whether swaps, deposits, and withdrawals are enabled.",
"type": "object",
"required": [
"deposits_enabled",
Expand All @@ -75,12 +87,15 @@
],
"properties": {
"deposits_enabled": {
"description": "Whether or not deposits are enabled",
"type": "boolean"
},
"swaps_enabled": {
"description": "Whether or not swaps are enabled",
"type": "boolean"
},
"withdrawals_enabled": {
"description": "Whether or not swaps are enabled",
"type": "boolean"
}
},
Expand Down
Loading

0 comments on commit 96be33f

Please sign in to comment.