Skip to content
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

Merged
merged 4 commits into from
Dec 7, 2023

Conversation

moul
Copy link
Member

@moul moul commented Nov 11, 2023

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.

CleanShot 2023-11-12 at 12 17 03@2x

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.

@moul moul self-assigned this Nov 11, 2023
Copy link

netlify bot commented Nov 11, 2023

Deploy Preview for gno-docs2 canceled.

Name Link
🔨 Latest commit b95cd86
🔍 Latest deploy log https://app.netlify.com/sites/gno-docs2/deploys/6550f726a52ab400083c9806

@moul moul changed the title dev/moul/tamagotchi feat(examples): add demo/tamagotchi Nov 11, 2023
@github-actions github-actions bot added the 🧾 package/realm Tag used for new Realms or Packages. label Nov 11, 2023
Copy link

codecov bot commented Nov 11, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (902e678) 55.94% compared to head (f6c9bf5) 56.36%.
Report is 10 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

@github-actions github-actions bot added the 📦 ⛰️ gno.land Issues or PRs gno.land package related label Nov 12, 2023
@moul moul marked this pull request as ready for review November 12, 2023 11:16
@moul moul requested a review from a team as a code owner November 12, 2023 11:16
gno.land/Makefile Show resolved Hide resolved
examples/gno.land/r/demo/tamagotchi/z0_filetest.gno Outdated Show resolved Hide resolved
examples/gno.land/r/demo/tamagotchi/tamagotchi.gno Outdated Show resolved Hide resolved
@thehowl
Copy link
Member

thehowl commented Nov 16, 2023

Do you also want to just move the package to p/demo/tamagotchi in this PR?

@moul
Copy link
Member Author

moul commented Nov 16, 2023

Do you also want to just move the package to p/demo/tamagotchi in this PR?

What do you prefer for the realm:

  1. I can keep it as it is, mixing "p" and "r" in "r".
  2. I can split it and create "p/demo/tamagotchi", but I'm not sure if anyone will use it before it becomes an interface.
  3. I can move it to "p/" and use the feat: add r/demo/showcase #898 realm for the demo on the realm's side.

Which option do you prefer?

@thehowl
Copy link
Member

thehowl commented Nov 16, 2023

I can split it and create "p/demo/tamagotchi", but I'm not sure if anyone will use it before it becomes an interface.

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 :)

@moul
Copy link
Member Author

moul commented Nov 16, 2023

split done.

next steps:


Edit: good for me for a new review.

@moul-bot moul-bot force-pushed the dev/moul/tamagotchi branch from ffd09c4 to 6fe0d2f Compare November 21, 2023 18:59
@moul moul changed the title feat(examples): add demo/tamagotchi feat(examples): add {p,r}/demo/tamagotchi Nov 21, 2023
@moul-bot moul-bot force-pushed the dev/moul/tamagotchi branch from 219174e to 9ac550d Compare November 21, 2023 19:18
Signed-off-by: moul <[email protected]>
Copy link
Member

@thehowl thehowl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good after changes ✔️

examples/gno.land/p/demo/tamagotchi/gno.mod Outdated Show resolved Hide resolved
examples/gno.land/p/demo/tamagotchi/tamagotchi.gno Outdated Show resolved Hide resolved
@gfanton gfanton merged commit 0f440aa into gnolang:master Dec 7, 2023
185 checks passed
gfanton pushed a commit to moul/gno that referenced this pull request Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 ⛰️ gno.land Issues or PRs gno.land package related 🧾 package/realm Tag used for new Realms or Packages.
Projects
Status: ✅ Done
Status: 🔵 Not Needed for Launch
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants