class IERC20

Represents a standard interface for fungible tokens, implementing the ERC20 standard.

This abstract class defines a set of functions that tokens must implement to be compatible with the ERC20 standard. It provides basic functionality for tracking token balances, transfers, and approvals.

Properties

decimals

Signature
abstract decimals?: () => Field;

events

Events emitted by the contract.

Signature
events: IERC20Events;

name

Signature
abstract name?: () => CircuitString;

symbol

Signature
abstract symbol?: () => CircuitString;

Methods

allowance(owner, spender)

Parameters
Name Type Description

owner

PublicKey

The address of the token owner.

spender

PublicKey

The address of the spender.

Returns

UInt64

The amount of tokens approved for the spender to spend on behalf of the owner, as a UInt64.

Signature
abstract allowance(owner: PublicKey, spender: PublicKey): UInt64;

approveSpend(spender, value)

mutations which need

Parameters
Name Type Description

spender

PublicKey

The address to approve as a spender.

value

UInt64

The amount of tokens to approve.

Returns

Promise<void>

True if the approval was successful, false otherwise. Approval

Signature
abstract approveSpend(spender: PublicKey, value: UInt64): Promise<void>;

balanceOf(owner)

Parameters
Name Type Description

owner

PublicKey | AccountUpdate

The address of the token owner.

Returns

Promise<UInt64>

The balance of the owner, as a UInt64.

Signature
abstract balanceOf(owner: PublicKey | AccountUpdate): Promise<UInt64>;

burn(receiverAddress, amount)

Burning (destroying) tokens, reducing the total supply. (require signature)

Parameters
Name Type Description

receiverAddress

PublicKey

The address of the token holder whose tokens will be burned

amount

UInt64

The amount of tokens to burn

Returns

Promise<void>

Signature
abstract burn(receiverAddress: PublicKey, amount: UInt64): Promise<void>;

mint(receiverAddress, amount)

Mints new tokens and assigns them to a receiver. (require signature)

Parameters
Name Type Description

receiverAddress

PublicKey

The address of the receiver who will receive the newly minted tokens

amount

UInt64

The amount of tokens to mint

Returns

Promise<void>

Signature
abstract mint(receiverAddress: PublicKey, amount: UInt64): Promise<void>;

totalSupply()

Signature
abstract totalSupply(): UInt64;

transferFrom(from, to, value)

mutations which need

Parameters
Name Type Description

from

PublicKey

The address to transfer tokens from.

to

PublicKey

The address to transfer tokens to.

value

UInt64

The amount of tokens to transfer.

Returns

Promise<void>

True if the transfer was successful, false otherwise. Transfer

Signature
abstract transferFrom(from: PublicKey, to: PublicKey, value: UInt64): Promise<void>;
© OpenNautilus 2024-