This smart contract provides functionality for managing user profiles and token manipulation on the Internet Computer. It includes functions for creating user profiles, assigning tokens, transferring tokens, burning tokens, and minting new tokens.
- Admin Profile Creation: Allows the admin to create a user profile if it doesn't already exist.
- Add User Profile: Enables the addition of user profiles by their user ID.
- Assign Tokens: Allows the admin to assign tokens to a user, checking for sufficient balance.
- Minter: Allows the admin to mint a specified number of tokens.
- Transfer Tokens: Enables the transfer of tokens from one user to another.
- Burn Tokens: Allows a user to burn their tokens, reducing their balance.
- Description: Creates a user profile for the admin if it does not already exist.
- Parameters:
user
: AUser
object containing user details.
- Panic: If the admin profile already exists.
- Description: Adds a new user profile.
- Parameters:
user_id
: The unique identifier for the user.user
: AUser
object containing user details.
- Panic: If the user profile with the given
user_id
already exists.
- Description: Assigns tokens from the admin to a specified user.
- Parameters:
user_id
: The ID of the user receiving tokens.amount
: The number of tokens to assign.
- Panic: If the admin does not have enough tokens to assign.
- Description: Mints a specified number of tokens for the admin.
- Parameters: None.
- Notes: Currently, it mints a fixed amount of 100,000 tokens.
- Description: Transfers tokens from one user to another.
- Parameters:
sender
: The ID of the sender.receiver
: The ID of the receiver.number_tokens
: The number of tokens to transfer.
- Panic: If the sender does not have enough tokens to send.
- Description: Allows a user to burn their tokens.
- Parameters:
burner_id
: The ID of the user burning tokens.number_tokens
: The number of tokens to burn.
- Panic: If the user does not have enough tokens to burn.
- Description: Retrieves the user profile for a given user ID.
- Parameters:
user_id
: The unique identifier for the user.
- Returns: An
Option<User>
containing the user profile orNone
if it does not exist.
To get started with the token manipulation smart contract:
- Clone the repository.
- Set up your development environment for Rust and the Internet Computer SDK.
- Compile the smart contract and deploy it to the Internet Computer.
This project is licensed under the MIT License. See the LICENSE file for more details.
- Thanks to the DFINITY team for their support and documentation.
- Special thanks to the Rust community for their resources and libraries.