-
Notifications
You must be signed in to change notification settings - Fork 48
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
base: master
Are you sure you want to change the base?
Conversation
// TODO: 5️⃣ Initialize the Tamagotchi program | ||
let tamagochi: Tamagotchi = Tamagotchi { | ||
name: String::from("Ivan"), | ||
date_of_birth: 45, |
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.
Why 45?
let init_msg: String = msg::load().expect("Can't decode an init message"); | ||
|
||
let tamagotchi = Tamagotchi { | ||
name: "Ivan".to_string(), |
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.
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 |
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.
No implementation that is requires
msg::reply(TmgEvent::Age(age), 0).expect("Error in sending age"); | ||
|
||
} | ||
TmgAction::Feed => { |
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.
No check that Tamagotchi has died.
overflow is also possible when you subtract one value from another.
You should use saturating_sub
No description provided.