Struct odra_modules::erc20::Erc20
source · pub struct Erc20 { /* private fields */ }Expand description
ERC20 token module
Implementations§
source§impl Erc20
impl Erc20
sourcepub fn init(
&mut self,
symbol: String,
name: String,
decimals: u8,
initial_supply: Option<U256>,
)
pub fn init( &mut self, symbol: String, name: String, decimals: u8, initial_supply: Option<U256>, )
Initializes the contract with the given metadata and initial supply.
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.
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 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.
Trait Implementations§
source§impl HasEntrypoints for Erc20
impl HasEntrypoints for Erc20
source§fn entrypoints() -> Vec<Entrypoint>
fn entrypoints() -> Vec<Entrypoint>
Returns the list of contract’s entrypoints.
source§impl Module for Erc20
impl Module for Erc20
source§fn new(env: Rc<ContractEnv>) -> Self
fn new(env: Rc<ContractEnv>) -> Self
Creates a new instance of the module with the given contract environment.
source§fn env(&self) -> Rc<ContractEnv>
fn env(&self) -> Rc<ContractEnv>
Returns the contract environment associated with the module.
source§impl SchemaCustomTypes for Erc20
impl SchemaCustomTypes for Erc20
source§fn schema_types() -> Vec<Option<CustomType>>
fn schema_types() -> Vec<Option<CustomType>>
Returns a vector of optional CustomTypes.
source§impl SchemaEntrypoints for Erc20
impl SchemaEntrypoints for Erc20
source§fn schema_entrypoints() -> Vec<Entrypoint>
fn schema_entrypoints() -> Vec<Entrypoint>
Returns a vector of Entrypoints.
source§impl SchemaErrors for Erc20
impl SchemaErrors for Erc20
source§impl SchemaEvents for Erc20
impl SchemaEvents for Erc20
source§fn custom_types() -> Vec<Option<CustomType>>
fn custom_types() -> Vec<Option<CustomType>>
Returns a vector of CustomTypes. Read more
Auto Trait Implementations§
impl Freeze for Erc20
impl !RefUnwindSafe for Erc20
impl !Send for Erc20
impl !Sync for Erc20
impl Unpin for Erc20
impl !UnwindSafe for Erc20
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
Mutably borrows from an owned value. Read more