-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: create a increase_day_index
function
#23
feat: create a increase_day_index
function
#23
Conversation
@b-j-roberts Hi, here is a first draft. I need more precisions about the purpose of this function. For now, i created an internal impl for this function, as i guess this function will be called internally each time a user interacts? Or is there any backend in charge of calling it externally by an admin ? or anyone? Currently, the function will reset a new start day , setting the current block timestamp as a new start day time. This means that if the function is called more than each 24h exactly, each incrementation will not correspond to 24h exactly. I can modify it to make sure each index is 24h by setting the new start value to the last one + 24h I will add tests once i fully understand how this function will be used! |
Hey, good work and nice points @TAdev0 ! I think having the function callable externally by anyone is good and decreases the need for trusting an admin. We will need to add an For the "exact timing" issue, I think it's fine if each day goes longer than 24h exactly. However, it's up to you. Either have it set the new start time like it is now, or set the new start time to exactly start time + 24h, whatever you think is best! Side note: You can set the initial start time in the constructor to be equal to creation time |
@b-j-roberts thanks for the quick answer. well it's up to you:
|
Yeah, based on the way Starknet works, I don't think there is a perfect solution for time based things like this sadly. |
oh yeah i see, indeed if you want each day index to be a period where people have the opportunity to complete quests we should keep it like this. |
@b-j-roberts just added 2 tests ! |
This PR implements an
increase_day_index
function to increment aday_index
variable in storage each time 24h have passed.Closes #15