TRON
$0.03529 11.48%
TRX · 4w

How to use two key (where) to dispay data?

hi, i want to retrieve two data with key. I have one only with users\[addr\]. In my case I have storage with IsCollect bool too. So, how can I use where=IsCollect and find where = IsCollect=false/true I need to display only with IsCollect= false/true. This is my code: function getPlayerDepositHistory(address addr) public view returns (uint256[] memory, uint256[] memory, uint256[] memory, uint256[] memory, bool[] memory) { DepositHistory[] memory invests = users[addr].deposithistory; uint256[] memory baseTimes = new uint256[](invests.length); uint256[] memory values = new uint256[](invests.length); uint256[] memory profit = new uint256[](invests.length); uint256[] memory validUntil = new uint256[](invests.length); bool[] memory IsCollect = new bool[](invests.length); uint256 i = 0; uint256 timeSpent = 0; while (i < invests.length){ DepositHistory memory invest = invests[i]; // if (invest.IsCollect=false) // { if (invest.lastDepositTime < invest.depositTime.add(PERIOD[0])){ uint256 remainedTime = PERIOD[0].sub(invest.lastDepositTime.sub(invest.depositTime)); if (remainedTime > 0){ timeSpent=now.sub(invest.lastDepositTime); if (remainedTime <= timeSpent){ timeSpent = remainedTime; } } baseTimes[i] = invest.depositTime; values[i] = invest.amount; profit[i] = invest.amount.div(RATE_DIVIDER[0]) * timeSpent; validUntil[i] = invest.depositTime.add(PERIOD[0]); IsCollect[i] = invest.IsCollect; }i++; /...
Continue on self.Tronix
No posts found
Recent news
No posts found