I need some help on what's the best way of implementing solidity code that keeps track of a user's daily data. Once the day passes it's stored in an array for every single day that passes and that daily data is reset for the next day. I would like to get some ideas or sample code related to this?

If I am not explaining it correctly think of it as if someone wants to keep track of their homework everyday. We keep a history of all the days that have passed and are able to show on the UI the current day homework and any of the days in the past.

My current implementation is the following:

mapping(address => Homework) public daily;

mapping(address =>  Homework[]) public overall;

Is this the right approach, I am basically running a scheduler to run every day and once it executes the daily would be reset for each user and push in the daily to the overall. But I cannot get access to the keys for the mapping making this approach difficult. Any other suggestions?

1 Answer 1


Let me tell you, Arrays in solidity are a difficult subject, I've been struggling there before. I think you can start by reading this article to have an idea about array patterns.

I would recommend you to try to separate problems you want to solve into different questions so others that know more than me can help you with particular examples.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.