pub enum OsmosisQuery {
FullDenom {
contract: String,
sub_denom: String,
},
PoolState {
id: u64,
},
SpotPrice {
swap: Swap,
with_swap_fee: bool,
},
EstimateSwap {
sender: String,
first: Swap,
route: Vec<Step>,
amount: SwapAmount,
},
}Variants§
FullDenom
Given a sub-denom minted by a contract via OsmosisMsg::MintTokens,
returns the full denom as used by BankMsg::Send.
You may call FullDenom { contract: env.contract.address, sub_denom } to find the denom issued
by the current contract.
PoolState
For a given pool ID, list all tokens traded on it with current liquidity (spot). As well as the total number of LP shares and their denom
SpotPrice
Return current spot price swapping In for Out on given pool ID. Warning: this can easily be manipulated via sandwich attacks, do not use as price oracle. We will add TWAP for more robust price feed.
EstimateSwap
Return current spot price swapping In for Out on given pool ID.
You can call EstimateSwap { contract: env.contract.address, ... } to set sender to the
current contract.
Warning: this can easily be manipulated via sandwich attacks, do not use as price oracle.
We will add TWAP for more robust price feed.
Implementations§
Source§impl OsmosisQuery
impl OsmosisQuery
Sourcepub fn spot_price(pool_id: u64, denom_in: &str, denom_out: &str) -> Self
pub fn spot_price(pool_id: u64, denom_in: &str, denom_out: &str) -> Self
Calculate spot price without swap fee
Sourcepub fn estimate_swap(
contract: impl Into<String>,
pool_id: u64,
denom_in: impl Into<String>,
denom_out: impl Into<String>,
amount: SwapAmount,
) -> Self
pub fn estimate_swap( contract: impl Into<String>, pool_id: u64, denom_in: impl Into<String>, denom_out: impl Into<String>, amount: SwapAmount, ) -> Self
Basic helper to estimate price of a swap on one pool
Trait Implementations§
Source§impl Clone for OsmosisQuery
impl Clone for OsmosisQuery
Source§fn clone(&self) -> OsmosisQuery
fn clone(&self) -> OsmosisQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OsmosisQuery
impl Debug for OsmosisQuery
Source§impl<'de> Deserialize<'de> for OsmosisQuery
impl<'de> Deserialize<'de> for OsmosisQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for OsmosisQuery
impl JsonSchema for OsmosisQuery
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more