I have a balance as follows such that after changing its value, I want to keep the history of previous transactions, for example, for the first time, value of
5 and for the second time
2 units will be added to
Energy_Balance such that the total value will be
7. Now I want to keep the history of all transactions such that we would be able to know what was the first value (i.e.
5) and what was the second transaction value (i.e.
2). If I have to define an
event for this, how to define it and how to invoke event ?
mapping(address => uint256) Energy_Balance
In case of using an array as proposed by user Eli Drion, as follows:
mapping (address => uint) Energy_Balance
How can I set the new value of Energy_Balance ? For example,
First Transaction: balances[owner] = balances[owner] + value; Second Transaction: balances[owner] = balances[owner] + value;
is correct ?