Struct GasToken

Source
pub struct GasToken<'a, P: JsonRpcProvider> { /* private fields */ }

Implementations§

Source§

impl<'a, P: JsonRpcProvider> GasToken<'a, P>

Source

pub const NAME: &'static str = "GasToken"

Source

pub const DECIMALS: u8 = 8u8

Source

pub const SYMBOL: &'static str = "GAS"

Source

pub fn new(provider: Option<&'a RpcClient<P>>) -> Self

Trait Implementations§

Source§

impl<'a, P: Clone + JsonRpcProvider> Clone for GasToken<'a, P>

Source§

fn clone(&self) -> GasToken<'a, P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

const fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, P: Debug + JsonRpcProvider> Debug for GasToken<'a, P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, 'a, P> Deserialize<'de> for GasToken<'a, P>

Source§

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<'a, P: JsonRpcProvider> FungibleTokenTrait<'a, P> for GasToken<'a, P>

Source§

const BALANCE_OF: &'static str = "balanceOf"

Source§

const TRANSFER: &'static str = "transfer"

Source§

fn get_balance_of<'life0, 'life1, 'async_trait>( &'life0 self, script_hash: &'life1 ScriptHash, ) -> Pin<Box<dyn Future<Output = Result<i32, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_balance_of_hash160<'life0, 'life1, 'async_trait>( &'life0 self, script_hash: &'life1 H160, ) -> Pin<Box<dyn Future<Output = Result<i32, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn get_total_balance<'life0, 'life1, 'async_trait>( &'life0 self, wallet: &'life1 Wallet, ) -> Pin<Box<dyn Future<Output = Result<i32, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn transfer_from_account<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 Account, to: &'life2 ScriptHash, amount: i32, data: Option<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, P>, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn transfer_from_hash160<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 ScriptHash, to: &'life2 ScriptHash, amount: i32, data: Option<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, P>, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn build_transfer_script<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 ScriptHash, to: &'life2 ScriptHash, amount: i32, data: Option<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn transfer_from_account_to_nns<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 Account, to: &'life2 NNSName, amount: i32, data: Option<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, P>, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn transfer_from_hash160_to_nns<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from: &'life1 ScriptHash, to: &'life2 NNSName, amount: i32, data: Option<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, P>, ContractError>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

impl<'a, P: JsonRpcProvider> Serialize for GasToken<'a, P>

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'a, P: JsonRpcProvider> SmartContractTrait<'a> for GasToken<'a, P>

Source§

type P = P

Source§

fn script_hash(&self) -> H160

Source§

fn set_script_hash(&mut self, script_hash: H160)

Source§

fn provider(&self) -> Option<&RpcClient<P>>

Source§

const DEFAULT_ITERATOR_COUNT: usize = 100usize

Source§

fn name<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = String> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn set_name(&mut self, _name: String)

Source§

fn invoke_function<'life0, 'life1, 'async_trait>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<TransactionBuilder<'_, Self::P>, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn build_invoke_function_script<'life0, 'life1, 'async_trait>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<Bytes, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn call_function_returning_string<'life0, 'life1, 'async_trait>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<String, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn call_function_returning_int<'life0, 'life1, 'async_trait>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<i32, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn call_function_returning_bool<'life0, 'life1, 'async_trait>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<bool, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn call_invoke_function<'life0, 'life1, 'async_trait>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, signers: Vec<Signer>, ) -> Pin<Box<dyn Future<Output = Result<InvocationResult, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn throw_if_fault_state( &self, output: &InvocationResult, ) -> Result<(), ContractError>

Source§

fn call_function_returning_script_hash<'life0, 'life1, 'async_trait>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, ) -> Pin<Box<dyn Future<Output = Result<H160, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn call_function_returning_iterator<'life0, 'life1, 'async_trait, U>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, mapper: Arc<dyn Fn(StackItem) -> U + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<NeoIterator<'_, U, Self::P>, ContractError>> + Send + 'async_trait>>
where U: Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn call_function_and_unwrap_iterator<'life0, 'life1, 'async_trait, U>( &'life0 self, function: &'life1 str, params: Vec<ContractParameter>, _max_items: usize, mapper: impl 'async_trait + Fn(StackItem) -> U + Send, ) -> Pin<Box<dyn Future<Output = Result<Vec<U>, ContractError>> + Send + 'async_trait>>
where U: 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn calc_native_contract_hash(contract_name: &str) -> Result<H160, ContractError>

Source§

fn calc_contract_hash( sender: H160, nef_checksum: u32, contract_name: &str, ) -> Result<H160, ContractError>

Source§

fn get_manifest<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = ContractManifest> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

impl<'a, P: JsonRpcProvider> TokenTrait<'a, P> for GasToken<'a, P>

Source§

fn total_supply(&self) -> Option<u64>

Source§

fn set_total_supply(&mut self, total_supply: u64)

Source§

fn decimals(&self) -> Option<u8>

Source§

fn set_decimals(&mut self, decimals: u8)

Source§

fn symbol(&self) -> Option<String>

Source§

fn set_symbol(&mut self, symbol: String)

Source§

fn resolve_nns_text_record<'life0, 'life1, 'async_trait>( &'life0 self, _name: &'life1 NNSName, ) -> Pin<Box<dyn Future<Output = Result<H160, ContractError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

const TOTAL_SUPPLY: &'static str = "totalSupply"

Source§

const SYMBOL: &'static str = "symbol"

Source§

const DECIMALS: &'static str = "decimals"

Source§

fn get_total_supply<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<u64, ContractError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn get_decimals<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<u8, ContractError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn get_symbol<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<String, ContractError>> + Send + 'async_trait>>
where Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

fn to_fractions(&self, amount: u64, decimals: u32) -> Result<i32, ContractError>

Source§

fn to_fractions_decimal( &self, amount: Decimal, decimals: u32, ) -> Result<u64, ContractError>

Source§

fn to_decimals_u64(&self, fractions: u64, decimals: u32) -> Decimal

Source§

fn to_decimals(&self, amount: i64, decimals: u32) -> Decimal

Auto Trait Implementations§

§

impl<'a, P> Freeze for GasToken<'a, P>

§

impl<'a, P> !RefUnwindSafe for GasToken<'a, P>

§

impl<'a, P> Send for GasToken<'a, P>

§

impl<'a, P> Sync for GasToken<'a, P>

§

impl<'a, P> Unpin for GasToken<'a, P>

§

impl<'a, P> !UnwindSafe for GasToken<'a, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> ErasedDestructor for T
where T: 'static,