-
Notifications
You must be signed in to change notification settings - Fork 389
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(examples): add {p,r}/demo/tamagotchi #1359
Conversation
✅ Deploy Preview for gno-docs2 canceled.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1359 +/- ##
==========================================
+ Coverage 55.94% 56.36% +0.41%
==========================================
Files 420 423 +3
Lines 65477 66440 +963
==========================================
+ Hits 36631 37447 +816
- Misses 25983 26106 +123
- Partials 2863 2887 +24 ☔ View full report in Codecov by Sentry. |
Do you also want to just move the package to p/demo/tamagotchi in this PR? |
What do you prefer for the realm:
Which option do you prefer? |
I think it can be a useful thing to play around with. Together with the personal realms that you introduced in #1138 (on my review-list as well), we can encourage users to play around on their local installations to make "home pages"; and as such make tamagotchis another fun tool that a user can simply add to their personal realm, even if just playing around with gno locally on their machine. I'm not sure what you mean by making it an interface; I think it can be decently useful without "genericising" it :) |
split done. next steps:
Edit: good for me for a new review. |
ffd09c4
to
6fe0d2f
Compare
Signed-off-by: moul <[email protected]>
219174e
to
9ac550d
Compare
Signed-off-by: moul <[email protected]>
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.
good after changes ✔️
Co-authored-by: Morgan <[email protected]>
Co-authored-by: Morgan <[email protected]>
Co-authored-by: Morgan <[email protected]>
This is an example that extensively utilizes timestamps to mimic ticks.
The render function could perform an in-memory update to simulate a consistently current state before it displays anything. The actual update, however, takes place during transactions.
Additionally, the tamagotchi object can be designed for safety, allowing its pointer to be managed in a permissionless manner.
To simplify and reduce confusion, I placed everything in the realm. However, in reality, Tamagotchi.gno could function as a standalone package that allows the creation of various tamagotchis from other realms or even different tamagotchi families.
I created this example to showcase timing constraints without relying on DeFi. In practice, this simple example could be enhanced by using an interface and incorporating additional Tamagotchi<>Tamagotchi actions such as breeding, cloning, and so on. Nevertheless, it might be preferable to keep this example simple for now, while we can imagine implementing these improvements in separate contracts.
Please note that the testing is not extensive because we currently do not have a method to modify timestamps during unit tests. You can refer to the following link for more information: GitHub Issue #1165.