pub struct Cep18HostRef { /* private fields */ }Expand description
Cep18 Host Ref.
Implementations§
Source§impl Cep18HostRef
impl Cep18HostRef
Sourcepub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: U256,
)
pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: U256, )
Initializes the contract with the given metadata, initial supply.
Sourcepub fn total_supply(&self) -> U256
pub fn total_supply(&self) -> U256
Returns the total supply of the token.
Sourcepub fn balance_of(&self, address: &Address) -> U256
pub fn balance_of(&self, address: &Address) -> U256
Returns the balance of the given address.
Sourcepub fn allowance(&self, owner: &Address, spender: &Address) -> U256
pub fn allowance(&self, owner: &Address, spender: &Address) -> U256
Returns the amount of tokens the owner has allowed the spender to spend.
Sourcepub fn approve(&mut self, spender: &Address, amount: &U256)
pub fn approve(&mut self, spender: &Address, amount: &U256)
Approves the spender to spend the given amount of tokens on behalf of the caller.
Sourcepub fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256)
pub fn decrease_allowance(&mut self, spender: &Address, decr_by: &U256)
Decreases the allowance of the spender by the given amount.
Sourcepub fn increase_allowance(&mut self, spender: &Address, inc_by: &U256)
pub fn increase_allowance(&mut self, spender: &Address, inc_by: &U256)
Increases the allowance of the spender by the given amount.
Sourcepub fn transfer(&mut self, recipient: &Address, amount: &U256)
pub fn transfer(&mut self, recipient: &Address, amount: &U256)
Transfers tokens from the caller to the recipient.
Sourcepub fn transfer_from(
&mut self,
owner: &Address,
recipient: &Address,
amount: &U256,
)
pub fn transfer_from( &mut self, owner: &Address, recipient: &Address, amount: &U256, )
Transfers tokens from the owner to the recipient using the spender’s allowance.
Source§impl Cep18HostRef
impl Cep18HostRef
Sourcepub fn try_init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: U256,
) -> OdraResult<()>
pub fn try_init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: U256, ) -> OdraResult<()>
Initializes the contract with the given metadata, initial supply.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_name(&self) -> OdraResult<String>
pub fn try_name(&self) -> OdraResult<String>
Returns the name of the token.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_symbol(&self) -> OdraResult<String>
pub fn try_symbol(&self) -> OdraResult<String>
Returns the symbol of the token.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_decimals(&self) -> OdraResult<u8>
pub fn try_decimals(&self) -> OdraResult<u8>
Returns the number of decimals the token uses.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_total_supply(&self) -> OdraResult<U256>
pub fn try_total_supply(&self) -> OdraResult<U256>
Returns the total supply of the token.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_balance_of(&self, address: &Address) -> OdraResult<U256>
pub fn try_balance_of(&self, address: &Address) -> OdraResult<U256>
Returns the balance of the given address.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_allowance(
&self,
owner: &Address,
spender: &Address,
) -> OdraResult<U256>
pub fn try_allowance( &self, owner: &Address, spender: &Address, ) -> OdraResult<U256>
Returns the amount of tokens the owner has allowed the spender to spend.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_approve(
&mut self,
spender: &Address,
amount: &U256,
) -> OdraResult<()>
pub fn try_approve( &mut self, spender: &Address, amount: &U256, ) -> OdraResult<()>
Approves the spender to spend the given amount of tokens on behalf of the caller.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_decrease_allowance(
&mut self,
spender: &Address,
decr_by: &U256,
) -> OdraResult<()>
pub fn try_decrease_allowance( &mut self, spender: &Address, decr_by: &U256, ) -> OdraResult<()>
Decreases the allowance of the spender by the given amount.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_increase_allowance(
&mut self,
spender: &Address,
inc_by: &U256,
) -> OdraResult<()>
pub fn try_increase_allowance( &mut self, spender: &Address, inc_by: &U256, ) -> OdraResult<()>
Increases the allowance of the spender by the given amount.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_transfer(
&mut self,
recipient: &Address,
amount: &U256,
) -> OdraResult<()>
pub fn try_transfer( &mut self, recipient: &Address, amount: &U256, ) -> OdraResult<()>
Transfers tokens from the caller to the recipient.
Does not fail in case of error, returns odra::OdraResult instead.
Sourcepub fn try_transfer_from(
&mut self,
owner: &Address,
recipient: &Address,
amount: &U256,
) -> OdraResult<()>
pub fn try_transfer_from( &mut self, owner: &Address, recipient: &Address, amount: &U256, ) -> OdraResult<()>
Transfers tokens from the owner to the recipient using the spender’s allowance.
Does not fail in case of error, returns odra::OdraResult instead.
Trait Implementations§
Source§impl EntryPointsCallerProvider for Cep18HostRef
impl EntryPointsCallerProvider for Cep18HostRef
Source§fn entry_points_caller(env: &HostEnv) -> EntryPointsCaller
fn entry_points_caller(env: &HostEnv) -> EntryPointsCaller
Source§impl HostRef for Cep18HostRef
impl HostRef for Cep18HostRef
Source§fn new(address: Address, env: HostEnv) -> Self
fn new(address: Address, env: HostEnv) -> Self
Source§fn with_tokens(&self, tokens: U512) -> Self
fn with_tokens(&self, tokens: U512) -> Self
Source§fn contract_address(&self) -> Address
fn contract_address(&self) -> Address
Source§fn get_event<T>(&self, index: i32) -> Result<T, EventError>where
T: FromBytes + EventInstance,
fn get_event<T>(&self, index: i32) -> Result<T, EventError>where
T: FromBytes + EventInstance,
Source§fn last_call(&self) -> ContractCallResult
fn last_call(&self) -> ContractCallResult
Auto Trait Implementations§
impl Freeze for Cep18HostRef
impl !RefUnwindSafe for Cep18HostRef
impl !Send for Cep18HostRef
impl !Sync for Cep18HostRef
impl Unpin for Cep18HostRef
impl !UnwindSafe for Cep18HostRef
Blanket Implementations§
Source§impl<T> Addressable for Twhere
T: HostRef,
impl<T> Addressable for Twhere
T: HostRef,
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> 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