Skip to content

Commit

Permalink
update the schema and fix the lint
Browse files Browse the repository at this point in the history
  • Loading branch information
gsk967 committed Aug 2, 2023
1 parent d925799 commit 3d16fa2
Show file tree
Hide file tree
Showing 2 changed files with 242 additions and 7 deletions.
229 changes: 229 additions & 0 deletions schema/query_msg.json
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,21 @@
"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"
},
"Coin": {
"type": "object",
"required": [
"amount",
"denom"
],
"properties": {
"amount": {
"$ref": "#/definitions/Uint128"
},
"denom": {
"type": "string"
}
}
},
"CompletedIncentiveProgramsParams": {
"type": "object"
},
Expand Down Expand Up @@ -402,6 +417,68 @@
}
}
},
"MetokenIndexPriceParams": {
"type": "object",
"required": [
"metoken_denom"
],
"properties": {
"metoken_denom": {
"type": "string"
}
}
},
"MetokenIndexbalancesParams": {
"type": "object",
"required": [
"metoken_denom"
],
"properties": {
"metoken_denom": {
"type": "string"
}
}
},
"MetokenIndexesParams": {
"type": "object",
"required": [
"metoken_denom"
],
"properties": {
"metoken_denom": {
"type": "string"
}
}
},
"MetokenParametersParams": {
"type": "object"
},
"MetokenRedeemfeeParams": {
"type": "object",
"required": [
"asset_denom",
"metoken"
],
"properties": {
"asset_denom": {
"type": "string"
},
"metoken": {
"$ref": "#/definitions/Coin"
}
}
},
"MetokenSwapfeeParams": {
"type": "object",
"required": [
"metoken_denom"
],
"properties": {
"metoken_denom": {
"type": "string"
}
}
},
"MissCounterParams": {
"type": "object",
"required": [
Expand Down Expand Up @@ -872,6 +949,66 @@
}
]
},
"metoken_indexbalances": {
"anyOf": [
{
"$ref": "#/definitions/MetokenIndexbalancesParams"
},
{
"type": "null"
}
]
},
"metoken_indexes": {
"anyOf": [
{
"$ref": "#/definitions/MetokenIndexesParams"
},
{
"type": "null"
}
]
},
"metoken_indexprice": {
"anyOf": [
{
"$ref": "#/definitions/MetokenIndexPriceParams"
},
{
"type": "null"
}
]
},
"metoken_parameters": {
"anyOf": [
{
"$ref": "#/definitions/MetokenParametersParams"
},
{
"type": "null"
}
]
},
"metoken_redeemfee": {
"anyOf": [
{
"$ref": "#/definitions/MetokenRedeemfeeParams"
},
{
"type": "null"
}
]
},
"metoken_swapfee": {
"anyOf": [
{
"$ref": "#/definitions/MetokenSwapfeeParams"
},
{
"type": "null"
}
]
},
"miss_counter": {
"anyOf": [
{
Expand Down Expand Up @@ -986,6 +1123,10 @@
}
}
},
"Uint128": {
"description": "A thin wrapper around u128 that is using strings for JSON encoding/decoding, such that the full u128 range can be used for clients that convert JSON numbers to floats, like JavaScript and jq.\n\n# Examples\n\nUse `from` to create instances of this and `u128` to get the value out:\n\n``` # use cosmwasm_std::Uint128; let a = Uint128::from(123u128); assert_eq!(a.u128(), 123);\n\nlet b = Uint128::from(42u64); assert_eq!(b.u128(), 42);\n\nlet c = Uint128::from(70u32); assert_eq!(c.u128(), 70); ```",
"type": "string"
},
"UmeeQuery": {
"oneOf": [
{
Expand Down Expand Up @@ -1023,6 +1164,18 @@
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"metoken"
],
"properties": {
"metoken": {
"$ref": "#/definitions/UmeeQueryMeToken"
}
},
"additionalProperties": false
}
]
},
Expand Down Expand Up @@ -1286,6 +1439,82 @@
}
]
},
"UmeeQueryMeToken": {
"oneOf": [
{
"type": "object",
"required": [
"metoken_parameters"
],
"properties": {
"metoken_parameters": {
"$ref": "#/definitions/MetokenParametersParams"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"metoken_indexes"
],
"properties": {
"metoken_indexes": {
"$ref": "#/definitions/MetokenIndexesParams"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"metoken_swapfee"
],
"properties": {
"metoken_swapfee": {
"$ref": "#/definitions/MetokenSwapfeeParams"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"metoken_redeemfee"
],
"properties": {
"metoken_redeemfee": {
"$ref": "#/definitions/MetokenRedeemfeeParams"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"metoken_indexbalances"
],
"properties": {
"metoken_indexbalances": {
"$ref": "#/definitions/MetokenIndexbalancesParams"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"metoken_index_price"
],
"properties": {
"metoken_index_price": {
"$ref": "#/definitions/MetokenIndexPriceParams"
}
},
"additionalProperties": false
}
]
},
"UmeeQueryOracle": {
"oneOf": [
{
Expand Down
20 changes: 13 additions & 7 deletions src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ use cw_umee_types::query_leverage::{
MaxWithdrawResponse,
};
use cw_umee_types::query_metoken::{
MetokenParametersParams, MetokenParametersResponse, UmeeQueryMeToken, MetokenIndexesParams, MetokenIndexesResponse, MetokenSwapfeeParams, MetokenSwapfeeResponse, MetokenRedeemfeeParams, MetokenRedeemfeeResponse, MetokenIndexbalancesParams, MetokenIndexbalancesResponse, MetokenIndexPriceParams, MetokenIndexPriceResponse,
MetokenIndexPriceParams, MetokenIndexPriceResponse, MetokenIndexbalancesParams,
MetokenIndexbalancesResponse, MetokenIndexesParams, MetokenIndexesResponse,
MetokenParametersParams, MetokenParametersResponse, MetokenRedeemfeeParams,
MetokenRedeemfeeResponse, MetokenSwapfeeParams, MetokenSwapfeeResponse, UmeeQueryMeToken,
};
use cw_umee_types::query_oracle::{
MedianDeviationsParams, MedianDeviationsParamsResponse, MediansParams, MediansParamsResponse,
Expand Down Expand Up @@ -342,13 +345,18 @@ fn query_metoken(deps: Deps, _env: Env, msg: UmeeQueryMeToken) -> StdResult<Bina
UmeeQueryMeToken::MetokenParameters(params) => to_binary(&query_metoken_params(deps, params)?),
UmeeQueryMeToken::MetokenIndexes(params) => to_binary(&query_metoken_indexes(deps, params)?),
UmeeQueryMeToken::MetokenSwapfee(params) => to_binary(&query_metoken_swapfee(deps, params)?),
UmeeQueryMeToken::MetokenRedeemfee(params) => to_binary(&query_metoken_redeemfee(deps, params)?),
UmeeQueryMeToken::MetokenIndexbalances(params) => to_binary(&query_metoken_indexbalances(deps, params)?),
UmeeQueryMeToken::MetokenIndexPrice(params) => to_binary(&query_metoken_indexprice(deps, params)?),
UmeeQueryMeToken::MetokenRedeemfee(params) => {
to_binary(&query_metoken_redeemfee(deps, params)?)
}
UmeeQueryMeToken::MetokenIndexbalances(params) => {
to_binary(&query_metoken_indexbalances(deps, params)?)
}
UmeeQueryMeToken::MetokenIndexPrice(params) => {
to_binary(&query_metoken_indexprice(deps, params)?)
}
}
}


// query_metoken_indexprice
fn query_metoken_indexprice(
deps: Deps,
Expand All @@ -373,7 +381,6 @@ fn query_metoken_indexprice(
Ok(response)
}


// query_metoken_indexbalances
fn query_metoken_indexbalances(
deps: Deps,
Expand Down Expand Up @@ -470,7 +477,6 @@ fn query_metoken_indexes(
Ok(response)
}


// query_metoken_params
fn query_metoken_params(
deps: Deps,
Expand Down

0 comments on commit 3d16fa2

Please sign in to comment.