Struct diem_types::account_config::events::exchange_rate_update::ToXDXExchangeRateUpdateEvent
source · pub struct ToXDXExchangeRateUpdateEvent { /* private fields */ }
Expand description
Struct that represents a ToXDXExchangeRateUpdateEvent
Implementations§
source§impl ToXDXExchangeRateUpdateEvent
impl ToXDXExchangeRateUpdateEvent
sourcepub fn new_to_xdx_exchange_rate(&self) -> f32
pub fn new_to_xdx_exchange_rate(&self) -> f32
Exchange rates are represented as 32|32 fixed-point numbers on-chain. So we divide by the scaling factor (2^32) of the number to arrive at the floating point representation of the number. The exchange rate returned is the on-chain rate to two decimal places rounded up (e.g. 1.3333 would be rounded to 1.34).
sourcepub fn currency_code(&self) -> &IdentStr
pub fn currency_code(&self) -> &IdentStr
Return the code for the currency whose exchange rate was updated
pub fn try_from_bytes(bytes: &[u8]) -> Result<Self>
Trait Implementations§
source§impl Debug for ToXDXExchangeRateUpdateEvent
impl Debug for ToXDXExchangeRateUpdateEvent
source§impl<'de> Deserialize<'de> for ToXDXExchangeRateUpdateEvent
impl<'de> Deserialize<'de> for ToXDXExchangeRateUpdateEvent
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 MoveStructType for ToXDXExchangeRateUpdateEvent
impl MoveStructType for ToXDXExchangeRateUpdateEvent
const MODULE_NAME: &'static IdentStr = DIEM_MODULE_IDENTIFIER
const STRUCT_NAME: &'static IdentStr = _
fn module_identifier() -> Identifier
fn struct_identifier() -> Identifier
fn type_params() -> Vec<TypeTag, Global> ⓘ
fn struct_tag() -> StructTag
Auto Trait Implementations§
impl RefUnwindSafe for ToXDXExchangeRateUpdateEvent
impl Send for ToXDXExchangeRateUpdateEvent
impl Sync for ToXDXExchangeRateUpdateEvent
impl Unpin for ToXDXExchangeRateUpdateEvent
impl UnwindSafe for ToXDXExchangeRateUpdateEvent
Blanket Implementations§
source§impl<T> TestOnlyHash for Twhere
T: Serialize + ?Sized,
impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,
source§fn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.