-
Notifications
You must be signed in to change notification settings - Fork 0
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#3 session badges #2
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, Leo! If it makes sense I would like to make two suggestions:
- Emit an event when a session is created
Reason: Make it easy to access on the blockchain side in case it is necessary; Easy to track
Resolver.sol
event SessionCreated(
bytes32 indexed sessionId,
address indexed host,
string title,
uint256 startTime,
uint256 endTime
);
//function createSession()
emit SessionCreated(
sessionId,
msg.sender,
sessionTitle,
session.startTime,
session.endTime
);
- Add function to end or cancel a session and session status (like: Active, Ended, Cancelled)
Reason: Keep track of the session status; Make the user finish the session despite the time
Like:
enum SessionStatus { Active, Ended, Cancelled }
struct Session {
address host;
string title;
uint256 startTime;
uint256 endTime;
SessionStatus status;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are optional suggestions, so feel free to disagree in case they do not make sense to you!
Also, good job with the testing coverage and code organization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Rascar, ty for the review brother.
1- Great catch related to the event bro! Makes our lives easier. I will implement it.
2- I think that the status adds a complexity that is not ideal. Look, to modify a status in the struct, it would be necessary to call a function and pay for it. The best approach is just keep looking for the endTIme. If someone wants to know if a session is still valid, just need to look if currentTime<endTime.
Pull request made to complete this task: https://github.com/orgs/blockful-io/projects/16/views/1?pane=issue&itemId=83822933&issue=blockful-io%7Cbackend-zucity%7C3
The context is that we will now have "session" in the contract. Each villager can create a session. Each session automatically creates two new badges that only the session host can attest.
To achieve this, the following items were added: