code:
function collect(address addr) public returns (uint256){
Deposit[] storage invests = users[addr].deposits;
uint256 i = 0;
uint256 profit = 0;
while (i < invests.length){
Deposit storage invest = invests[i];
if (invest.lastDepositTime < invest.depositTime.add(200 days)){
uint256 remainedTime = BOX_PERIOD[0].sub(invest.lastDepositTime.sub(invest.depositTime));
// timeSpent = now.sub(invest.lastDepositTime);
if (remainedTime > 0){
uint256 a;
uint256 b;
uint256 c;
uint256 d;
uint256 e;
uint256 f;
uint256 g;
uint256 timespend;
uint256 i2;
uint256 j;
uint256 k;
uint256 h;
a=profit;
b=24;
c=100;
d=60;
e=100;
f=60;
g=100;
h=10000000;
timespend=now.sub(invest.lastDepositTime);
profit = a.div(b).mul(c).div(d).mul(e).div(f).mul(g).div(h);
I got error: browser/test1.sol:76:30: CompilerError: Stack too deep, try removing local variables. profit = invest.amount.div(24).mul(100).div(60).mul(100).div(60).mul(100).div(1000000).mul(timeSpent); ^----^
This is only if add .mul(timeSpent),other way works.
I have tried too uint[8], uint[256] I got data location bust be storage or memory for variable but still not works..
profit = invest.amount.mul(100*100*100*timeSpent).div(24*60*60*1000000);
or betterinvest.amount.mul(timeSpent).div(24*60*60);