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

Homework - Tamagotchi 3 NFT #76

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

TerratekMusic
Copy link

No description provided.

// TODO: 5️⃣ Initialize the Tamagotchi program
let tamagochi: Tamagotchi = Tamagotchi {
name: String::from("Ivan"),
date_of_birth: 45,

Choose a reason for hiding this comment

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

Why 45?

let init_msg: String = msg::load().expect("Can't decode an init message");

let tamagotchi = Tamagotchi {
name: "Ivan".to_string(),

Choose a reason for hiding this comment

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

It must be set from incoming message

msg::reply(age, 0).expect("Error in sending age");

}
};
// TODO: 5️⃣ Add new logic for calculating the `fed`, `entertained` and `slept` levels

Choose a reason for hiding this comment

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

No implementation that is requires

msg::reply(TmgEvent::Age(age), 0).expect("Error in sending age");

}
TmgAction::Feed => {

Choose a reason for hiding this comment

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

No check that Tamagotchi has died.
overflow is also possible when you subtract one value from another.
You should use saturating_sub

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants