From f119d63968642fe129371338de4ac24be41da1bf Mon Sep 17 00:00:00 2001 From: Timofey <5527315+epanchee@users.noreply.github.com> Date: Fri, 27 Sep 2024 12:28:18 +0400 Subject: [PATCH] feat(pairs): pass pair type from factory during pool instantiation (#431) * feat(pairs): pass pair type from factory during pool instantiation * enable conditional compilation for sei and injective * bump astroport to v5.5.0 --- Cargo.lock | 82 ++++++---- contracts/factory/Cargo.toml | 2 +- contracts/factory/src/contract.rs | 16 +- contracts/factory/src/testing.rs | 1 + contracts/pair/Cargo.toml | 3 +- contracts/pair/src/contract.rs | 3 +- contracts/pair/src/testing.rs | 7 + contracts/pair/tests/integration.rs | 146 ++++++++++++++++-- contracts/pair_astro_converter/Cargo.toml | 2 +- contracts/pair_concentrated/Cargo.toml | 2 +- contracts/pair_concentrated/src/contract.rs | 3 +- contracts/pair_stable/Cargo.toml | 3 +- contracts/pair_stable/src/contract.rs | 3 +- contracts/pair_stable/src/testing.rs | 10 ++ contracts/pair_stable/tests/integration.rs | 5 + contracts/pair_transmuter/Cargo.toml | 1 + contracts/pair_xyk_sale_tax/Cargo.toml | 3 +- contracts/pair_xyk_sale_tax/src/contract.rs | 2 +- contracts/pair_xyk_sale_tax/src/testing.rs | 9 +- .../pair_xyk_sale_tax/tests/integration.rs | 8 + packages/astroport/Cargo.toml | 2 +- packages/astroport/src/pair.rs | 29 +--- .../astroport-factory/astroport-factory.json | 2 +- .../astroport-pair-concentrated.json | 57 ++++++- .../raw/instantiate.json | 55 +++++++ .../astroport-pair-stable.json | 57 ++++++- .../raw/instantiate.json | 55 +++++++ .../astroport-pair-xyk-sale-tax.json | 57 ++++++- .../raw/instantiate.json | 55 +++++++ schemas/astroport-pair/astroport-pair.json | 57 ++++++- schemas/astroport-pair/raw/instantiate.json | 55 +++++++ scripts/build_release.sh | 2 +- 32 files changed, 702 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5eaf63be..f800aed8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -151,7 +151,7 @@ dependencies = [ [[package]] name = "astroport" -version = "5.4.0" +version = "5.5.0" dependencies = [ "astroport-circular-buffer 0.2.0", "cosmos-sdk-proto 0.19.0", @@ -193,11 +193,27 @@ dependencies = [ [[package]] name = "astroport-factory" -version = "1.8.1" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68abcc896255acba2f4aa39f239a1e8361a6035d7bc712442da122dc31f6f959" +dependencies = [ + "astroport 5.2.0", + "cosmwasm-schema", + "cosmwasm-std", + "cw-storage-plus 1.2.0", + "cw-utils 1.0.3", + "cw2 1.1.2", + "itertools 0.12.1", + "thiserror", +] + +[[package]] +name = "astroport-factory" +version = "1.9.0" dependencies = [ "anyhow", - "astroport 5.4.0", - "astroport-pair 2.0.2", + "astroport 5.5.0", + "astroport-pair 2.1.0", "astroport-test", "cosmwasm-schema", "cosmwasm-std", @@ -245,10 +261,10 @@ version = "1.2.0" dependencies = [ "anyhow", "astro-token-converter", - "astroport 5.4.0", - "astroport-factory", + "astroport 5.5.0", + "astroport-factory 1.9.0", "astroport-native-coin-registry", - "astroport-pair 2.0.2", + "astroport-pair 2.1.0", "astroport-pair-stable", "astroport-test", "astroport-vesting 1.3.1", @@ -271,9 +287,9 @@ version = "1.5.0" dependencies = [ "astro-satellite-package", "astroport 4.0.3", - "astroport-factory", + "astroport-factory 1.9.0", "astroport-native-coin-registry", - "astroport-pair 2.0.2", + "astroport-pair 2.1.0", "astroport-pair-stable", "astroport-test", "cosmwasm-schema", @@ -305,9 +321,9 @@ version = "2.1.2" dependencies = [ "anyhow", "astroport 3.12.2", - "astroport-factory", + "astroport-factory 1.9.0", "astroport-native-coin-registry", - "astroport-pair 2.0.2", + "astroport-pair 2.1.0", "astroport-pair-stable", "astroport-test", "cosmwasm-schema", @@ -339,10 +355,10 @@ dependencies = [ [[package]] name = "astroport-pair" -version = "2.0.2" +version = "2.1.0" dependencies = [ - "astroport 5.4.0", - "astroport-factory", + "astroport 5.5.0", + "astroport-factory 1.9.0", "astroport-incentives", "astroport-test", "astroport-tokenfactory-tracker 2.0.0", @@ -361,12 +377,12 @@ dependencies = [ [[package]] name = "astroport-pair-concentrated" -version = "4.0.2" +version = "4.1.0" dependencies = [ "anyhow", - "astroport 5.4.0", + "astroport 5.5.0", "astroport-circular-buffer 0.2.0", - "astroport-factory", + "astroport-factory 1.9.0", "astroport-incentives", "astroport-native-coin-registry", "astroport-pcl-common", @@ -392,7 +408,7 @@ dependencies = [ "anyhow", "astro-token-converter", "astroport 4.0.3", - "astroport-factory", + "astroport-factory 1.8.0", "astroport-pair 1.3.3", "cosmwasm-schema", "cosmwasm-std", @@ -410,12 +426,12 @@ dependencies = [ [[package]] name = "astroport-pair-stable" -version = "4.0.1" +version = "4.1.0" dependencies = [ "anyhow", - "astroport 5.4.0", + "astroport 5.5.0", "astroport-circular-buffer 0.2.0", - "astroport-factory", + "astroport-factory 1.9.0", "astroport-incentives", "astroport-native-coin-registry", "astroport-test", @@ -439,8 +455,8 @@ name = "astroport-pair-transmuter" version = "1.1.2" dependencies = [ "anyhow", - "astroport 5.4.0", - "astroport-factory", + "astroport 5.5.0", + "astroport-factory 1.9.0", "astroport-native-coin-registry", "astroport-test", "cosmwasm-schema", @@ -457,13 +473,13 @@ dependencies = [ [[package]] name = "astroport-pair-xyk-sale-tax" -version = "2.0.2" +version = "2.1.0" dependencies = [ - "astroport 5.4.0", - "astroport-factory", + "astroport 5.5.0", + "astroport-factory 1.9.0", "astroport-incentives", "astroport-pair 1.3.3", - "astroport-pair 2.0.2", + "astroport-pair 2.1.0", "astroport-test", "astroport-tokenfactory-tracker 2.0.0", "cosmwasm-schema", @@ -485,8 +501,8 @@ name = "astroport-pcl-common" version = "2.0.2" dependencies = [ "anyhow", - "astroport 5.4.0", - "astroport-factory", + "astroport 5.5.0", + "astroport-factory 1.9.0", "astroport-test", "cosmwasm-schema", "cosmwasm-std", @@ -502,8 +518,8 @@ version = "1.2.1" dependencies = [ "anyhow", "astroport 3.12.2", - "astroport-factory", - "astroport-pair 2.0.2", + "astroport-factory 1.9.0", + "astroport-pair 2.1.0", "astroport-test", "cosmwasm-schema", "cosmwasm-std", @@ -521,7 +537,7 @@ version = "2.2.0" dependencies = [ "anyhow", "astroport 4.0.3", - "astroport 5.4.0", + "astroport 5.5.0", "astroport-tokenfactory-tracker 1.0.0", "cosmwasm-schema", "cosmwasm-std", @@ -539,7 +555,7 @@ name = "astroport-test" version = "0.1.0" dependencies = [ "anyhow", - "astroport 5.4.0", + "astroport 5.5.0", "cosmwasm-schema", "cosmwasm-std", "cw-multi-test 1.0.0", diff --git a/contracts/factory/Cargo.toml b/contracts/factory/Cargo.toml index b2a9f462..295eadd6 100644 --- a/contracts/factory/Cargo.toml +++ b/contracts/factory/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astroport-factory" -version = "1.8.1" +version = "1.9.0" authors = ["Astroport"] edition = "2021" description = "Astroport factory contract - pair contract generator and directory" diff --git a/contracts/factory/src/contract.rs b/contracts/factory/src/contract.rs index 6de023f7..91ee32a0 100644 --- a/contracts/factory/src/contract.rs +++ b/contracts/factory/src/contract.rs @@ -327,12 +327,13 @@ pub fn execute_create_pair( admin: Some(config.owner.to_string()), code_id: pair_config.code_id, msg: to_json_binary(&PairInstantiateMsg { + pair_type, asset_infos: asset_infos.clone(), token_code_id: config.token_code_id, factory_addr: env.contract.address.to_string(), init_params, })?, - // Pass executer funds to pair contract in order to pay for LP token creation + // Pass executor funds to pair contract to pay for LP token creation funds: info.funds, label: "Astroport pair".to_string(), } @@ -576,6 +577,18 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result { migrate_pair_configs(deps.storage)?; + if let Some(tracker_config) = msg.tracker_config { + TRACKER_CONFIG.save( + deps.storage, + &TrackerConfig { + code_id: tracker_config.code_id, + token_factory_addr: deps + .api + .addr_validate(&tracker_config.token_factory_addr)? + .to_string(), + }, + )?; + } } "1.7.0" => { if let Some(tracker_config) = msg.tracker_config { @@ -591,6 +604,7 @@ pub fn migrate(deps: DepsMut, _env: Env, msg: MigrateMsg) -> Result {} _ => return Err(ContractError::MigrationError {}), }, _ => return Err(ContractError::MigrationError {}), diff --git a/contracts/factory/src/testing.rs b/contracts/factory/src/testing.rs index f175a1ca..8d31f677 100644 --- a/contracts/factory/src/testing.rs +++ b/contracts/factory/src/testing.rs @@ -498,6 +498,7 @@ fn create_pair() { vec![SubMsg { msg: WasmMsg::Instantiate { msg: to_json_binary(&PairInstantiateMsg { + pair_type: PairType::Xyk {}, factory_addr: String::from(MOCK_CONTRACT_ADDR), asset_infos: asset_infos.clone(), token_code_id: msg.token_code_id, diff --git a/contracts/pair/Cargo.toml b/contracts/pair/Cargo.toml index a4f4ab21..7e4b2ebf 100644 --- a/contracts/pair/Cargo.toml +++ b/contracts/pair/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "astroport-pair" -version = "2.0.2" +version = "2.1.0" authors = ["Astroport"] edition = "2021" description = "The Astroport constant product pool contract implementation" license = "GPL-3.0-only" repository = "https://github.com/astroport-fi/astroport" homepage = "https://astroport.fi" +metadata = { build_variants = ["injective", "sei"] } exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/contracts/pair/src/contract.rs b/contracts/pair/src/contract.rs index 39501988..6c07b575 100644 --- a/contracts/pair/src/contract.rs +++ b/contracts/pair/src/contract.rs @@ -21,7 +21,6 @@ use astroport::asset::{ MINIMUM_LIQUIDITY_AMOUNT, }; use astroport::common::LP_SUBDENOM; -use astroport::factory::PairType; use astroport::incentives::ExecuteMsg as IncentiveExecuteMsg; use astroport::pair::{ ConfigResponse, FeeShareConfig, ReplyIds, XYKPoolConfig, XYKPoolParams, XYKPoolUpdateParams, @@ -80,7 +79,7 @@ pub fn instantiate( contract_addr: env.contract.address.clone(), liquidity_token: "".to_owned(), asset_infos: msg.asset_infos.clone(), - pair_type: PairType::Xyk {}, + pair_type: msg.pair_type, }, factory_addr: deps.api.addr_validate(msg.factory_addr.as_str())?, block_time_last: 0, diff --git a/contracts/pair/src/testing.rs b/contracts/pair/src/testing.rs index a6527d2a..d7a862d9 100644 --- a/contracts/pair/src/testing.rs +++ b/contracts/pair/src/testing.rs @@ -62,6 +62,7 @@ fn proper_initialization() { )]); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, factory_addr: String::from("factory"), asset_infos: vec![ AssetInfo::NativeToken { @@ -140,6 +141,7 @@ fn provide_liquidity() { ]); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -671,6 +673,7 @@ fn withdraw_liquidity() { ]); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -812,6 +815,7 @@ fn try_native_to_token() { ]); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1019,6 +1023,7 @@ fn try_token_to_native() { ]); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1274,6 +1279,7 @@ fn test_query_pool() { )]); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1342,6 +1348,7 @@ fn test_query_share() { )]); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), diff --git a/contracts/pair/tests/integration.rs b/contracts/pair/tests/integration.rs index db600150..6e2c2703 100644 --- a/contracts/pair/tests/integration.rs +++ b/contracts/pair/tests/integration.rs @@ -1,6 +1,13 @@ #![cfg(not(tarpaulin_include))] +use cosmwasm_std::{ + attr, coin, to_json_binary, Addr, Coin, Decimal, DepsMut, Empty, Env, MessageInfo, Response, + StdResult, Uint128, Uint64, +}; +use cw20::{BalanceResponse, Cw20Coin, Cw20ExecuteMsg, Cw20QueryMsg, MinterResponse}; + use astroport::asset::{native_asset_info, Asset, AssetInfo, PairInfo, MINIMUM_LIQUIDITY_AMOUNT}; +use astroport::common::LP_SUBDENOM; use astroport::factory::{ ExecuteMsg as FactoryExecuteMsg, InstantiateMsg as FactoryInstantiateMsg, PairConfig, PairType, QueryMsg as FactoryQueryMsg, TrackerConfig, @@ -14,19 +21,10 @@ use astroport::token::InstantiateMsg as TokenInstantiateMsg; use astroport::tokenfactory_tracker::{ ConfigResponse as TrackerConfigResponse, QueryMsg as TrackerQueryMsg, }; - +use astroport_pair::error::ContractError; use astroport_test::cw_multi_test::{AppBuilder, ContractWrapper, Executor, TOKEN_FACTORY_MODULE}; use astroport_test::modules::stargate::{MockStargate, StargateApp as TestApp}; -use astroport_pair::error::ContractError; - -use astroport::common::LP_SUBDENOM; -use cosmwasm_std::{ - attr, coin, to_json_binary, Addr, Coin, Decimal, DepsMut, Empty, Env, MessageInfo, Response, - StdResult, Uint128, Uint64, -}; -use cw20::{BalanceResponse, Cw20Coin, Cw20ExecuteMsg, Cw20QueryMsg, MinterResponse}; - const OWNER: &str = "owner"; fn mock_app(owner: Addr, coins: Vec) -> TestApp { @@ -132,6 +130,7 @@ fn instantiate_pair(mut router: &mut TestApp, owner: &Addr) -> Addr { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -162,7 +161,7 @@ fn instantiate_pair(mut router: &mut TestApp, owner: &Addr) -> Addr { .unwrap(); assert_eq!("contract1", res.contract_addr); assert_eq!( - format!("factory/contract1/{LP_SUBDENOM}"), + format!("factory/contract1/{}", LP_SUBDENOM), res.liquidity_token ); @@ -892,6 +891,7 @@ fn create_pair_with_same_assets() { let pair_contract_code_id = store_pair_code(&mut router); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -930,6 +930,7 @@ fn wrong_number_of_assets() { let pair_contract_code_id = store_pair_code(&mut router); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![AssetInfo::NativeToken { denom: "uusd".to_string(), }], @@ -955,6 +956,7 @@ fn wrong_number_of_assets() { ); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ native_asset_info("uusd".to_string()), native_asset_info("dust".to_string()), @@ -1264,6 +1266,7 @@ fn update_pair_config() { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1356,6 +1359,7 @@ fn enable_disable_fee_sharing() { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Xyk {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -2427,3 +2431,123 @@ fn test_tracker_contract() { assert_eq!(alice_balance, Uint128::new(100)); } + +#[test] +fn test_create_xyk_custom_type() { + let owner = Addr::unchecked("owner"); + let mut app = mock_app(owner.clone(), vec![]); + let token_code_id = store_token_code(&mut app); + let pair_code_id = store_pair_code(&mut app); + let factory_code_id = store_factory_code(&mut app); + + let init_msg = FactoryInstantiateMsg { + fee_address: None, + pair_configs: vec![ + PairConfig { + code_id: pair_code_id, + maker_fee_bps: 0, + pair_type: PairType::Custom("custom_xyk".to_string()), + total_fee_bps: 0, + is_disabled: false, + is_generator_disabled: false, + permissioned: false, + }, + PairConfig { + code_id: pair_code_id, + maker_fee_bps: 3333, + pair_type: PairType::Xyk {}, + total_fee_bps: 5000, + is_disabled: false, + is_generator_disabled: false, + permissioned: false, + }, + ], + token_code_id, + generator_address: None, + owner: owner.to_string(), + whitelist_code_id: 0, + coin_registry_address: "coin_registry".to_string(), + tracker_config: None, + }; + + let factory_instance = app + .instantiate_contract( + factory_code_id, + owner.clone(), + &init_msg, + &[], + "FACTORY", + None, + ) + .unwrap(); + + // Instantiate pair without asset balances tracking + let msg = FactoryExecuteMsg::CreatePair { + asset_infos: vec![ + AssetInfo::NativeToken { + denom: "uusd".to_string(), + }, + AssetInfo::NativeToken { + denom: "uluna".to_string(), + }, + ], + pair_type: PairType::Custom("custom_xyk".to_string()), + init_params: None, + }; + + app.execute_contract(owner.clone(), factory_instance.clone(), &msg, &[]) + .unwrap(); + + let msg = FactoryQueryMsg::Pair { + asset_infos: vec![ + AssetInfo::NativeToken { + denom: "uusd".to_string(), + }, + AssetInfo::NativeToken { + denom: "uluna".to_string(), + }, + ], + }; + + let res: PairInfo = app + .wrap() + .query_wasm_smart(&factory_instance, &msg) + .unwrap(); + + assert_eq!(res.pair_type, PairType::Custom("custom_xyk".to_string())); + + // Instantiate usual xyk from the same code id but different pair type + let msg = FactoryExecuteMsg::CreatePair { + asset_infos: vec![ + AssetInfo::NativeToken { + denom: "uusd".to_string(), + }, + AssetInfo::NativeToken { + denom: "uatom".to_string(), + }, + ], + pair_type: PairType::Xyk {}, + init_params: None, + }; + + app.execute_contract(owner.clone(), factory_instance.clone(), &msg, &[]) + .unwrap(); + + let msg = FactoryQueryMsg::Pair { + asset_infos: vec![ + AssetInfo::NativeToken { + denom: "uusd".to_string(), + }, + AssetInfo::NativeToken { + denom: "uatom".to_string(), + }, + ], + }; + + let res: PairInfo = app + .wrap() + .query_wasm_smart(&factory_instance, &msg) + .unwrap(); + + assert_eq!(res.pair_type, PairType::Xyk {}); +} diff --git a/contracts/pair_astro_converter/Cargo.toml b/contracts/pair_astro_converter/Cargo.toml index 8071d37a..f67eac47 100644 --- a/contracts/pair_astro_converter/Cargo.toml +++ b/contracts/pair_astro_converter/Cargo.toml @@ -42,6 +42,6 @@ derivative = "2.2" itertools.workspace = true cw-multi-test = "0.20.0" cw20-base = "1.1" -astroport-factory = { path = "../factory" } +astroport-factory = "1.8" astroport-pair = "~1.3.3" astro-token-converter = { path = "../periphery/astro_converter", version = "1.0" } diff --git a/contracts/pair_concentrated/Cargo.toml b/contracts/pair_concentrated/Cargo.toml index 3ab1b0a7..90e9c398 100644 --- a/contracts/pair_concentrated/Cargo.toml +++ b/contracts/pair_concentrated/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astroport-pair-concentrated" -version = "4.0.2" +version = "4.1.0" authors = ["Astroport"] edition = "2021" description = "The Astroport concentrated liquidity pair" diff --git a/contracts/pair_concentrated/src/contract.rs b/contracts/pair_concentrated/src/contract.rs index 24ad56ad..477e6311 100644 --- a/contracts/pair_concentrated/src/contract.rs +++ b/contracts/pair_concentrated/src/contract.rs @@ -20,7 +20,6 @@ use astroport::asset::{ }; use astroport::common::{claim_ownership, drop_ownership_proposal, propose_new_owner, LP_SUBDENOM}; use astroport::cosmwasm_ext::{DecimalToInteger, IntegerToDecimal}; -use astroport::factory::PairType; use astroport::observation::{PrecommitObservation, OBSERVATIONS_SIZE}; use astroport::pair::{ Cw20HookMsg, ExecuteMsg, FeeShareConfig, InstantiateMsg, ReplyIds, MAX_FEE_SHARE_BPS, @@ -132,7 +131,7 @@ pub fn instantiate( contract_addr: env.contract.address.clone(), liquidity_token: "".to_owned(), asset_infos: msg.asset_infos.clone(), - pair_type: PairType::Custom("concentrated".to_string()), + pair_type: msg.pair_type, }, factory_addr, block_time_last: env.block.time.seconds(), diff --git a/contracts/pair_stable/Cargo.toml b/contracts/pair_stable/Cargo.toml index ccfa3deb..8ea73c89 100644 --- a/contracts/pair_stable/Cargo.toml +++ b/contracts/pair_stable/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "astroport-pair-stable" -version = "4.0.1" +version = "4.1.0" authors = ["Astroport"] edition = "2021" description = "The Astroport stableswap pair contract implementation" license = "GPL-3.0-only" repository = "https://github.com/astroport-fi/astroport" homepage = "https://astroport.fi" +metadata = { build_variants = ["injective", "sei"] } exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/contracts/pair_stable/src/contract.rs b/contracts/pair_stable/src/contract.rs index 7a3fc0b9..2ff1c84e 100644 --- a/contracts/pair_stable/src/contract.rs +++ b/contracts/pair_stable/src/contract.rs @@ -20,7 +20,6 @@ use astroport::asset::{ }; use astroport::common::{claim_ownership, drop_ownership_proposal, propose_new_owner, LP_SUBDENOM}; use astroport::cosmwasm_ext::IntegerToDecimal; -use astroport::factory::PairType; use astroport::observation::{query_observation, PrecommitObservation, OBSERVATIONS_SIZE}; use astroport::pair::{ ConfigResponse, CumulativePricesResponse, FeeShareConfig, InstantiateMsg, StablePoolParams, @@ -104,7 +103,7 @@ pub fn instantiate( contract_addr: env.contract.address.clone(), liquidity_token: "".to_owned(), asset_infos: msg.asset_infos.clone(), - pair_type: PairType::Stable {}, + pair_type: msg.pair_type, }, factory_addr, block_time_last: 0, diff --git a/contracts/pair_stable/src/testing.rs b/contracts/pair_stable/src/testing.rs index f37f0074..e002bdf0 100644 --- a/contracts/pair_stable/src/testing.rs +++ b/contracts/pair_stable/src/testing.rs @@ -12,6 +12,7 @@ use sim::StableSwapModel; use astroport::asset::{native_asset, native_asset_info, Asset, AssetInfo}; use astroport::common::LP_SUBDENOM; +use astroport::factory::PairType; use astroport::observation::query_observation; use astroport::observation::Observation; use astroport::observation::OracleObservation; @@ -67,6 +68,7 @@ fn proper_initialization() { )]); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, factory_addr: String::from("factory"), asset_infos: vec![ AssetInfo::NativeToken { @@ -152,6 +154,7 @@ fn provide_liquidity() { ]); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -547,6 +550,7 @@ fn withdraw_liquidity() { let info = mock_info("addr0000", &[]); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -693,6 +697,7 @@ fn try_native_to_token() { ]); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -850,6 +855,7 @@ fn try_token_to_native() { ]); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1077,6 +1083,7 @@ fn test_query_pool() { )]); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1151,6 +1158,7 @@ fn test_query_share() { )]); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1350,6 +1358,7 @@ proptest! { let ask_asset = native_asset_info("uluna".to_string()); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, factory_addr: String::from("factory"), asset_infos: vec![offer_asset.info.clone(), ask_asset.clone()], token_code_id: 10u64, @@ -1429,6 +1438,7 @@ fn update_owner() { let owner = "owner0000"; let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "ucosmos".to_string(), diff --git a/contracts/pair_stable/tests/integration.rs b/contracts/pair_stable/tests/integration.rs index 78f5113f..6c140eaa 100644 --- a/contracts/pair_stable/tests/integration.rs +++ b/contracts/pair_stable/tests/integration.rs @@ -166,6 +166,7 @@ fn instantiate_pair(mut router: &mut TestApp, owner: &Addr) -> Addr { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -195,6 +196,7 @@ fn instantiate_pair(mut router: &mut TestApp, owner: &Addr) -> Addr { ); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1254,6 +1256,7 @@ fn create_pair_with_same_assets() { let pair_contract_code_id = store_pair_code(&mut router); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1334,6 +1337,7 @@ fn update_pair_config() { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1582,6 +1586,7 @@ fn enable_disable_fee_sharing() { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Stable {}, asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), diff --git a/contracts/pair_transmuter/Cargo.toml b/contracts/pair_transmuter/Cargo.toml index c13b0c5e..1cce4435 100644 --- a/contracts/pair_transmuter/Cargo.toml +++ b/contracts/pair_transmuter/Cargo.toml @@ -7,6 +7,7 @@ description = "The Astroport constant sum pair contract implementation. Handles license = "GPL-3.0-only" repository = "https://github.com/astroport-fi/astroport" homepage = "https://astroport.fi" +metadata = { build_variants = ["injective", "sei"] } [lib] crate-type = ["cdylib", "rlib"] diff --git a/contracts/pair_xyk_sale_tax/Cargo.toml b/contracts/pair_xyk_sale_tax/Cargo.toml index 0e7d0cac..d076de71 100644 --- a/contracts/pair_xyk_sale_tax/Cargo.toml +++ b/contracts/pair_xyk_sale_tax/Cargo.toml @@ -1,12 +1,13 @@ [package] name = "astroport-pair-xyk-sale-tax" -version = "2.0.2" +version = "2.1.0" authors = ["Astroport", "Sturdy"] edition = "2021" description = "The Astroport constant product pool contract implementation" license = "Apache-2.0" repository = "https://github.com/astroport-fi/astroport" homepage = "https://astroport.fi" +metadata = { build_variants = ["injective", "sei"] } exclude = [ # Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication. diff --git a/contracts/pair_xyk_sale_tax/src/contract.rs b/contracts/pair_xyk_sale_tax/src/contract.rs index 9df48f64..2e889d8d 100644 --- a/contracts/pair_xyk_sale_tax/src/contract.rs +++ b/contracts/pair_xyk_sale_tax/src/contract.rs @@ -45,7 +45,7 @@ use crate::error::ContractError; use crate::state::{Config, BALANCES, CONFIG}; /// Contract name that is used for migration. -const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); +pub const CONTRACT_NAME: &str = env!("CARGO_PKG_NAME"); /// Contract version that is used for migration. const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION"); /// Reply ID for create denom reply diff --git a/contracts/pair_xyk_sale_tax/src/testing.rs b/contracts/pair_xyk_sale_tax/src/testing.rs index b5b0ac1c..a6bf7451 100644 --- a/contracts/pair_xyk_sale_tax/src/testing.rs +++ b/contracts/pair_xyk_sale_tax/src/testing.rs @@ -20,7 +20,7 @@ use astroport::token_factory::{MsgBurn, MsgCreateDenom, MsgCreateDenomResponse, use crate::contract::{ accumulate_prices, assert_max_spread, compute_swap, execute, instantiate, query_pool, - query_reverse_simulation, query_share, query_simulation, reply, + query_reverse_simulation, query_share, query_simulation, reply, CONTRACT_NAME, }; use crate::contract::{compute_offer_amount, SwapResult}; use crate::error::ContractError; @@ -62,6 +62,7 @@ fn proper_initialization() { )]); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), factory_addr: String::from("factory"), asset_infos: vec![ AssetInfo::NativeToken { @@ -138,6 +139,7 @@ fn provide_liquidity() { ]); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -655,6 +657,7 @@ fn withdraw_liquidity() { let info = mock_info("addr0000", &[]); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -796,6 +799,7 @@ fn try_native_to_token() { ]); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1025,6 +1029,7 @@ fn try_token_to_native() { ]); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1280,6 +1285,7 @@ fn test_query_pool() { )]); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1348,6 +1354,7 @@ fn test_query_share() { )]); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), diff --git a/contracts/pair_xyk_sale_tax/tests/integration.rs b/contracts/pair_xyk_sale_tax/tests/integration.rs index cc33ae03..cd1cce39 100644 --- a/contracts/pair_xyk_sale_tax/tests/integration.rs +++ b/contracts/pair_xyk_sale_tax/tests/integration.rs @@ -18,6 +18,7 @@ use astroport::tokenfactory_tracker::{ }; use astroport::common::LP_SUBDENOM; +use astroport_pair_xyk_sale_tax::contract::CONTRACT_NAME; use astroport_pair_xyk_sale_tax::error::ContractError; use astroport_test::cw_multi_test::{AppBuilder, ContractWrapper, Executor, TOKEN_FACTORY_MODULE}; use astroport_test::modules::stargate::{MockStargate, StargateApp as TestApp}; @@ -165,6 +166,7 @@ fn instantiate_pair(mut router: &mut TestApp, owner: &Addr) -> Addr { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -239,6 +241,7 @@ fn instantiate_standard_xyk_pair(mut router: &mut TestApp, owner: &Addr, version .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -938,6 +941,7 @@ fn create_pair_with_same_assets() { let pair_contract_code_id = store_pair_code(&mut router); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -976,6 +980,7 @@ fn wrong_number_of_assets() { let pair_contract_code_id = store_pair_code(&mut router); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![AssetInfo::NativeToken { denom: "uusd".to_string(), }], @@ -1001,6 +1006,7 @@ fn wrong_number_of_assets() { ); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ native_asset_info("uusd".to_string()), native_asset_info("dust".to_string()), @@ -1411,6 +1417,7 @@ fn update_pair_config() { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), @@ -1499,6 +1506,7 @@ fn update_tax_configs() { .unwrap(); let msg = InstantiateMsg { + pair_type: PairType::Custom(CONTRACT_NAME.to_string()), asset_infos: vec![ AssetInfo::NativeToken { denom: "uusd".to_string(), diff --git a/packages/astroport/Cargo.toml b/packages/astroport/Cargo.toml index 5563accd..216332ae 100644 --- a/packages/astroport/Cargo.toml +++ b/packages/astroport/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "astroport" -version = "5.4.0" +version = "5.5.0" authors = ["Astroport"] edition = "2021" description = "Common Astroport types, queriers and other utils" diff --git a/packages/astroport/src/pair.rs b/packages/astroport/src/pair.rs index 0369e16e..6ebbfcc9 100644 --- a/packages/astroport/src/pair.rs +++ b/packages/astroport/src/pair.rs @@ -3,6 +3,7 @@ use cosmwasm_schema::{cw_serde, QueryResponses}; use crate::asset::{Asset, AssetInfo, PairInfo}; +use crate::factory::PairType; use cosmwasm_std::{Addr, Binary, Decimal, Decimal256, StdError, Uint128, Uint64}; use cw20::Cw20ReceiveMsg; @@ -23,6 +24,8 @@ pub const MIN_TRADE_SIZE: Decimal256 = Decimal256::raw(10000000000000); /// This structure describes the parameters used for creating a contract. #[cw_serde] pub struct InstantiateMsg { + /// The pair type + pub pair_type: PairType, /// Information about assets in the pool pub asset_infos: Vec, /// The token contract code ID used for the tokens in the pool @@ -309,17 +312,8 @@ impl TryFrom for ReplyIds { #[cfg(test)] mod tests { use super::*; - use crate::asset::native_asset_info; use cosmwasm_std::{from_json, to_json_binary}; - #[cw_serde] - pub struct LegacyInstantiateMsg { - pub asset_infos: [AssetInfo; 2], - pub token_code_id: u64, - pub factory_addr: String, - pub init_params: Option, - } - #[cw_serde] pub struct LegacyConfigResponse { pub block_time_last: u64, @@ -328,23 +322,6 @@ mod tests { pub owner: Addr, } - #[test] - fn test_init_msg_compatability() { - let inst_msg = LegacyInstantiateMsg { - asset_infos: [ - native_asset_info("uusd".to_string()), - native_asset_info("uluna".to_string()), - ], - token_code_id: 0, - factory_addr: "factory".to_string(), - init_params: None, - }; - - let ser_msg = to_json_binary(&inst_msg).unwrap(); - // This .unwrap() is enough to make sure that [AssetInfo; 2] and Vec are compatible. - let _: InstantiateMsg = from_json(&ser_msg).unwrap(); - } - #[test] fn test_config_response_compatability() { let ser_msg = to_json_binary(&LegacyConfigResponse { diff --git a/schemas/astroport-factory/astroport-factory.json b/schemas/astroport-factory/astroport-factory.json index 36601be9..1f318e4b 100644 --- a/schemas/astroport-factory/astroport-factory.json +++ b/schemas/astroport-factory/astroport-factory.json @@ -1,6 +1,6 @@ { "contract_name": "astroport-factory", - "contract_version": "1.8.1", + "contract_version": "1.9.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", diff --git a/schemas/astroport-pair-concentrated/astroport-pair-concentrated.json b/schemas/astroport-pair-concentrated/astroport-pair-concentrated.json index e0ba342d..e1597e48 100644 --- a/schemas/astroport-pair-concentrated/astroport-pair-concentrated.json +++ b/schemas/astroport-pair-concentrated/astroport-pair-concentrated.json @@ -1,6 +1,6 @@ { "contract_name": "astroport-pair-concentrated", - "contract_version": "4.0.2", + "contract_version": "4.1.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -10,6 +10,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -35,6 +36,14 @@ } ] }, + "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", @@ -100,6 +109,52 @@ "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-concentrated/raw/instantiate.json b/schemas/astroport-pair-concentrated/raw/instantiate.json index 9d812253..00ccada9 100644 --- a/schemas/astroport-pair-concentrated/raw/instantiate.json +++ b/schemas/astroport-pair-concentrated/raw/instantiate.json @@ -6,6 +6,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -31,6 +32,14 @@ } ] }, + "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", @@ -96,6 +105,52 @@ "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-stable/astroport-pair-stable.json b/schemas/astroport-pair-stable/astroport-pair-stable.json index 2f8acd66..dafacb44 100644 --- a/schemas/astroport-pair-stable/astroport-pair-stable.json +++ b/schemas/astroport-pair-stable/astroport-pair-stable.json @@ -1,6 +1,6 @@ { "contract_name": "astroport-pair-stable", - "contract_version": "4.0.1", + "contract_version": "4.1.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -10,6 +10,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -35,6 +36,14 @@ } ] }, + "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", @@ -100,6 +109,52 @@ "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-stable/raw/instantiate.json b/schemas/astroport-pair-stable/raw/instantiate.json index 9d812253..00ccada9 100644 --- a/schemas/astroport-pair-stable/raw/instantiate.json +++ b/schemas/astroport-pair-stable/raw/instantiate.json @@ -6,6 +6,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -31,6 +32,14 @@ } ] }, + "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", @@ -96,6 +105,52 @@ "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-xyk-sale-tax/astroport-pair-xyk-sale-tax.json b/schemas/astroport-pair-xyk-sale-tax/astroport-pair-xyk-sale-tax.json index 6f86762e..4f893967 100644 --- a/schemas/astroport-pair-xyk-sale-tax/astroport-pair-xyk-sale-tax.json +++ b/schemas/astroport-pair-xyk-sale-tax/astroport-pair-xyk-sale-tax.json @@ -1,6 +1,6 @@ { "contract_name": "astroport-pair-xyk-sale-tax", - "contract_version": "2.0.2", + "contract_version": "2.1.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -10,6 +10,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -35,6 +36,14 @@ } ] }, + "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", @@ -100,6 +109,52 @@ "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-xyk-sale-tax/raw/instantiate.json b/schemas/astroport-pair-xyk-sale-tax/raw/instantiate.json index 9d812253..00ccada9 100644 --- a/schemas/astroport-pair-xyk-sale-tax/raw/instantiate.json +++ b/schemas/astroport-pair-xyk-sale-tax/raw/instantiate.json @@ -6,6 +6,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -31,6 +32,14 @@ } ] }, + "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", @@ -96,6 +105,52 @@ "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/astroport-pair.json b/schemas/astroport-pair/astroport-pair.json index 0d034e5d..9fd41a39 100644 --- a/schemas/astroport-pair/astroport-pair.json +++ b/schemas/astroport-pair/astroport-pair.json @@ -1,6 +1,6 @@ { "contract_name": "astroport-pair", - "contract_version": "2.0.2", + "contract_version": "2.1.0", "idl_version": "1.0.0", "instantiate": { "$schema": "http://json-schema.org/draft-07/schema#", @@ -10,6 +10,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -35,6 +36,14 @@ } ] }, + "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", @@ -100,6 +109,52 @@ "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/raw/instantiate.json b/schemas/astroport-pair/raw/instantiate.json index 9d812253..00ccada9 100644 --- a/schemas/astroport-pair/raw/instantiate.json +++ b/schemas/astroport-pair/raw/instantiate.json @@ -6,6 +6,7 @@ "required": [ "asset_infos", "factory_addr", + "pair_type", "token_code_id" ], "properties": { @@ -31,6 +32,14 @@ } ] }, + "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", @@ -96,6 +105,52 @@ "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/scripts/build_release.sh b/scripts/build_release.sh index 37be6eda..74cb3be2 100755 --- a/scripts/build_release.sh +++ b/scripts/build_release.sh @@ -8,4 +8,4 @@ projectPath=$(cd "$(dirname "${0}")" && cd ../ && pwd) docker run --rm -v "$projectPath":/code \ --mount type=volume,source="$(basename "$projectPath")_cache",target=/target \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/optimizer:0.15.1 + ghcr.io/astroport-fi/rust-optimizer:v0.15.1-astroport