pub enum Asset {
Show 17 variants
ETH,
BAT,
OMG,
USDC,
USDT,
ZRX,
LINK,
QNT,
RLC,
ANT,
BTC,
NEO,
GAS,
TRAC,
GUNTHY,
NNN,
NOIA,
}Expand description
Assets are the units of value that can be traded in a market We also use this type as a root for encodings for smart contract operations defined in super::sc_payloads
Variants§
Implementations§
Source§impl Asset
impl Asset
Sourcepub fn to_eth_bytes(&self) -> [u8; 2]
pub fn to_eth_bytes(&self) -> [u8; 2]
This maps assets onto their representation in the ETH SC protocol. Each asset is represented by two bytes which serve as an identifier
Sourcepub fn from_eth_bytes(bytes: [u8; 2]) -> Result<Self>
pub fn from_eth_bytes(bytes: [u8; 2]) -> Result<Self>
Given two bytes asset id in ETH payload, return asset
Source§impl Asset
impl Asset
Sourcepub fn to_neo_bytes(&self) -> Vec<u8> ⓘ
pub fn to_neo_bytes(&self) -> Vec<u8> ⓘ
This maps assets onto their representation in the NEO SC protocol. Each asset is represented by two bytes which serve as an identifier
Sourcepub fn from_neo_bytes(bytes: &[u8; 32]) -> Result<Self>
pub fn from_neo_bytes(bytes: &[u8; 32]) -> Result<Self>
Given two bytes asset id, return asset
Source§impl Asset
impl Asset
Sourcepub fn blockchain(&self) -> Blockchain
pub fn blockchain(&self) -> Blockchain
Get blockchain associated with a specific asset
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
Get asset name as an &str. This name will be compatible with the
what Nash’s GraphQL protocol wants
pub fn from_str(asset_str: &str) -> Result<Self>
Source§impl Asset
impl Asset
Sourcepub fn with_precision(&self, precision: u32) -> AssetofPrecision
pub fn with_precision(&self, precision: u32) -> AssetofPrecision
Starting with an asset, create a new asset of desired precision.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Asset
impl<'de> Deserialize<'de> for Asset
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 From<Asset> for AssetOrCrosschain
impl From<Asset> for AssetOrCrosschain
Source§impl Into<Asset> for AssetofPrecision
Convert AssetOfPrecision back into asset, e.g., for encoding
impl Into<Asset> for AssetofPrecision
Convert AssetOfPrecision back into asset, e.g., for encoding
impl Copy for Asset
impl Eq for Asset
impl StructuralPartialEq for Asset
Auto Trait Implementations§
impl Freeze for Asset
impl RefUnwindSafe for Asset
impl Send for Asset
impl Sync for Asset
impl Unpin for Asset
impl UnwindSafe for Asset
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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