pub struct Cep18 { /* private fields */ }Expand description
CEP-18 token module
Implementations§
Source§impl Cep18
impl Cep18
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 Cep18
impl Cep18
Sourcepub fn raw_transfer(
&mut self,
sender: &Address,
recipient: &Address,
amount: &U256,
)
pub fn raw_transfer( &mut self, sender: &Address, recipient: &Address, amount: &U256, )
Transfers tokens from the sender to the recipient without checking the permissions.
Sourcepub fn raw_mint(&mut self, owner: &Address, amount: &U256)
pub fn raw_mint(&mut self, owner: &Address, amount: &U256)
Mints new tokens and assigns them to the given address without checking the permissions.
Sourcepub fn raw_burn(&mut self, owner: &Address, amount: &U256)
pub fn raw_burn(&mut self, owner: &Address, amount: &U256)
Burns the given amount of tokens from the given address without checking the permissions.
Sourcepub fn set_symbol(&mut self, symbol: String)
pub fn set_symbol(&mut self, symbol: String)
Set symbol of the token.
Sourcepub fn set_decimals(&mut self, decimals: u8)
pub fn set_decimals(&mut self, decimals: u8)
Set decimals of the token.
Trait Implementations§
Source§impl HasEntrypoints for Cep18
impl HasEntrypoints for Cep18
Source§fn entrypoints() -> Vec<Entrypoint>
fn entrypoints() -> Vec<Entrypoint>
Source§impl Module for Cep18
impl Module for Cep18
Source§fn new(env: Rc<ContractEnv>) -> Self
fn new(env: Rc<ContractEnv>) -> Self
Source§fn env(&self) -> Rc<ContractEnv>
fn env(&self) -> Rc<ContractEnv>
Source§impl OdraContract for Cep18
impl OdraContract for Cep18
Source§type HostRef = Cep18HostRef
type HostRef = Cep18HostRef
Source§type ContractRef = Cep18ContractRef
type ContractRef = Cep18ContractRef
Source§type InitArgs = Cep18InitArgs
type InitArgs = Cep18InitArgs
Source§type UpgradeArgs = NoArgs
type UpgradeArgs = NoArgs
Source§impl SchemaCustomTypes for Cep18
Available on non-WebAssembly only.
impl SchemaCustomTypes for Cep18
Source§fn schema_types() -> Vec<Option<CustomType>>
fn schema_types() -> Vec<Option<CustomType>>
Source§impl SchemaEntrypoints for Cep18
Available on non-WebAssembly only.
impl SchemaEntrypoints for Cep18
Source§fn schema_entrypoints() -> Vec<Entrypoint>
fn schema_entrypoints() -> Vec<Entrypoint>
Source§impl SchemaErrors for Cep18
Available on non-WebAssembly only.
impl SchemaErrors for Cep18
Source§impl SchemaEvents for Cep18
Available on non-WebAssembly only.
impl SchemaEvents for Cep18
Source§fn custom_types() -> Vec<Option<CustomType>>
fn custom_types() -> Vec<Option<CustomType>>
Auto Trait Implementations§
impl !Freeze for Cep18
impl !RefUnwindSafe for Cep18
impl !Send for Cep18
impl !Sync for Cep18
impl Unpin for Cep18
impl !UnwindSafe for Cep18
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<R> Deployer<R> for Rwhere
R: OdraContract,
impl<R> Deployer<R> for Rwhere
R: OdraContract,
Source§fn deploy(
env: &HostEnv,
init_args: <R as OdraContract>::InitArgs,
) -> <R as OdraContract>::HostRef
fn deploy( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, ) -> <R as OdraContract>::HostRef
Source§fn try_deploy(
env: &HostEnv,
init_args: <R as OdraContract>::InitArgs,
) -> Result<<R as OdraContract>::HostRef, OdraError>
fn try_deploy( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, ) -> Result<<R as OdraContract>::HostRef, OdraError>
Source§fn deploy_with_cfg(
env: &HostEnv,
init_args: <R as OdraContract>::InitArgs,
cfg: InstallConfig,
) -> <R as OdraContract>::HostRef
fn deploy_with_cfg( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, cfg: InstallConfig, ) -> <R as OdraContract>::HostRef
Source§fn try_deploy_with_cfg(
env: &HostEnv,
init_args: <R as OdraContract>::InitArgs,
cfg: InstallConfig,
) -> Result<<R as OdraContract>::HostRef, OdraError>
fn try_deploy_with_cfg( env: &HostEnv, init_args: <R as OdraContract>::InitArgs, cfg: InstallConfig, ) -> Result<<R as OdraContract>::HostRef, OdraError>
Source§fn try_upgrade(
env: &HostEnv,
contract_to_upgrade: Address,
upgrade_args: <R as OdraContract>::UpgradeArgs,
) -> Result<<R as OdraContract>::HostRef, OdraError>
fn try_upgrade( env: &HostEnv, contract_to_upgrade: Address, upgrade_args: <R as OdraContract>::UpgradeArgs, ) -> Result<<R as OdraContract>::HostRef, OdraError>
Source§fn try_upgrade_with_cfg(
env: &HostEnv,
contract_to_upgrade: Address,
upgrade_args: <R as OdraContract>::UpgradeArgs,
cfg: UpgradeConfig,
) -> Result<<R as OdraContract>::HostRef, OdraError>
fn try_upgrade_with_cfg( env: &HostEnv, contract_to_upgrade: Address, upgrade_args: <R as OdraContract>::UpgradeArgs, cfg: UpgradeConfig, ) -> Result<<R as OdraContract>::HostRef, OdraError>
Source§impl<T> HostRefLoader<<T as OdraContract>::HostRef> for Twhere
T: OdraContract,
impl<T> HostRefLoader<<T as OdraContract>::HostRef> for Twhere
T: OdraContract,
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