Skip to content

dmystical-coder/token-balance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Token Balance Contract

Objective: Create a smart contract that works like a simple bank. It should keep track of how many tokens each person has and allow people to mint new tokens, check their balance, and transfer tokens to others.

Simple Explanation:

  • Like a bank = Keeps track of everyone’s money
  • Mint tokens = Create new money (only the owner can do this)
  • Check balance = See how much money someone has
  • Transfer tokens = Send money from one person to another
  • Handle errors = Make sure people can’t do impossible things (like spend more than they have)

Requirements (in simple terms):

  1. Use Mapping<AccountId, u128> to store balances (like a phone book: person -> amount of money)
  2. Implement mint message to create new tokens (like printing new money)
  3. Implement balance_of message to check account balance (like checking your bank balance)
  4. Implement transfer message to move tokens between accounts (like sending money to someone)
  5. Add proper error handling (like making sure people can’t spend more than they have)
  6. Include events for important operations (like sending receipts for transactions)

Solution

Build screenshot

alt text

About

Build a Simple Token Balance Contract

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages