diff --git a/Cargo.lock b/Cargo.lock index 9d96d0b39..f944fea02 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,7 +151,7 @@ dependencies = [ [[package]] name = "astroport" -version = "5.5.0" +version = "5.6.0" dependencies = [ "astroport-circular-buffer 0.2.0", "cosmos-sdk-proto 0.19.0", @@ -212,7 +212,7 @@ name = "astroport-factory" version = "1.9.0" dependencies = [ "anyhow", - "astroport 5.5.0", + "astroport 5.6.0", "astroport-pair 2.1.0", "astroport-test", "cosmwasm-schema", @@ -261,7 +261,7 @@ version = "1.2.0" dependencies = [ "anyhow", "astro-token-converter", - "astroport 5.5.0", + "astroport 5.6.0", "astroport-factory 1.9.0", "astroport-native-coin-registry", "astroport-pair 2.1.0", @@ -357,7 +357,7 @@ dependencies = [ name = "astroport-pair" version = "2.1.0" dependencies = [ - "astroport 5.5.0", + "astroport 5.6.0", "astroport-factory 1.9.0", "astroport-incentives", "astroport-test", @@ -380,7 +380,7 @@ name = "astroport-pair-concentrated" version = "4.1.0" dependencies = [ "anyhow", - "astroport 5.5.0", + "astroport 5.6.0", "astroport-circular-buffer 0.2.0", "astroport-factory 1.9.0", "astroport-incentives", @@ -429,7 +429,7 @@ name = "astroport-pair-stable" version = "4.1.0" dependencies = [ "anyhow", - "astroport 5.5.0", + "astroport 5.6.0", "astroport-circular-buffer 0.2.0", "astroport-factory 1.9.0", "astroport-incentives", @@ -455,7 +455,7 @@ name = "astroport-pair-transmuter" version = "1.1.2" dependencies = [ "anyhow", - "astroport 5.5.0", + "astroport 5.6.0", "astroport-factory 1.9.0", "astroport-native-coin-registry", "astroport-test", @@ -471,11 +471,30 @@ dependencies = [ "thiserror", ] +[[package]] +name = "astroport-pair-xastro" +version = "1.0.0" +dependencies = [ + "anyhow", + "astroport 5.6.0", + "astroport-factory 1.9.0", + "astroport-staking", + "astroport-test", + "astroport-tokenfactory-tracker 1.0.0", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.2.0", + "cw2 1.1.2", + "derivative", + "itertools 0.12.1", + "thiserror", +] + [[package]] name = "astroport-pair-xyk-sale-tax" version = "2.1.0" dependencies = [ - "astroport 5.5.0", + "astroport 5.6.0", "astroport-factory 1.9.0", "astroport-incentives", "astroport-pair 1.3.3", @@ -501,7 +520,7 @@ name = "astroport-pcl-common" version = "2.1.0" dependencies = [ "anyhow", - "astroport 5.5.0", + "astroport 5.6.0", "astroport-factory 1.9.0", "astroport-test", "cosmwasm-schema", @@ -533,11 +552,11 @@ dependencies = [ [[package]] name = "astroport-staking" -version = "2.2.0" +version = "2.3.0" dependencies = [ "anyhow", "astroport 4.0.3", - "astroport 5.5.0", + "astroport 5.6.0", "astroport-tokenfactory-tracker 1.0.0", "cosmwasm-schema", "cosmwasm-std", @@ -555,13 +574,14 @@ name = "astroport-test" version = "0.1.0" dependencies = [ "anyhow", - "astroport 5.5.0", + "astroport 5.6.0", "cosmwasm-schema", "cosmwasm-std", "cw-multi-test 1.0.0", "cw-storage-plus 1.2.0", "cw-utils 1.0.3", "itertools 0.12.1", + "osmosis-std", "schemars", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index 7c10ec11d..56c897654 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ members = [ "contracts/pair_astro_converter", "contracts/pair_transmuter", # "contracts/pair_concentrated_inj", TODO: rewrite OB liquidity deployment + "contracts/pair_xastro", "contracts/pair_xyk_sale_tax", "contracts/router", "contracts/whitelist", @@ -24,7 +25,7 @@ thiserror = "1.0" itertools = "0.12" cosmwasm-schema = "1.5" cw-utils = "1" -astroport = { path = "./packages/astroport", version = "5.4.0" } +astroport = { path = "./packages/astroport", version = "5.6.0" } [profile.release] opt-level = "z" diff --git a/contracts/pair_xastro/.cargo/config b/contracts/pair_xastro/.cargo/config new file mode 100644 index 000000000..6a35afd0f --- /dev/null +++ b/contracts/pair_xastro/.cargo/config @@ -0,0 +1,6 @@ +[alias] +wasm = "build --release --target wasm32-unknown-unknown" +wasm-debug = "build --target wasm32-unknown-unknown" +unit-test = "test --lib" +integration-test = "test --test integration" +schema = "run --example pair_schema" diff --git a/contracts/pair_xastro/.editorconfig b/contracts/pair_xastro/.editorconfig new file mode 100644 index 000000000..3d36f20b1 --- /dev/null +++ b/contracts/pair_xastro/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.rs] +indent_size = 4 diff --git a/contracts/pair_xastro/Cargo.toml b/contracts/pair_xastro/Cargo.toml new file mode 100644 index 000000000..c5e3da245 --- /dev/null +++ b/contracts/pair_xastro/Cargo.toml @@ -0,0 +1,33 @@ +[package] +name = "astroport-pair-xastro" +version = "1.0.0" +authors = ["Astroport"] +edition = "2021" +description = "Astroport virtual pair for ASTRO<>xASTRO conversion backed by staking contract" +license = "GPL-3.0-only" +repository = "https://github.com/astroport-fi/astroport" +homepage = "https://astroport.fi" + +[lib] +crate-type = ["cdylib", "rlib"] + +[features] +backtraces = ["cosmwasm-std/backtraces"] +library = [] + +[dependencies] +astroport.workspace = true +cw2.workspace = true +cosmwasm-std = { workspace = true, features = ["cosmwasm_1_1", "stargate"] } +cw-storage-plus.workspace = true +thiserror.workspace = true +cosmwasm-schema.workspace = true + +[dev-dependencies] +anyhow = "1" +derivative = "2.2" +itertools.workspace = true +astroport-test = { path = "../../packages/astroport_test" } +astroport-factory = { path = "../factory" } +astroport-staking = { path = "../tokenomics/staking" } +astroport-tokenfactory-tracker = "1.0.0" diff --git a/contracts/pair_xastro/README.md b/contracts/pair_xastro/README.md new file mode 100644 index 000000000..1100ada2f --- /dev/null +++ b/contracts/pair_xastro/README.md @@ -0,0 +1 @@ +# Astroport ASTRO<>xASTRO virtual pair backed by staking contract. diff --git a/contracts/pair_xastro/examples/pair_xastro_schema.rs b/contracts/pair_xastro/examples/pair_xastro_schema.rs new file mode 100644 index 000000000..964f21bce --- /dev/null +++ b/contracts/pair_xastro/examples/pair_xastro_schema.rs @@ -0,0 +1,11 @@ +use cosmwasm_schema::write_api; + +use astroport::pair::{ExecuteMsg, InstantiateMsg, QueryMsg}; + +fn main() { + write_api! { + instantiate: InstantiateMsg, + query: QueryMsg, + execute: ExecuteMsg, + } +} diff --git a/contracts/pair_xastro/rustfmt.toml b/contracts/pair_xastro/rustfmt.toml new file mode 100644 index 000000000..11a85e6a9 --- /dev/null +++ b/contracts/pair_xastro/rustfmt.toml @@ -0,0 +1,15 @@ +# stable +newline_style = "unix" +hard_tabs = false +tab_spaces = 4 + +# unstable... should we require `rustup run nightly cargo fmt` ? +# or just update the style guide when they are stable? +#fn_single_line = true +#format_code_in_doc_comments = true +#overflow_delimited_expr = true +#reorder_impl_items = true +#struct_field_align_threshold = 20 +#struct_lit_single_line = true +#report_todo = "Always" + diff --git a/contracts/pair_xastro/src/contract.rs b/contracts/pair_xastro/src/contract.rs new file mode 100644 index 000000000..853c57fd2 --- /dev/null +++ b/contracts/pair_xastro/src/contract.rs @@ -0,0 +1,220 @@ +use cosmwasm_std::{ + attr, ensure, from_json, wasm_execute, Addr, DepsMut, Env, MessageInfo, QuerierWrapper, + Response, StdError, Uint128, +}; + +use astroport::asset::{addr_opt_validate, Asset, AssetInfo, PairInfo}; +use astroport::pair::ExecuteMsg; +use astroport::pair_xastro::XastroPairInitParams; +use astroport::{pair, staking}; + +use crate::error::ContractError; +use crate::state::{Config, CONFIG}; + +/// Contract name that is used for migration. +pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +/// Contract version that is used for migration. +pub const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); + +/// Minimum initial xastro share +pub(crate) const MINIMUM_STAKE_AMOUNT: Uint128 = Uint128::new(1_000); + +/// Creates a new contract with the specified parameters in the [`InstantiateMsg`]. +#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] +pub fn instantiate( + deps: DepsMut, + env: Env, + _info: MessageInfo, + msg: pair::InstantiateMsg, +) -> Result { + if msg.asset_infos.len() != 2 { + return Err(StdError::generic_err("asset_infos must contain exactly two elements").into()); + } + + let params: XastroPairInitParams = msg + .init_params + .map(from_json) + .transpose()? + .ok_or_else(|| StdError::generic_err("Missing init params"))?; + + let staking_config: staking::Config = deps + .querier + .query_wasm_smart(¶ms.staking, &staking::QueryMsg::Config {})?; + + ensure!( + msg.asset_infos + .contains(&AssetInfo::native(&staking_config.astro_denom)), + StdError::generic_err("Missing astro denom in asset_infos") + ); + ensure!( + msg.asset_infos + .contains(&AssetInfo::native(&staking_config.xastro_denom)), + StdError::generic_err("Missing xAstro denom in asset_infos") + ); + + CONFIG.save( + deps.storage, + &Config { + pair_info: PairInfo { + asset_infos: msg.asset_infos, + contract_addr: env.contract.address.clone(), + liquidity_token: "".to_string(), + pair_type: msg.pair_type, + }, + factory_addr: deps.api.addr_validate(&msg.factory_addr)?, + staking: Addr::unchecked(params.staking), + astro_denom: staking_config.astro_denom, + xastro_denom: staking_config.xastro_denom, + }, + )?; + + Ok(Response::new()) +} + +/// Exposes all the execute functions available in the contract. +/// +/// ## Variants +/// * **ExecuteMsg::Receive(msg)** Receives a message of type [`Cw20ReceiveMsg`] and processes +/// it depending on the received template. +/// +/// * **ExecuteMsg::Swap { +/// offer_asset, +/// belief_price, +/// max_spread, +/// to, +/// }** Performs a swap operation with the specified parameters. +#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] +pub fn execute( + deps: DepsMut, + _env: Env, + info: MessageInfo, + msg: ExecuteMsg, +) -> Result { + match msg { + ExecuteMsg::Swap { + offer_asset, to, .. + } => { + offer_asset.assert_sent_native_token_balance(&info)?; + swap(deps, info.sender, offer_asset, to) + } + _ => Err(ContractError::NotSupported {}), + } +} + +/// Performs swap operation with the specified parameters. +/// +/// * **sender** is the sender of the swap operation. +/// +/// * **offer_asset** proposed asset for swapping. +/// +/// * **to_addr** sets the recipient of the swap operation. +pub fn swap( + deps: DepsMut, + sender: Addr, + offer_asset: Asset, + to_addr: Option, +) -> Result { + let config = CONFIG.load(deps.storage)?; + + let receiver = addr_opt_validate(deps.api, &to_addr)?.unwrap_or_else(|| sender.clone()); + + match &offer_asset.info { + AssetInfo::NativeToken { denom } if denom == &config.astro_denom => { + let stake_msg = wasm_execute( + &config.staking, + &staking::ExecuteMsg::Enter { + receiver: Some(receiver.to_string()), + }, + vec![offer_asset.as_coin().unwrap()], + )?; + + let mint_amount = predict_stake(deps.querier, &config, offer_asset.amount)?; + + Ok(Response::new().add_message(stake_msg).add_attributes([ + attr("action", "swap"), + attr("receiver", receiver), + attr("offer_asset", &config.astro_denom), + attr("ask_asset", &config.xastro_denom), + attr("offer_amount", offer_asset.amount), + attr("return_amount", mint_amount), + attr("spread_amount", "0"), + attr("commission_amount", "0"), + attr("maker_fee_amount", "0"), + attr("fee_share_amount", "0"), + ])) + } + AssetInfo::NativeToken { denom } if denom == &config.xastro_denom => { + let unstake_msg = wasm_execute( + &config.staking, + &staking::ExecuteMsg::Leave { + receiver: Some(receiver.to_string()), + }, + vec![offer_asset.as_coin().unwrap()], + )?; + + let return_amount = predict_unstake(deps.querier, &config, offer_asset.amount)?; + + Ok(Response::new().add_message(unstake_msg).add_attributes([ + attr("action", "swap"), + attr("receiver", receiver), + attr("offer_asset", &config.xastro_denom), + attr("ask_asset", &config.astro_denom), + attr("offer_amount", offer_asset.amount), + attr("return_amount", return_amount), + attr("spread_amount", "0"), + attr("commission_amount", "0"), + attr("maker_fee_amount", "0"), + attr("fee_share_amount", "0"), + ])) + } + _ => Err(ContractError::InvalidAsset(offer_asset.info.to_string())), + } +} + +pub fn query_deposit_and_shares( + querier: QuerierWrapper, + config: &Config, +) -> Result<(Uint128, Uint128), ContractError> { + let total_deposit = querier + .query_balance(&config.staking, &config.astro_denom)? + .amount; + let total_shares = querier.query_supply(&config.xastro_denom)?.amount; + + Ok((total_deposit, total_shares)) +} + +pub fn predict_stake( + querier: QuerierWrapper, + config: &Config, + amount: Uint128, +) -> Result { + let (total_deposit, total_shares) = query_deposit_and_shares(querier, config)?; + + if total_deposit.is_zero() { + if amount.saturating_sub(MINIMUM_STAKE_AMOUNT).is_zero() { + return Err(ContractError::MinimumStakeAmountError {}); + } + + Ok(amount - MINIMUM_STAKE_AMOUNT) + } else { + Ok(amount.multiply_ratio(total_shares, total_deposit)) + } +} + +pub fn predict_unstake( + querier: QuerierWrapper, + config: &Config, + amount: Uint128, +) -> Result { + let (total_deposit, total_shares) = query_deposit_and_shares(querier, config)?; + + ensure!( + total_shares >= amount, + ContractError::InvalidUnstakeAmount { + want: amount, + total: total_shares + } + ); + + Ok(amount.multiply_ratio(total_deposit, total_shares)) +} diff --git a/contracts/pair_xastro/src/error.rs b/contracts/pair_xastro/src/error.rs new file mode 100644 index 000000000..6cded1f47 --- /dev/null +++ b/contracts/pair_xastro/src/error.rs @@ -0,0 +1,22 @@ +use crate::contract::MINIMUM_STAKE_AMOUNT; +use cosmwasm_std::{StdError, Uint128}; +use thiserror::Error; + +/// This enum describes pair contract errors +#[derive(Error, Debug, PartialEq)] +pub enum ContractError { + #[error("{0}")] + Std(#[from] StdError), + + #[error("Operation is not supported")] + NotSupported {}, + + #[error("Invalid asset {0}")] + InvalidAsset(String), + + #[error("Invalid unstake amount. Want {want} but staking contract has only {total}")] + InvalidUnstakeAmount { want: Uint128, total: Uint128 }, + + #[error("Initial stake amount must be more than {MINIMUM_STAKE_AMOUNT}")] + MinimumStakeAmountError {}, +} diff --git a/contracts/pair_xastro/src/lib.rs b/contracts/pair_xastro/src/lib.rs new file mode 100644 index 000000000..2e7bd2d7a --- /dev/null +++ b/contracts/pair_xastro/src/lib.rs @@ -0,0 +1,5 @@ +pub mod contract; +pub mod state; + +pub mod error; +pub mod queries; diff --git a/contracts/pair_xastro/src/queries.rs b/contracts/pair_xastro/src/queries.rs new file mode 100644 index 000000000..be4be55d0 --- /dev/null +++ b/contracts/pair_xastro/src/queries.rs @@ -0,0 +1,96 @@ +use cosmwasm_std::{to_json_binary, Binary, Deps, Env, StdResult, Storage, Uint128}; + +use astroport::asset::{Asset, AssetInfo, AssetInfoExt}; +use astroport::pair::{ + ConfigResponse, PoolResponse, QueryMsg, ReverseSimulationResponse, SimulationResponse, +}; +use astroport::querier::query_factory_config; + +use crate::contract::{predict_stake, predict_unstake}; +use crate::error::ContractError; +use crate::state::{Config, CONFIG}; + +#[cfg_attr(not(feature = "library"), cosmwasm_std::entry_point)] +pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> Result { + match msg { + QueryMsg::Pair {} => Ok(to_json_binary(&CONFIG.load(deps.storage)?.pair_info)?), + QueryMsg::Pool {} => Ok(to_json_binary(&query_pool(deps.storage)?)?), + QueryMsg::Config {} => Ok(to_json_binary(&query_config(deps)?)?), + QueryMsg::Share { .. } => Ok(to_json_binary(&empty_share(deps.storage)?)?), + QueryMsg::Simulation { offer_asset, .. } => { + let config = CONFIG.load(deps.storage)?; + let return_amount = match &offer_asset.info { + AssetInfo::NativeToken { denom } if denom == &config.astro_denom => { + predict_stake(deps.querier, &config, offer_asset.amount) + } + AssetInfo::NativeToken { denom } if denom == &config.xastro_denom => { + predict_unstake(deps.querier, &config, offer_asset.amount) + } + _ => Err(ContractError::InvalidAsset(offer_asset.info.to_string())), + }?; + + Ok(to_json_binary(&SimulationResponse { + return_amount, + spread_amount: Uint128::zero(), + commission_amount: Uint128::zero(), + })?) + } + QueryMsg::ReverseSimulation { ask_asset, .. } => { + let config = CONFIG.load(deps.storage)?; + + let offer_amount = match &ask_asset.info { + AssetInfo::NativeToken { denom } if denom == &config.astro_denom => { + predict_stake(deps.querier, &config, ask_asset.amount) + } + AssetInfo::NativeToken { denom } if denom == &config.xastro_denom => { + predict_unstake(deps.querier, &config, ask_asset.amount) + } + _ => Err(ContractError::InvalidAsset(ask_asset.info.to_string())), + }?; + + Ok(to_json_binary(&ReverseSimulationResponse { + offer_amount, + spread_amount: Uint128::zero(), + commission_amount: Uint128::zero(), + })?) + } + _ => Err(ContractError::NotSupported {}), + } +} + +/// Returns the amounts of assets in the pair contract as well as the amount of LP +/// tokens currently minted in an object of type [`PoolResponse`]. +pub fn query_pool(storage: &dyn Storage) -> StdResult { + let resp = PoolResponse { + assets: empty_share(storage)?, + total_share: Uint128::zero(), + }; + + Ok(resp) +} + +/// Returns the pair contract configuration in a [`ConfigResponse`] object. +pub fn query_config(deps: Deps) -> StdResult { + let config: Config = CONFIG.load(deps.storage)?; + let factory_config = query_factory_config(&deps.querier, &config.factory_addr)?; + + Ok(ConfigResponse { + block_time_last: 0, + params: None, + owner: factory_config.owner, + factory_addr: config.factory_addr, + tracker_addr: None, + }) +} + +pub fn empty_share(storage: &dyn Storage) -> StdResult> { + let share = CONFIG + .load(storage)? + .pair_info + .asset_infos + .iter() + .map(|asset_info| asset_info.with_balance(0u128)) + .collect(); + + Ok(share) +} diff --git a/contracts/pair_xastro/src/state.rs b/contracts/pair_xastro/src/state.rs new file mode 100644 index 000000000..dd19c9c19 --- /dev/null +++ b/contracts/pair_xastro/src/state.rs @@ -0,0 +1,23 @@ +use cosmwasm_schema::cw_serde; +use cosmwasm_std::Addr; +use cw_storage_plus::Item; + +use astroport::asset::PairInfo; + +/// This structure stores the main config parameters for a constant product pair contract. +#[cw_serde] +pub struct Config { + /// General pair information (e.g pair type) + pub pair_info: PairInfo, + /// The factory contract address + pub factory_addr: Addr, + /// ASTRO staking contract + pub staking: Addr, + /// ASTRO denom + pub astro_denom: String, + /// xASTRO denom + pub xastro_denom: String, +} + +/// Stores the config struct at the given key +pub const CONFIG: Item = Item::new("config"); diff --git a/contracts/pair_xastro/tests/helper.rs b/contracts/pair_xastro/tests/helper.rs new file mode 100644 index 000000000..f82fe9eff --- /dev/null +++ b/contracts/pair_xastro/tests/helper.rs @@ -0,0 +1,388 @@ +#![cfg(not(tarpaulin_include))] +#![allow(dead_code)] + +use anyhow::Result as AnyResult; +use cosmwasm_std::{ + coin, coins, to_json_binary, Addr, Coin, DepsMut, Empty, Env, MessageInfo, Response, StdResult, + Uint128, +}; +use derivative::Derivative; +use itertools::Itertools; + +use astroport::asset::{Asset, AssetInfo, PairInfo}; +use astroport::factory::{PairConfig, PairType}; +use astroport::pair::{ + ConfigResponse, ExecuteMsg, PoolResponse, QueryMsg, ReverseSimulationResponse, + SimulationResponse, +}; +use astroport::pair_xastro::XastroPairInitParams; +use astroport::staking; +use astroport::staking::InstantiateMsg; +use astroport_pair_xastro::contract::{execute, instantiate}; +use astroport_pair_xastro::queries::query; +use astroport_test::coins::TestCoin; +use astroport_test::cw_multi_test::{ + no_init, AppBuilder, AppResponse, BankSudo, Contract, ContractWrapper, Executor, + TOKEN_FACTORY_MODULE, +}; +use astroport_test::modules::stargate::{MockStargate, StargateApp as TestApp}; + +const INIT_BALANCE: u128 = u128::MAX; + +pub fn init_native_coins(test_coins: &[TestCoin]) -> Vec { + let test_coins: Vec = test_coins + .iter() + .unique() + .filter_map(|test_coin| match test_coin { + TestCoin::Native(name) => { + let init_balance = INIT_BALANCE; + Some(coin(init_balance, name)) + } + _ => None, + }) + .collect(); + + test_coins +} + +fn pair_contract() -> Box> { + Box::new(ContractWrapper::new_with_empty(execute, instantiate, query)) +} + +fn factory_contract() -> Box> { + Box::new( + ContractWrapper::new_with_empty( + astroport_factory::contract::execute, + astroport_factory::contract::instantiate, + astroport_factory::contract::query, + ) + .with_reply_empty(astroport_factory::contract::reply), + ) +} + +fn staking_contract() -> Box> { + Box::new( + ContractWrapper::new_with_empty( + astroport_staking::contract::execute, + astroport_staking::contract::instantiate, + astroport_staking::contract::query, + ) + .with_reply_empty(astroport_staking::contract::reply), + ) +} + +fn tracker_contract() -> Box> { + Box::new( + ContractWrapper::new_with_empty( + |_: DepsMut, _: Env, _: MessageInfo, _: Empty| -> StdResult { + unimplemented!() + }, + astroport_tokenfactory_tracker::contract::instantiate, + astroport_tokenfactory_tracker::query::query, + ) + .with_sudo_empty(astroport_tokenfactory_tracker::contract::sudo), + ) +} + +pub const ASTRO_DENOM: &str = "factory/assembly/ASTRO"; + +#[derive(Derivative)] +#[derivative(Debug)] +pub struct Helper { + #[derivative(Debug = "ignore")] + pub app: TestApp, + pub owner: Addr, + pub factory: Addr, + pub pair_addr: Addr, + pub fake_maker: Addr, + pub xastro_denom: String, +} + +impl Helper { + pub fn new(owner: &Addr) -> AnyResult { + let mut app = AppBuilder::new_custom() + .with_stargate(MockStargate::default()) + .build(no_init); + + app.sudo( + BankSudo::Mint { + to_address: owner.to_string(), + amount: coins(1_100_000_000_000000, ASTRO_DENOM), + } + .into(), + ) + .unwrap(); + + let pair_code_id = app.store_code(pair_contract()); + let factory_code_id = app.store_code(factory_contract()); + let pair_type = PairType::Custom("pair_xastro".to_string()); + + let fake_maker = Addr::unchecked("fake_maker"); + + let init_msg = astroport::factory::InstantiateMsg { + fee_address: Some(fake_maker.to_string()), + pair_configs: vec![PairConfig { + code_id: pair_code_id, + maker_fee_bps: 0, + total_fee_bps: 0, + pair_type: pair_type.clone(), + is_disabled: false, + is_generator_disabled: false, + permissioned: true, + }], + token_code_id: 0, + generator_address: None, + owner: owner.to_string(), + whitelist_code_id: 0, + coin_registry_address: "coin_registry".to_string(), + tracker_config: None, + }; + + let factory = app.instantiate_contract( + factory_code_id, + owner.clone(), + &init_msg, + &[], + "factory label", + None, + )?; + + let tracker_code_id = app.store_code(tracker_contract()); + let staking_code_id = app.store_code(staking_contract()); + let msg = InstantiateMsg { + deposit_token_denom: ASTRO_DENOM.to_string(), + tracking_admin: owner.to_string(), + tracking_code_id: tracker_code_id, + token_factory_addr: TOKEN_FACTORY_MODULE.to_string(), + }; + let staking = app + .instantiate_contract( + staking_code_id, + owner.clone(), + &msg, + &[], + String::from("Astroport Staking"), + None, + ) + .unwrap(); + + let staking::Config { xastro_denom, .. } = app + .wrap() + .query_wasm_smart(&staking, &staking::QueryMsg::Config {}) + .unwrap(); + + let asset_infos = vec![ + AssetInfo::native(ASTRO_DENOM), + AssetInfo::native(&xastro_denom), + ]; + let init_pair_msg = astroport::factory::ExecuteMsg::CreatePair { + pair_type, + asset_infos: asset_infos.clone(), + init_params: Some( + to_json_binary(&XastroPairInitParams { + staking: staking.to_string(), + }) + .unwrap(), + ), + }; + + app.execute_contract(owner.clone(), factory.clone(), &init_pair_msg, &[])?; + + let resp: PairInfo = app.wrap().query_wasm_smart( + &factory, + &astroport::factory::QueryMsg::Pair { asset_infos }, + )?; + + Ok(Self { + app, + owner: owner.clone(), + factory, + pair_addr: resp.contract_addr, + fake_maker, + xastro_denom, + }) + } + + pub fn provide_liquidity(&mut self, sender: &Addr, assets: &[Asset]) -> AnyResult { + let funds = + assets.mock_coins_sent(&mut self.app, sender, &self.pair_addr, SendType::Allowance); + + let msg = ExecuteMsg::ProvideLiquidity { + assets: assets.to_vec(), + slippage_tolerance: None, + auto_stake: None, + receiver: None, + min_lp_to_receive: None, + }; + + self.app + .execute_contract(sender.clone(), self.pair_addr.clone(), &msg, &funds) + } + + pub fn swap( + &mut self, + sender: &Addr, + offer_asset: &Asset, + ask_asset_info: Option, + to: Option, + ) -> AnyResult { + match &offer_asset.info { + AssetInfo::Token { .. } => { + unimplemented!() + } + AssetInfo::NativeToken { .. } => { + let funds = offer_asset.mock_coin_sent( + &mut self.app, + sender, + &self.pair_addr, + SendType::None, + ); + + let msg = ExecuteMsg::Swap { + offer_asset: offer_asset.clone(), + ask_asset_info, + belief_price: None, + max_spread: None, + to, + }; + + self.app + .execute_contract(sender.clone(), self.pair_addr.clone(), &msg, &funds) + } + } + } + + pub fn simulate_swap( + &self, + offer_asset: &Asset, + ask_asset_info: Option, + ) -> StdResult { + self.app.wrap().query_wasm_smart( + &self.pair_addr, + &QueryMsg::Simulation { + offer_asset: offer_asset.clone(), + ask_asset_info, + }, + ) + } + + pub fn simulate_reverse_swap( + &self, + ask_asset: &Asset, + offer_asset_info: Option, + ) -> StdResult { + self.app.wrap().query_wasm_smart( + &self.pair_addr, + &QueryMsg::ReverseSimulation { + ask_asset: ask_asset.clone(), + offer_asset_info, + }, + ) + } + + pub fn native_balance(&self, denom: impl Into, user: &Addr) -> u128 { + self.app + .wrap() + .query_balance(user, denom) + .unwrap() + .amount + .u128() + } + + pub fn mint_tokens(&mut self, user: &Addr, coins: &[Coin]) -> AnyResult { + self.app.sudo( + BankSudo::Mint { + to_address: user.to_string(), + amount: coins.to_vec(), + } + .into(), + ) + } + + pub fn query_config(&self) -> StdResult { + self.app + .wrap() + .query_wasm_smart(&self.pair_addr, &QueryMsg::Config {}) + } + + pub fn query_pool(&self) -> StdResult { + self.app + .wrap() + .query_wasm_smart(&self.pair_addr, &QueryMsg::Pool {}) + } + + pub fn query_share(&self, amount: impl Into) -> StdResult> { + self.app.wrap().query_wasm_smart::>( + &self.pair_addr, + &QueryMsg::Share { + amount: amount.into(), + }, + ) + } +} + +#[derive(Clone, Copy)] +pub enum SendType { + Allowance, + Transfer, + None, +} + +pub trait AssetExt { + fn mock_coin_sent( + &self, + app: &mut TestApp, + user: &Addr, + spender: &Addr, + typ: SendType, + ) -> Vec; +} + +impl AssetExt for Asset { + fn mock_coin_sent( + &self, + _app: &mut TestApp, + _user: &Addr, + _spender: &Addr, + _typ: SendType, + ) -> Vec { + let mut funds = vec![]; + match &self.info { + AssetInfo::Token { .. } if !self.amount.is_zero() => { + unimplemented!() + } + AssetInfo::NativeToken { denom } if !self.amount.is_zero() => { + funds = vec![coin(self.amount.u128(), denom)]; + } + _ => {} + } + + funds + } +} + +pub trait AssetsExt { + fn mock_coins_sent( + &self, + app: &mut TestApp, + user: &Addr, + spender: &Addr, + typ: SendType, + ) -> Vec; +} + +impl AssetsExt for &[Asset] { + fn mock_coins_sent( + &self, + app: &mut TestApp, + user: &Addr, + spender: &Addr, + typ: SendType, + ) -> Vec { + let mut funds = vec![]; + for asset in self.iter() { + funds.extend(asset.mock_coin_sent(app, user, spender, typ)); + } + funds + } +} diff --git a/contracts/pair_xastro/tests/pair_xastro_integration.rs b/contracts/pair_xastro/tests/pair_xastro_integration.rs new file mode 100644 index 000000000..b769c961b --- /dev/null +++ b/contracts/pair_xastro/tests/pair_xastro_integration.rs @@ -0,0 +1,205 @@ +use cosmwasm_std::{coin, Addr, StdError}; + +use astroport::asset::{Asset, PairInfo}; +use astroport::factory::PairType; +use astroport::pair; +use astroport::pair::{ConfigResponse, CumulativePricesResponse}; +use astroport_pair_xastro::error::ContractError; + +use crate::helper::{Helper, ASTRO_DENOM}; + +mod helper; + +#[test] +fn test_basic() { + let owner = Addr::unchecked("owner"); + let mut helper = Helper::new(&owner).unwrap(); + + // Check ASTRO -> xASTRO swap + let offer_asset = Asset::native(ASTRO_DENOM, 100000u128); + + let sim_response = helper.simulate_swap(&offer_asset, None).unwrap(); + + helper.swap(&owner, &offer_asset, None, None).unwrap(); + + let xastro_bal = helper.native_balance(&helper.xastro_denom, &owner); + + assert_eq!(xastro_bal, sim_response.return_amount.u128()); + assert_eq!(xastro_bal, 100000u128 - 1000); + + // Check xASTRO -> ASTRO swap + let offer_asset = Asset::native(&helper.xastro_denom, xastro_bal); + let sim_response = helper.simulate_swap(&offer_asset, None).unwrap(); + + let astro_bal_before = helper.native_balance(ASTRO_DENOM, &owner); + helper.swap(&owner, &offer_asset, None, None).unwrap(); + let astro_bal_after = helper.native_balance(ASTRO_DENOM, &owner); + + assert_eq!( + astro_bal_after - astro_bal_before, + sim_response.return_amount.u128() + ); + assert_eq!(astro_bal_after - astro_bal_before, 100000u128 - 1000); + + let user = Addr::unchecked("user"); + helper + .mint_tokens(&user, &[coin(200000, ASTRO_DENOM)]) + .unwrap(); + helper + .swap(&owner, &Asset::native(ASTRO_DENOM, 100000u128), None, None) + .unwrap(); + + let err = helper + .provide_liquidity( + &owner, + &[ + Asset::native(ASTRO_DENOM, 100000u128), + Asset::native(&helper.xastro_denom, 100000u128), + ], + ) + .unwrap_err(); + assert_eq!(ContractError::NotSupported {}, err.downcast().unwrap()); + + helper.mint_tokens(&user, &[coin(100000, "rand")]).unwrap(); + let err = helper + .swap(&user, &Asset::native("rand", 100000u128), None, None) + .unwrap_err(); + assert_eq!( + ContractError::InvalidAsset("rand".to_string()), + err.downcast().unwrap() + ); +} + +#[test] +fn test_queries() { + let owner = Addr::unchecked("owner"); + + let mut helper = Helper::new(&owner).unwrap(); + + let share = helper.query_share(100000000u128).unwrap(); + assert_eq!( + share, + vec![ + Asset::native(ASTRO_DENOM, 0u8), + Asset::native(&helper.xastro_denom, 0u8), + ] + ); + + let pool_resp = helper.query_pool().unwrap(); + assert_eq!( + pool_resp, + pair::PoolResponse { + assets: vec![ + Asset::native(ASTRO_DENOM, 0u8), + Asset::native(&helper.xastro_denom, 0u8) + ], + total_share: 0u8.into(), + } + ); + + let err = helper + .app + .wrap() + .query_wasm_smart::( + &helper.pair_addr, + &pair::QueryMsg::CumulativePrices {}, + ) + .unwrap_err(); + assert_eq!( + err, + StdError::generic_err("Querier contract error: Operation is not supported") + ); + + let pool_info = helper + .app + .wrap() + .query_wasm_smart::(&helper.pair_addr, &pair::QueryMsg::Pair {}) + .unwrap(); + assert_eq!( + pool_info.pair_type, + PairType::Custom("pair_xastro".to_string()) + ); + + let config = helper + .app + .wrap() + .query_wasm_smart::(&helper.pair_addr, &pair::QueryMsg::Config {}) + .unwrap(); + assert_eq!( + config, + ConfigResponse { + block_time_last: 0, + params: None, + owner: owner.clone(), + factory_addr: helper.factory.clone(), + tracker_addr: None, + } + ); + + let err = helper + .simulate_swap(&Asset::native(ASTRO_DENOM, 1u128), None) + .unwrap_err(); + assert_eq!( + err.to_string(), + "Generic error: Querier contract error: Initial stake amount must be more than 1000" + ); + + let offer_asset = Asset::native(ASTRO_DENOM, 100000u128); + helper.swap(&owner, &offer_asset, None, None).unwrap(); + + let resp = helper + .simulate_swap(&Asset::native(ASTRO_DENOM, 1_000000u128), None) + .unwrap(); + assert_eq!( + resp, + pair::SimulationResponse { + return_amount: 1_000000u128.into(), + spread_amount: 0u128.into(), + commission_amount: 0u128.into(), + } + ); + + let err = helper + .simulate_swap(&Asset::native(&helper.xastro_denom, 100_000000u128), None) + .unwrap_err(); + assert_eq!(err.to_string(), "Generic error: Querier contract error: Invalid unstake amount. Want 100000000 but staking contract has only 100000"); + + let resp = helper + .simulate_reverse_swap(&Asset::native(ASTRO_DENOM, 1_000000u128), None) + .unwrap(); + assert_eq!( + resp, + pair::ReverseSimulationResponse { + offer_amount: 1_000000u128.into(), + spread_amount: 0u128.into(), + commission_amount: 0u128.into(), + } + ); + + let resp = helper + .simulate_reverse_swap(&Asset::native(&helper.xastro_denom, 10000u128), None) + .unwrap(); + assert_eq!( + resp, + pair::ReverseSimulationResponse { + offer_amount: 10000u128.into(), + spread_amount: 0u128.into(), + commission_amount: 0u128.into(), + } + ); + + let err = helper + .simulate_swap(&Asset::native("rand", 100_000000u128), None) + .unwrap_err(); + assert_eq!( + err.to_string(), + "Generic error: Querier contract error: Invalid asset rand" + ); + let err = helper + .simulate_reverse_swap(&Asset::native("rand", 100_000000u128), None) + .unwrap_err(); + assert_eq!( + err.to_string(), + "Generic error: Querier contract error: Invalid asset rand" + ); +} diff --git a/contracts/tokenomics/staking/Cargo.toml b/contracts/tokenomics/staking/Cargo.toml index 6116ea9a8..fd1c9682c 100644 --- a/contracts/tokenomics/staking/Cargo.toml +++ b/contracts/tokenomics/staking/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astroport-staking" -version = "2.2.0" +version = "2.3.0" authors = ["Astroport"] edition = "2021" description = "Astroport Staking Contract" diff --git a/contracts/tokenomics/staking/src/contract.rs b/contracts/tokenomics/staking/src/contract.rs index 19a3776a9..06e1b4b9c 100644 --- a/contracts/tokenomics/staking/src/contract.rs +++ b/contracts/tokenomics/staking/src/contract.rs @@ -140,7 +140,11 @@ pub fn execute( ("next_contract", &contract_address), ]) }), - ExecuteMsg::Leave {} => execute_leave(deps, env, info), + ExecuteMsg::Leave { receiver } => { + // ASTRO is returned to the receiver if provided or to the sender. + let recipient = receiver.unwrap_or_else(|| info.sender.to_string()); + execute_leave(deps, env, info, recipient) + } } } @@ -311,7 +315,12 @@ fn execute_enter( /// Leave unstakes TokenFactory xASTRO for ASTRO. xASTRO is burned and ASTRO /// returned to the sender -fn execute_leave(deps: DepsMut, env: Env, info: MessageInfo) -> Result { +fn execute_leave( + deps: DepsMut, + env: Env, + info: MessageInfo, + recipient: String, +) -> Result { let config = CONFIG.load(deps.storage)?; // Ensure that the correct denom is sent. Sending zero tokens is prohibited on chain level @@ -338,7 +347,7 @@ fn execute_leave(deps: DepsMut, env: Env, info: MessageInfo) -> Result Result + Sized) -> StdResult { + pub fn into_asset(self, precision: impl Into) -> StdResult { Ok(Asset { info: self.info, amount: self.amount.to_uint(precision)?, diff --git a/packages/astroport/src/lib.rs b/packages/astroport/src/lib.rs index 15c902eef..9862e50ad 100644 --- a/packages/astroport/src/lib.rs +++ b/packages/astroport/src/lib.rs @@ -33,6 +33,7 @@ mod mock_querier; pub mod astro_converter; pub mod incentives; +pub mod pair_xastro; #[cfg(test)] mod testing; diff --git a/packages/astroport/src/pair_xastro.rs b/packages/astroport/src/pair_xastro.rs new file mode 100644 index 000000000..2c04766bc --- /dev/null +++ b/packages/astroport/src/pair_xastro.rs @@ -0,0 +1,6 @@ +use cosmwasm_schema::cw_serde; + +#[cw_serde] +pub struct XastroPairInitParams { + pub staking: String, +} diff --git a/packages/astroport/src/staking.rs b/packages/astroport/src/staking.rs index cde70ea24..42a086798 100644 --- a/packages/astroport/src/staking.rs +++ b/packages/astroport/src/staking.rs @@ -26,8 +26,9 @@ pub enum ExecuteMsg { contract_address: String, msg: Binary, }, - /// Burns xASTRO in exchange for ASTRO - Leave {}, + /// Burns xASTRO in exchange for ASTRO. + /// The receiver is optional. If not set, the sender will receive the ASTRO. + Leave { receiver: Option }, } /// This structure describes the query messages available in the contract. diff --git a/packages/astroport_test/Cargo.toml b/packages/astroport_test/Cargo.toml index 08cfbe9cf..1c7eca0ff 100644 --- a/packages/astroport_test/Cargo.toml +++ b/packages/astroport_test/Cargo.toml @@ -29,4 +29,5 @@ schemars = "0.8.1" anyhow = "1.0" itertools = { workspace = true } cw-utils = { workspace = true } -cw-storage-plus = { workspace = true } \ No newline at end of file +cw-storage-plus = { workspace = true } +osmosis-std = "0.21.0" \ No newline at end of file diff --git a/packages/astroport_test/src/modules/stargate.rs b/packages/astroport_test/src/modules/stargate.rs index e68cc16e7..dcd4ed088 100644 --- a/packages/astroport_test/src/modules/stargate.rs +++ b/packages/astroport_test/src/modules/stargate.rs @@ -1,3 +1,4 @@ +use anyhow::{Ok, Result as AnyResult}; use cosmwasm_schema::serde::de::DeserializeOwned; use cosmwasm_std::{ coins, @@ -10,8 +11,7 @@ use cw_multi_test::{ GovFailingModule, IbcFailingModule, Module, StakeKeeper, Stargate, StargateMsg, StargateQuery, SudoMsg, WasmKeeper, }; - -use anyhow::{Ok, Result as AnyResult}; +use osmosis_std::types::osmosis::tokenfactory::v1beta1::MsgSetDenomMetadata; use astroport::token_factory::{ MsgBurn, MsgCreateDenom, MsgCreateDenomResponse, MsgMint, MsgSetBeforeSendHook, @@ -117,6 +117,10 @@ impl Module for MockStargate { }; router.sudo(api, storage, block, SudoMsg::Bank(msg)) } + MsgSetDenomMetadata::TYPE_URL => { + // TODO: Implement this if needed + Ok(AppResponse::default()) + } _ => Err(anyhow::anyhow!( "Unexpected exec msg {type_url} from {sender:?}", )), diff --git a/schemas/astroport-pair-xastro/astroport-pair-xastro.json b/schemas/astroport-pair-xastro/astroport-pair-xastro.json new file mode 100644 index 000000000..b0e23af18 --- /dev/null +++ b/schemas/astroport-pair-xastro/astroport-pair-xastro.json @@ -0,0 +1,1687 @@ +{ + "contract_name": "astroport-pair-xastro", + "contract_version": "1.0.0", + "idl_version": "1.0.0", + "instantiate": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "description": "This structure describes the parameters used for creating a contract.", + "type": "object", + "required": [ + "asset_infos", + "factory_addr", + "pair_type", + "token_code_id" + ], + "properties": { + "asset_infos": { + "description": "Information about assets in the pool", + "type": "array", + "items": { + "$ref": "#/definitions/AssetInfo" + } + }, + "factory_addr": { + "description": "The factory contract address", + "type": "string" + }, + "init_params": { + "description": "Optional binary serialised parameters for custom pool types", + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "pair_type": { + "description": "The pair type", + "allOf": [ + { + "$ref": "#/definitions/PairType" + } + ] + }, + "token_code_id": { + "description": "The token contract code ID used for the tokens in the pool", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "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" + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "PairType": { + "description": "This enum describes available pair types. ## Available pool types ``` # use astroport::factory::PairType::{Custom, Stable, Xyk}; Xyk {}; Stable {}; Custom(String::from(\"Custom\")); ```", + "oneOf": [ + { + "description": "XYK pair type", + "type": "object", + "required": [ + "xyk" + ], + "properties": { + "xyk": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stable pair type", + "type": "object", + "required": [ + "stable" + ], + "properties": { + "stable": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Custom pair type", + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + } + }, + "execute": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "description": "This structure describes the execute messages available in the contract.", + "oneOf": [ + { + "description": "Receives a message of type [`Cw20ReceiveMsg`]", + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" + } + }, + "additionalProperties": false + }, + { + "description": "ProvideLiquidity allows someone to provide liquidity in the pool", + "type": "object", + "required": [ + "provide_liquidity" + ], + "properties": { + "provide_liquidity": { + "type": "object", + "required": [ + "assets" + ], + "properties": { + "assets": { + "description": "The assets available in the pool", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "auto_stake": { + "description": "Determines whether the LP tokens minted for the user is auto_staked in the Incentives contract", + "type": [ + "boolean", + "null" + ] + }, + "min_lp_to_receive": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "receiver": { + "description": "The receiver of LP tokens", + "type": [ + "string", + "null" + ] + }, + "slippage_tolerance": { + "description": "The slippage tolerance that allows liquidity provision only if the price in the pool doesn't move too much", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "WithdrawLiquidity allows someone to withdraw liquidity from the pool", + "type": "object", + "required": [ + "withdraw_liquidity" + ], + "properties": { + "withdraw_liquidity": { + "type": "object", + "properties": { + "assets": { + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "min_assets_to_receive": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Asset" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Swap performs a swap in the pool", + "type": "object", + "required": [ + "swap" + ], + "properties": { + "swap": { + "type": "object", + "required": [ + "offer_asset" + ], + "properties": { + "ask_asset_info": { + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + }, + "belief_price": { + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "max_spread": { + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "offer_asset": { + "$ref": "#/definitions/Asset" + }, + "to": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Update the pair configuration", + "type": "object", + "required": [ + "update_config" + ], + "properties": { + "update_config": { + "type": "object", + "required": [ + "params" + ], + "properties": { + "params": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "ProposeNewOwner creates a proposal to change contract ownership. The validity period for the proposal is set in the `expires_in` variable.", + "type": "object", + "required": [ + "propose_new_owner" + ], + "properties": { + "propose_new_owner": { + "type": "object", + "required": [ + "expires_in", + "owner" + ], + "properties": { + "expires_in": { + "description": "The date after which this proposal expires", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "description": "Newly proposed contract owner", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "DropOwnershipProposal removes the existing offer to change contract ownership.", + "type": "object", + "required": [ + "drop_ownership_proposal" + ], + "properties": { + "drop_ownership_proposal": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Used to claim contract ownership.", + "type": "object", + "required": [ + "claim_ownership" + ], + "properties": { + "claim_ownership": { + "type": "object", + "additionalProperties": false + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "Cw20ReceiveMsg": { + "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", + "type": "object", + "required": [ + "amount", + "msg", + "sender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + } + } + }, + "query": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "This structure describes the query messages available in the contract.", + "oneOf": [ + { + "description": "Returns information about a pair in an object of type [`super::asset::PairInfo`].", + "type": "object", + "required": [ + "pair" + ], + "properties": { + "pair": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about a pool in an object of type [`PoolResponse`].", + "type": "object", + "required": [ + "pool" + ], + "properties": { + "pool": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns contract configuration settings in a custom [`ConfigResponse`] structure.", + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about the share of the pool in a vector that contains objects of type [`Asset`].", + "type": "object", + "required": [ + "share" + ], + "properties": { + "share": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about a swap simulation in a [`SimulationResponse`] object.", + "type": "object", + "required": [ + "simulation" + ], + "properties": { + "simulation": { + "type": "object", + "required": [ + "offer_asset" + ], + "properties": { + "ask_asset_info": { + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + }, + "offer_asset": { + "$ref": "#/definitions/Asset" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about cumulative prices in a [`ReverseSimulationResponse`] object.", + "type": "object", + "required": [ + "reverse_simulation" + ], + "properties": { + "reverse_simulation": { + "type": "object", + "required": [ + "ask_asset" + ], + "properties": { + "ask_asset": { + "$ref": "#/definitions/Asset" + }, + "offer_asset_info": { + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about the cumulative prices in a [`CumulativePricesResponse`] object", + "type": "object", + "required": [ + "cumulative_prices" + ], + "properties": { + "cumulative_prices": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns current D invariant in as a [`u128`] value", + "type": "object", + "required": [ + "query_compute_d" + ], + "properties": { + "query_compute_d": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the balance of the specified asset that was in the pool just preceeding the moment of the specified block height creation.", + "type": "object", + "required": [ + "asset_balance_at" + ], + "properties": { + "asset_balance_at": { + "type": "object", + "required": [ + "asset_info", + "block_height" + ], + "properties": { + "asset_info": { + "$ref": "#/definitions/AssetInfo" + }, + "block_height": { + "$ref": "#/definitions/Uint64" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Query price from observations", + "type": "object", + "required": [ + "observe" + ], + "properties": { + "observe": { + "type": "object", + "required": [ + "seconds_ago" + ], + "properties": { + "seconds_ago": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns an estimation of assets received for the given amount of LP tokens", + "type": "object", + "required": [ + "simulate_withdraw" + ], + "properties": { + "simulate_withdraw": { + "type": "object", + "required": [ + "lp_amount" + ], + "properties": { + "lp_amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns an estimation of shares received for the given amount of assets", + "type": "object", + "required": [ + "simulate_provide" + ], + "properties": { + "simulate_provide": { + "type": "object", + "required": [ + "assets" + ], + "properties": { + "assets": { + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "slippage_tolerance": { + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } + }, + "migrate": null, + "sudo": null, + "responses": { + "asset_balance_at": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_Uint128", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ], + "definitions": { + "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" + } + } + }, + "config": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "description": "This struct is used to return a query result with the general contract configuration.", + "type": "object", + "required": [ + "block_time_last", + "factory_addr", + "owner" + ], + "properties": { + "block_time_last": { + "description": "Last timestamp when the cumulative prices in the pool were updated", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "factory_addr": { + "description": "The factory contract address", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "owner": { + "description": "The contract owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "params": { + "description": "The pool's parameters", + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "tracker_addr": { + "description": "Tracker contract address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "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" + }, + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + } + } + }, + "cumulative_prices": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CumulativePricesResponse", + "description": "This structure is used to return a cumulative prices query response.", + "type": "object", + "required": [ + "assets", + "cumulative_prices", + "total_share" + ], + "properties": { + "assets": { + "description": "The assets in the pool to query", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "cumulative_prices": { + "description": "The vector contains cumulative prices for each pair of assets in the pool", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "$ref": "#/definitions/AssetInfo" + }, + { + "$ref": "#/definitions/Uint128" + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "total_share": { + "description": "The total amount of LP tokens currently issued", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } + }, + "observe": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OracleObservation", + "type": "object", + "required": [ + "price", + "timestamp" + ], + "properties": { + "price": { + "$ref": "#/definitions/Decimal" + }, + "timestamp": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } + }, + "pair": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PairInfo", + "description": "This structure stores the main parameters for an Astroport pair", + "type": "object", + "required": [ + "asset_infos", + "contract_addr", + "liquidity_token", + "pair_type" + ], + "properties": { + "asset_infos": { + "description": "Asset information for the assets in the pool", + "type": "array", + "items": { + "$ref": "#/definitions/AssetInfo" + } + }, + "contract_addr": { + "description": "Pair contract address", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "liquidity_token": { + "description": "Pair LP token denom", + "type": "string" + }, + "pair_type": { + "description": "The pool type (xyk, stableswap etc) available in [`PairType`]", + "allOf": [ + { + "$ref": "#/definitions/PairType" + } + ] + } + }, + "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" + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "PairType": { + "description": "This enum describes available pair types. ## Available pool types ``` # use astroport::factory::PairType::{Custom, Stable, Xyk}; Xyk {}; Stable {}; Custom(String::from(\"Custom\")); ```", + "oneOf": [ + { + "description": "XYK pair type", + "type": "object", + "required": [ + "xyk" + ], + "properties": { + "xyk": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stable pair type", + "type": "object", + "required": [ + "stable" + ], + "properties": { + "stable": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Custom pair type", + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + } + }, + "pool": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PoolResponse", + "description": "This struct is used to return a query result with the total amount of LP tokens and assets in a specific pool.", + "type": "object", + "required": [ + "assets", + "total_share" + ], + "properties": { + "assets": { + "description": "The assets in the pool together with asset amounts", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "total_share": { + "description": "The total amount of LP tokens currently issued", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } + }, + "query_compute_d": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "reverse_simulation": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ReverseSimulationResponse", + "description": "This structure holds the parameters that are returned from a reverse swap simulation response.", + "type": "object", + "required": [ + "commission_amount", + "offer_amount", + "spread_amount" + ], + "properties": { + "commission_amount": { + "description": "The amount of fees charged by the transaction", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "offer_amount": { + "description": "The amount of offer assets returned by the reverse swap", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "spread_amount": { + "description": "The spread used in the swap operation", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "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" + } + } + }, + "share": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_Asset", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } + }, + "simulate_provide": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" + }, + "simulate_withdraw": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_Asset", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } + }, + "simulation": { + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SimulationResponse", + "description": "This structure holds the parameters that are returned from a swap simulation response", + "type": "object", + "required": [ + "commission_amount", + "return_amount", + "spread_amount" + ], + "properties": { + "commission_amount": { + "description": "The amount of fees charged by the transaction", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "return_amount": { + "description": "The amount of ask assets returned by the swap", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "spread_amount": { + "description": "The spread used in the swap operation", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "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" + } + } + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/execute.json b/schemas/astroport-pair-xastro/raw/execute.json new file mode 100644 index 000000000..443466010 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/execute.json @@ -0,0 +1,366 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ExecuteMsg", + "description": "This structure describes the execute messages available in the contract.", + "oneOf": [ + { + "description": "Receives a message of type [`Cw20ReceiveMsg`]", + "type": "object", + "required": [ + "receive" + ], + "properties": { + "receive": { + "$ref": "#/definitions/Cw20ReceiveMsg" + } + }, + "additionalProperties": false + }, + { + "description": "ProvideLiquidity allows someone to provide liquidity in the pool", + "type": "object", + "required": [ + "provide_liquidity" + ], + "properties": { + "provide_liquidity": { + "type": "object", + "required": [ + "assets" + ], + "properties": { + "assets": { + "description": "The assets available in the pool", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "auto_stake": { + "description": "Determines whether the LP tokens minted for the user is auto_staked in the Incentives contract", + "type": [ + "boolean", + "null" + ] + }, + "min_lp_to_receive": { + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ] + }, + "receiver": { + "description": "The receiver of LP tokens", + "type": [ + "string", + "null" + ] + }, + "slippage_tolerance": { + "description": "The slippage tolerance that allows liquidity provision only if the price in the pool doesn't move too much", + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "WithdrawLiquidity allows someone to withdraw liquidity from the pool", + "type": "object", + "required": [ + "withdraw_liquidity" + ], + "properties": { + "withdraw_liquidity": { + "type": "object", + "properties": { + "assets": { + "default": [], + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "min_assets_to_receive": { + "type": [ + "array", + "null" + ], + "items": { + "$ref": "#/definitions/Asset" + } + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Swap performs a swap in the pool", + "type": "object", + "required": [ + "swap" + ], + "properties": { + "swap": { + "type": "object", + "required": [ + "offer_asset" + ], + "properties": { + "ask_asset_info": { + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + }, + "belief_price": { + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "max_spread": { + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + }, + "offer_asset": { + "$ref": "#/definitions/Asset" + }, + "to": { + "type": [ + "string", + "null" + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Update the pair configuration", + "type": "object", + "required": [ + "update_config" + ], + "properties": { + "update_config": { + "type": "object", + "required": [ + "params" + ], + "properties": { + "params": { + "$ref": "#/definitions/Binary" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "ProposeNewOwner creates a proposal to change contract ownership. The validity period for the proposal is set in the `expires_in` variable.", + "type": "object", + "required": [ + "propose_new_owner" + ], + "properties": { + "propose_new_owner": { + "type": "object", + "required": [ + "expires_in", + "owner" + ], + "properties": { + "expires_in": { + "description": "The date after which this proposal expires", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "owner": { + "description": "Newly proposed contract owner", + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "DropOwnershipProposal removes the existing offer to change contract ownership.", + "type": "object", + "required": [ + "drop_ownership_proposal" + ], + "properties": { + "drop_ownership_proposal": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Used to claim contract ownership.", + "type": "object", + "required": [ + "claim_ownership" + ], + "properties": { + "claim_ownership": { + "type": "object", + "additionalProperties": false + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "Cw20ReceiveMsg": { + "description": "Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg", + "type": "object", + "required": [ + "amount", + "msg", + "sender" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + }, + "msg": { + "$ref": "#/definitions/Binary" + }, + "sender": { + "type": "string" + } + }, + "additionalProperties": false + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/instantiate.json b/schemas/astroport-pair-xastro/raw/instantiate.json new file mode 100644 index 000000000..00ccada94 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/instantiate.json @@ -0,0 +1,156 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "InstantiateMsg", + "description": "This structure describes the parameters used for creating a contract.", + "type": "object", + "required": [ + "asset_infos", + "factory_addr", + "pair_type", + "token_code_id" + ], + "properties": { + "asset_infos": { + "description": "Information about assets in the pool", + "type": "array", + "items": { + "$ref": "#/definitions/AssetInfo" + } + }, + "factory_addr": { + "description": "The factory contract address", + "type": "string" + }, + "init_params": { + "description": "Optional binary serialised parameters for custom pool types", + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "pair_type": { + "description": "The pair type", + "allOf": [ + { + "$ref": "#/definitions/PairType" + } + ] + }, + "token_code_id": { + "description": "The token contract code ID used for the tokens in the pool", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "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" + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + }, + "PairType": { + "description": "This enum describes available pair types. ## Available pool types ``` # use astroport::factory::PairType::{Custom, Stable, Xyk}; Xyk {}; Stable {}; Custom(String::from(\"Custom\")); ```", + "oneOf": [ + { + "description": "XYK pair type", + "type": "object", + "required": [ + "xyk" + ], + "properties": { + "xyk": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stable pair type", + "type": "object", + "required": [ + "stable" + ], + "properties": { + "stable": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Custom pair type", + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/query.json b/schemas/astroport-pair-xastro/raw/query.json new file mode 100644 index 000000000..b7da792ec --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/query.json @@ -0,0 +1,364 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "QueryMsg", + "description": "This structure describes the query messages available in the contract.", + "oneOf": [ + { + "description": "Returns information about a pair in an object of type [`super::asset::PairInfo`].", + "type": "object", + "required": [ + "pair" + ], + "properties": { + "pair": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about a pool in an object of type [`PoolResponse`].", + "type": "object", + "required": [ + "pool" + ], + "properties": { + "pool": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns contract configuration settings in a custom [`ConfigResponse`] structure.", + "type": "object", + "required": [ + "config" + ], + "properties": { + "config": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about the share of the pool in a vector that contains objects of type [`Asset`].", + "type": "object", + "required": [ + "share" + ], + "properties": { + "share": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about a swap simulation in a [`SimulationResponse`] object.", + "type": "object", + "required": [ + "simulation" + ], + "properties": { + "simulation": { + "type": "object", + "required": [ + "offer_asset" + ], + "properties": { + "ask_asset_info": { + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + }, + "offer_asset": { + "$ref": "#/definitions/Asset" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about cumulative prices in a [`ReverseSimulationResponse`] object.", + "type": "object", + "required": [ + "reverse_simulation" + ], + "properties": { + "reverse_simulation": { + "type": "object", + "required": [ + "ask_asset" + ], + "properties": { + "ask_asset": { + "$ref": "#/definitions/Asset" + }, + "offer_asset_info": { + "anyOf": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns information about the cumulative prices in a [`CumulativePricesResponse`] object", + "type": "object", + "required": [ + "cumulative_prices" + ], + "properties": { + "cumulative_prices": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns current D invariant in as a [`u128`] value", + "type": "object", + "required": [ + "query_compute_d" + ], + "properties": { + "query_compute_d": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns the balance of the specified asset that was in the pool just preceeding the moment of the specified block height creation.", + "type": "object", + "required": [ + "asset_balance_at" + ], + "properties": { + "asset_balance_at": { + "type": "object", + "required": [ + "asset_info", + "block_height" + ], + "properties": { + "asset_info": { + "$ref": "#/definitions/AssetInfo" + }, + "block_height": { + "$ref": "#/definitions/Uint64" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Query price from observations", + "type": "object", + "required": [ + "observe" + ], + "properties": { + "observe": { + "type": "object", + "required": [ + "seconds_ago" + ], + "properties": { + "seconds_ago": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns an estimation of assets received for the given amount of LP tokens", + "type": "object", + "required": [ + "simulate_withdraw" + ], + "properties": { + "simulate_withdraw": { + "type": "object", + "required": [ + "lp_amount" + ], + "properties": { + "lp_amount": { + "$ref": "#/definitions/Uint128" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Returns an estimation of shares received for the given amount of assets", + "type": "object", + "required": [ + "simulate_provide" + ], + "properties": { + "simulate_provide": { + "type": "object", + "required": [ + "assets" + ], + "properties": { + "assets": { + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "slippage_tolerance": { + "anyOf": [ + { + "$ref": "#/definitions/Decimal" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + }, + "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" + }, + "Uint64": { + "description": "A thin wrapper around u64 that is using strings for JSON encoding/decoding, such that the full u64 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 `u64` to get the value out:\n\n``` # use cosmwasm_std::Uint64; let a = Uint64::from(42u64); assert_eq!(a.u64(), 42);\n\nlet b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ```", + "type": "string" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_asset_balance_at.json b/schemas/astroport-pair-xastro/raw/response_to_asset_balance_at.json new file mode 100644 index 000000000..2eaf6e96f --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_asset_balance_at.json @@ -0,0 +1,18 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Nullable_Uint128", + "anyOf": [ + { + "$ref": "#/definitions/Uint128" + }, + { + "type": "null" + } + ], + "definitions": { + "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" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_config.json b/schemas/astroport-pair-xastro/raw/response_to_config.json new file mode 100644 index 000000000..953b0adc7 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_config.json @@ -0,0 +1,68 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ConfigResponse", + "description": "This struct is used to return a query result with the general contract configuration.", + "type": "object", + "required": [ + "block_time_last", + "factory_addr", + "owner" + ], + "properties": { + "block_time_last": { + "description": "Last timestamp when the cumulative prices in the pool were updated", + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "factory_addr": { + "description": "The factory contract address", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "owner": { + "description": "The contract owner", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "params": { + "description": "The pool's parameters", + "anyOf": [ + { + "$ref": "#/definitions/Binary" + }, + { + "type": "null" + } + ] + }, + "tracker_addr": { + "description": "Tracker contract address", + "anyOf": [ + { + "$ref": "#/definitions/Addr" + }, + { + "type": "null" + } + ] + } + }, + "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" + }, + "Binary": { + "description": "Binary is a wrapper around Vec 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. See also .", + "type": "string" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_cumulative_prices.json b/schemas/astroport-pair-xastro/raw/response_to_cumulative_prices.json new file mode 100644 index 000000000..695a3121f --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_cumulative_prices.json @@ -0,0 +1,135 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "CumulativePricesResponse", + "description": "This structure is used to return a cumulative prices query response.", + "type": "object", + "required": [ + "assets", + "cumulative_prices", + "total_share" + ], + "properties": { + "assets": { + "description": "The assets in the pool to query", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "cumulative_prices": { + "description": "The vector contains cumulative prices for each pair of assets in the pool", + "type": "array", + "items": { + "type": "array", + "items": [ + { + "$ref": "#/definitions/AssetInfo" + }, + { + "$ref": "#/definitions/AssetInfo" + }, + { + "$ref": "#/definitions/Uint128" + } + ], + "maxItems": 3, + "minItems": 3 + } + }, + "total_share": { + "description": "The total amount of LP tokens currently issued", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_observe.json b/schemas/astroport-pair-xastro/raw/response_to_observe.json new file mode 100644 index 000000000..a8c389cb0 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_observe.json @@ -0,0 +1,26 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "OracleObservation", + "type": "object", + "required": [ + "price", + "timestamp" + ], + "properties": { + "price": { + "$ref": "#/definitions/Decimal" + }, + "timestamp": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false, + "definitions": { + "Decimal": { + "description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)", + "type": "string" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_pair.json b/schemas/astroport-pair-xastro/raw/response_to_pair.json new file mode 100644 index 000000000..16721f81d --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_pair.json @@ -0,0 +1,143 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PairInfo", + "description": "This structure stores the main parameters for an Astroport pair", + "type": "object", + "required": [ + "asset_infos", + "contract_addr", + "liquidity_token", + "pair_type" + ], + "properties": { + "asset_infos": { + "description": "Asset information for the assets in the pool", + "type": "array", + "items": { + "$ref": "#/definitions/AssetInfo" + } + }, + "contract_addr": { + "description": "Pair contract address", + "allOf": [ + { + "$ref": "#/definitions/Addr" + } + ] + }, + "liquidity_token": { + "description": "Pair LP token denom", + "type": "string" + }, + "pair_type": { + "description": "The pool type (xyk, stableswap etc) available in [`PairType`]", + "allOf": [ + { + "$ref": "#/definitions/PairType" + } + ] + } + }, + "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" + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "PairType": { + "description": "This enum describes available pair types. ## Available pool types ``` # use astroport::factory::PairType::{Custom, Stable, Xyk}; Xyk {}; Stable {}; Custom(String::from(\"Custom\")); ```", + "oneOf": [ + { + "description": "XYK pair type", + "type": "object", + "required": [ + "xyk" + ], + "properties": { + "xyk": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Stable pair type", + "type": "object", + "required": [ + "stable" + ], + "properties": { + "stable": { + "type": "object", + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Custom pair type", + "type": "object", + "required": [ + "custom" + ], + "properties": { + "custom": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_pool.json b/schemas/astroport-pair-xastro/raw/response_to_pool.json new file mode 100644 index 000000000..693cad0e0 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_pool.json @@ -0,0 +1,114 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "PoolResponse", + "description": "This struct is used to return a query result with the total amount of LP tokens and assets in a specific pool.", + "type": "object", + "required": [ + "assets", + "total_share" + ], + "properties": { + "assets": { + "description": "The assets in the pool together with asset amounts", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + } + }, + "total_share": { + "description": "The total amount of LP tokens currently issued", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_query_compute_d.json b/schemas/astroport-pair-xastro/raw/response_to_query_compute_d.json new file mode 100644 index 000000000..25b73e8f2 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_query_compute_d.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_reverse_simulation.json b/schemas/astroport-pair-xastro/raw/response_to_reverse_simulation.json new file mode 100644 index 000000000..ca711e182 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_reverse_simulation.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "ReverseSimulationResponse", + "description": "This structure holds the parameters that are returned from a reverse swap simulation response.", + "type": "object", + "required": [ + "commission_amount", + "offer_amount", + "spread_amount" + ], + "properties": { + "commission_amount": { + "description": "The amount of fees charged by the transaction", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "offer_amount": { + "description": "The amount of offer assets returned by the reverse swap", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "spread_amount": { + "description": "The spread used in the swap operation", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "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" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_share.json b/schemas/astroport-pair-xastro/raw/response_to_share.json new file mode 100644 index 000000000..8285d4916 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_share.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_Asset", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_simulate_provide.json b/schemas/astroport-pair-xastro/raw/response_to_simulate_provide.json new file mode 100644 index 000000000..25b73e8f2 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_simulate_provide.json @@ -0,0 +1,6 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "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" +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_simulate_withdraw.json b/schemas/astroport-pair-xastro/raw/response_to_simulate_withdraw.json new file mode 100644 index 000000000..8285d4916 --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_simulate_withdraw.json @@ -0,0 +1,94 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Array_of_Asset", + "type": "array", + "items": { + "$ref": "#/definitions/Asset" + }, + "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" + }, + "Asset": { + "description": "This enum describes a Terra asset (native or CW20).", + "type": "object", + "required": [ + "amount", + "info" + ], + "properties": { + "amount": { + "description": "A token amount", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "info": { + "description": "Information about an asset stored in a [`AssetInfo`] struct", + "allOf": [ + { + "$ref": "#/definitions/AssetInfo" + } + ] + } + }, + "additionalProperties": false + }, + "AssetInfo": { + "description": "This enum describes available Token types. ## Examples ``` # use cosmwasm_std::Addr; # use astroport::asset::AssetInfo::{NativeToken, Token}; Token { contract_addr: Addr::unchecked(\"stake...\") }; NativeToken { denom: String::from(\"uluna\") }; ```", + "oneOf": [ + { + "description": "Non-native Token", + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "object", + "required": [ + "contract_addr" + ], + "properties": { + "contract_addr": { + "$ref": "#/definitions/Addr" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + }, + { + "description": "Native token", + "type": "object", + "required": [ + "native_token" + ], + "properties": { + "native_token": { + "type": "object", + "required": [ + "denom" + ], + "properties": { + "denom": { + "type": "string" + } + }, + "additionalProperties": false + } + }, + "additionalProperties": false + } + ] + }, + "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" + } + } +} diff --git a/schemas/astroport-pair-xastro/raw/response_to_simulation.json b/schemas/astroport-pair-xastro/raw/response_to_simulation.json new file mode 100644 index 000000000..4bc828d4a --- /dev/null +++ b/schemas/astroport-pair-xastro/raw/response_to_simulation.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "SimulationResponse", + "description": "This structure holds the parameters that are returned from a swap simulation response", + "type": "object", + "required": [ + "commission_amount", + "return_amount", + "spread_amount" + ], + "properties": { + "commission_amount": { + "description": "The amount of fees charged by the transaction", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "return_amount": { + "description": "The amount of ask assets returned by the swap", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + }, + "spread_amount": { + "description": "The spread used in the swap operation", + "allOf": [ + { + "$ref": "#/definitions/Uint128" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "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" + } + } +} diff --git a/schemas/astroport-staking/astroport-staking.json b/schemas/astroport-staking/astroport-staking.json index 684ae294f..96a2cbbcb 100644 --- a/schemas/astroport-staking/astroport-staking.json +++ b/schemas/astroport-staking/astroport-staking.json @@ -1,6 +1,6 @@ { "contract_name": "astroport-staking", - "contract_version": "2.2.0", + "contract_version": "2.3.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -89,7 +89,7 @@ "additionalProperties": false }, { - "description": "Burns xASTRO in exchange for ASTRO", + "description": "Burns xASTRO in exchange for ASTRO. The receiver is optional. If not set, the sender will receive the ASTRO.", "type": "object", "required": [ "leave" @@ -97,6 +97,14 @@ "properties": { "leave": { "type": "object", + "properties": { + "receiver": { + "type": [ + "string", + "null" + ] + } + }, "additionalProperties": false } }, diff --git a/schemas/astroport-staking/raw/execute.json b/schemas/astroport-staking/raw/execute.json index 19ab48c20..670519b62 100644 --- a/schemas/astroport-staking/raw/execute.json +++ b/schemas/astroport-staking/raw/execute.json @@ -52,7 +52,7 @@ "additionalProperties": false }, { - "description": "Burns xASTRO in exchange for ASTRO", + "description": "Burns xASTRO in exchange for ASTRO. The receiver is optional. If not set, the sender will receive the ASTRO.", "type": "object", "required": [ "leave" @@ -60,6 +60,14 @@ "properties": { "leave": { "type": "object", + "properties": { + "receiver": { + "type": [ + "string", + "null" + ] + } + }, "additionalProperties": false } },