use cosmwasm_schema::QueryResponses;
use cosmwasm_std::{Decimal, Uint128};
use crate::objects::{AnsAsset, AssetEntry, ContractEntry};
pub type DexName = String;
pub type OfferAsset = AnsAsset;
pub type AskAsset = AnsAsset;
pub const IBC_DEX_ID: u32 = 11335;
#[cosmwasm_schema::cw_serde]
pub enum DexAction {
ProvideLiquidity {
assets: Vec<OfferAsset>,
max_spread: Option<Decimal>,
},
ProvideLiquiditySymmetric {
offer_asset: OfferAsset,
paired_assets: Vec<AssetEntry>,
},
WithdrawLiquidity {
lp_token: AssetEntry,
amount: Uint128,
},
Swap {
offer_asset: OfferAsset,
ask_asset: AssetEntry,
max_spread: Option<Decimal>,
belief_price: Option<Decimal>,
},
CustomSwap {
offer_assets: Vec<OfferAsset>,
ask_assets: Vec<AskAsset>,
max_spread: Option<Decimal>,
router: Option<SwapRouter>,
},
}
#[cosmwasm_schema::cw_serde]
pub enum SwapRouter {
Matrix,
Custom(String),
}
#[cosmwasm_schema::cw_serde]
pub struct DexRequestMsg {
pub dex: DexName,
pub action: DexAction,
}
#[cosmwasm_schema::cw_serde]
#[derive(QueryResponses)]
pub enum DexQueryMsg {
#[returns(SimulateSwapResponse)]
SimulateSwap {
offer_asset: OfferAsset,
ask_asset: AssetEntry,
dex: Option<DexName>,
},
}
#[cosmwasm_schema::cw_serde]
pub struct SimulateSwapResponse {
pub pool: ContractEntry,
pub return_amount: Uint128,
pub spread_amount: Uint128,
pub commission: (AssetEntry, Uint128),
}