I define a balance as follows :
mapping (address => uint[]) Energy_Balance
to keep the history of each transaction. I set its new value as follows :
First Transaction: balances[owner][0] = balances[owner][0] + value;
Second Transaction: balances[owner][1] = balances[owner][1] + value;
Now, I want to define a uint
counter
such that it can keep its last value every time it is increased one unit as follows :
balances[owner][counter] = balances[owner][counter] + value
If I define counter as follows, is it correct in solidity and it can keep its last value ?
static uint counter = 0;
function myFunction(uint value) {
balances[owner][counter] = balances[owner][counter] + value;
counter = counter +1;
}