Expense track

Contract Purpose

The contract has as purpose to keep track of expenses, based on a category-subcategory structure. The owner has liberty to build this structure as he/she wants.

Customizable Variables

struct ExpenseDetail
- Parameters:
- uint256_expenseAmount stores the expense amount
- uint256expenseTime stores the date-time in epoch value (Epoch, also known as Unix timestamps, is the number of seconds (not milliseconds!) that have elapsed since January 1, 1970 at 00:00:00 GMT (1970-01-01 00:00:00 GMT).)

owner stores the contract owner address
categoryCounter stores the expense category counter
subCategoryCounter stores the expense subcategory counter
expenseCategories is a list of expense categories expenseSubCategories is a list of expense subcategories expenses is a map of ExpenseDetail struct element described above, in relation to subcategoryId

Exposed Methods

1. __addExpenseCategories__ adds an expense category
    - string _expenseCategory) 
  1. addExpenseSubCategories adds an expense subcategory Parameters:

    • string _expenseSubCategory
  2. addExpense adds an expense Parameters:

    • uint256 _expenseSubCategoryId
    • uint256 _expenseDateTimeEpochValue
    • uint256 _value
  3. getExpenseCategory gets an expense category based on the id Parameters:

    • uint256 _expenseCategoryId
  4. getExpenseSubCategory gets an expense subcategory based on the id Parameters:

    • uint256 _expenseSubCategoryId
  5. getCategoryCounter gets the number of categories

  6. getSubCategoryCounter gets the number of subcategories


  1. addExpenseCategories("Transport")"
  2. addExpenseSubCategories("Gas")
  3. addExpense(1,1499851838,1000)
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract