pub struct Pool {
pub assets: Vec<Coin>,
pub shares: Uint128,
pub fee: Decimal,
}Fields§
§assets: Vec<Coin>§fee: DecimalImplementations§
Source§impl Pool
impl Pool
pub fn new(a: Coin, b: Coin) -> Self
pub fn has_denom(&self, denom: &str) -> bool
pub fn get_amount(&self, denom: &str) -> Option<Uint128>
pub fn set_amount( &mut self, denom: &str, amount: Uint128, ) -> Result<(), OsmosisError>
pub fn spot_price( &self, denom_in: &str, denom_out: &str, with_swap_fee: bool, ) -> Result<Decimal, OsmosisError>
pub fn swap( &mut self, denom_in: &str, denom_out: &str, amount: SwapAmount, ) -> Result<SwapAmount, OsmosisError>
pub fn swap_with_limit( &mut self, denom_in: &str, denom_out: &str, amount: SwapAmountWithLimit, ) -> Result<SwapAmount, OsmosisError>
pub fn gamm_denom(&self, pool_id: u64) -> String
pub fn into_response(self, pool_id: u64) -> PoolStateResponse
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pool
impl<'de> Deserialize<'de> for Pool
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl JsonSchema for Pool
impl JsonSchema for Pool
Source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn 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 moreimpl StructuralPartialEq for Pool
Auto Trait Implementations§
impl Freeze for Pool
impl RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl UnwindSafe for Pool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more