Enum osmo_bindings::OsmosisQuery
source · [−]pub enum OsmosisQuery {
FullDenom {
contract: String,
sub_denom: String,
},
PoolState {
id: u64,
},
SpotPrice {
swap: Swap,
with_swap_fee: bool,
},
EstimatePrice {
contract: 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
Fields
id: u64For 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.
EstimatePrice
Return current spot price swapping In for Out on given pool ID.
You can call EstimatePrice { 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
sourceimpl 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_price(
contract: impl Into<String>,
pool_id: u64,
denom_in: impl Into<String>,
denom_out: impl Into<String>,
amount: SwapAmount
) -> Self
pub fn estimate_price(
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
sourceimpl Clone for OsmosisQuery
impl Clone for OsmosisQuery
sourcefn clone(&self) -> OsmosisQuery
fn clone(&self) -> OsmosisQuery
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Debug for OsmosisQuery
impl Debug for OsmosisQuery
sourceimpl<'de> Deserialize<'de> for OsmosisQuery
impl<'de> Deserialize<'de> for OsmosisQuery
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl JsonSchema for OsmosisQuery
impl JsonSchema for OsmosisQuery
sourcefn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
sourcefn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
sourcefn is_referenceable() -> bool
fn is_referenceable() -> bool
Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more
sourceimpl PartialEq<OsmosisQuery> for OsmosisQuery
impl PartialEq<OsmosisQuery> for OsmosisQuery
sourcefn eq(&self, other: &OsmosisQuery) -> bool
fn eq(&self, other: &OsmosisQuery) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &OsmosisQuery) -> bool
fn ne(&self, other: &OsmosisQuery) -> bool
This method tests for !=.
sourceimpl Serialize for OsmosisQuery
impl Serialize for OsmosisQuery
impl CustomQuery for OsmosisQuery
impl StructuralPartialEq for OsmosisQuery
Auto Trait Implementations
impl RefUnwindSafe for OsmosisQuery
impl Send for OsmosisQuery
impl Sync for OsmosisQuery
impl Unpin for OsmosisQuery
impl UnwindSafe for OsmosisQuery
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more