Struct abstract_os::objects::proxy_asset::ProxyAsset
source · pub struct ProxyAsset {
pub asset: AssetEntry,
pub value_reference: Option<ValueRef>,
}
Expand description
Every ProxyAsset provides a way to determine its value recursively relative to a base asset.
Fields§
§asset: AssetEntry
Asset entry that maps to an AssetInfo using raw-queries on ans_host
value_reference: Option<ValueRef>
The value reference provides the tooling to get the value of the asset relative to the base asset.
Implementations§
source§impl ProxyAsset
impl ProxyAsset
sourcepub fn value(
&mut self,
deps: Deps<'_>,
env: &Env,
ans_host: &AnsHost,
set_holding: Option<Uint128>
) -> AbstractResult<Uint128>
pub fn value( &mut self, deps: Deps<'_>, env: &Env, ans_host: &AnsHost, set_holding: Option<Uint128> ) -> AbstractResult<Uint128>
Calculates the value of the asset through the optionally provided ValueReference
sourcepub fn trade_pair_value(
&self,
deps: Deps<'_>,
env: &Env,
ans_host: &AnsHost,
valued_asset: Asset,
pair: ContractEntry
) -> AbstractResult<Uint128>
pub fn trade_pair_value( &self, deps: Deps<'_>, env: &Env, ans_host: &AnsHost, valued_asset: Asset, pair: ContractEntry ) -> AbstractResult<Uint128>
Calculates the value of an asset compared to some base asset through the provided trading pair.
sourcepub fn lp_value(
&self,
deps: Deps<'_>,
env: &Env,
ans_host: &AnsHost,
lp_asset: Asset,
pair: ContractEntry
) -> AbstractResult<Uint128>
pub fn lp_value( &self, deps: Deps<'_>, env: &Env, ans_host: &AnsHost, lp_asset: Asset, pair: ContractEntry ) -> AbstractResult<Uint128>
Calculate the value of an LP token Uses the lp token name to query pair pool for both assets
Trait Implementations§
source§impl Clone for ProxyAsset
impl Clone for ProxyAsset
source§fn clone(&self) -> ProxyAsset
fn clone(&self) -> ProxyAsset
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ProxyAsset
impl Debug for ProxyAsset
source§impl<'de> Deserialize<'de> for ProxyAsset
impl<'de> Deserialize<'de> for ProxyAsset
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 ProxyAsset
impl JsonSchema for ProxyAsset
source§fn schema_name() -> String
fn schema_name() -> String
The name of the generated JSON Schema. Read more
source§fn json_schema(gen: &mut SchemaGenerator) -> Schema
fn json_schema(gen: &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 moresource§impl PartialEq<ProxyAsset> for ProxyAsset
impl PartialEq<ProxyAsset> for ProxyAsset
source§fn eq(&self, other: &ProxyAsset) -> bool
fn eq(&self, other: &ProxyAsset) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.