Assignment 1: Taxed Token Program
The goal of this first assignment is to familiarize with the token program. In this assignment, you'll extend the token program we developed earlier by implementing a transaction tax feature. This feature will allow the admin to receive a percentage of the transfer as tax.
Learning Objectives
By completing this assignment, you will:
Apply your knowledge of Leo programming for state management
Implement more complex token interactions
Understand how to handle percentage-based calculations
Tasks
Implement tax collection for the
transfer_privatefunction. The tax should be added to the private balance of theADMINaddress.Implement tax collection for the
transfer_publicfunction. The tax should be added to the public balance of theADMINaddress.Implement tax collection for the
transfer_public_to_privatefunction. The tax should be added to the public balance of theADMINaddress.Implement tax collection for the
transfer_private_to_publicfunction. The tax should be added to the public balance of theADMINaddress.
The tax should be hard coded as a constant: TAX. It should be represented as a u16 representing the per ten thousand value of the amount sent. For instance if the tax u16 is set as 15, the tax should be the floor of 0.15% of the amount per transfer. The tax should be deducted from the amount of token spent, and credited to the balance of ADMIN address, according to the specifiactions above.
Last updated