class IBasicTokenContract
Defines the basic interface for a token contract.
All token contracts should inherit from this class and implement its methods.
This class is designed to provide a standardized way of interacting with token contracts, ensuring consistency and interoperability across different implementations.
Methods
burn(receiverAddress, amount)
Burning (destroying) tokens, reducing the total supply. (require signature)
Name | Type | Description |
---|---|---|
|
|
The address of the token holder whose tokens will be burned |
|
|
The amount of tokens to burn |
Returns |
|
abstract burn(receiverAddress: PublicKey, amount: UInt64): Promise<void>;
burnWithSignature(receiverAddress, amount, adminSignature)
Burning (destroying) tokens with signature, reducing the total supply.
Name | Type | Description |
---|---|---|
|
|
The address of the token holder whose tokens will be burned |
|
|
The amount of tokens to burn |
|
|
A signature from an authorized administrator, required to approve the burning |
Returns |
|
abstract burnWithSignature(receiverAddress: PublicKey, amount: UInt64, adminSignature: Signature): Promise<void>;
deploy()
Deploys the token contract to the blockchain.
This method should handle all necessary steps for deploying the contract, such as configuring ownership.
abstract deploy(): Promise<void>;
init()
Initializes the token contract after deployment.
This method is used to perform any additional setup tasks after the contract is deployed, such as setting initial token balances or defining access control rules.
abstract init(): void;
mint(receiverAddress, amount)
Mints new tokens and assigns them to a receiver. (require signature)
Name | Type | Description |
---|---|---|
|
|
The address of the receiver who will receive the newly minted tokens |
|
|
The amount of tokens to mint |
Returns |
|
abstract mint(receiverAddress: PublicKey, amount: UInt64): Promise<void>;
mintWithSignature(receiverAddress, amount, adminSignature)
Mints new tokens with signature and assigns them to a receiver.
Name | Type | Description |
---|---|---|
|
|
The address of the receiver who will receive the newly minted tokens |
|
|
The amount of tokens to mint |
|
|
A signature from an authorized administrator, required to approve the minting |
Returns |
|
abstract mintWithSignature(receiverAddress: PublicKey, amount: UInt64, adminSignature: Signature): Promise<void>;
sendTokens(senderAddress, receiverAddress, amount)
Sends tokens from one address to another.
Name | Type | Description |
---|---|---|
|
|
The address of the sender who is transferring the tokens |
|
|
The address of the receiver who will receive the tokens |
|
|
The amount of tokens to transfer |
Returns |
|
abstract sendTokens(senderAddress: PublicKey, receiverAddress: PublicKey, amount: UInt64): Promise<void>;