I have following struct on my contract :
struct Token {
address tokenAddress;
uint256 stakedAmount;
bool isUsed;
uint256 lastTransactionDate;
}
It is used on following mapping :
mapping(address => mapping(address => Token)) public _stakingUserBalance
Each time user is stacking, I update stakedAmount
with an amount and lastTransactionDate
with block.timestamp
.
In order to compute rewards, I need to know if stacking is more than 1 day. But I'm not sure to understand correctly unix timestamp process.
Is it a way to convert lastTransactionDate
to a readable date, and compare with the moment of computing reward ?
Thanks for your help.