-
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
Completed HW 01 of Gear Academy #55
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.
Please make a PR to be merged into your repo (https://github.com/jonar12/dapps-template-gear-academy) instead of the template.
Please reread the homework rules: https://academy.gear.rs/getting-started/homework-rules
Note that the target branch for the PR should be
master
in your repository, not in the template one.
Also, please be sure your CI workflow passes before sending the PR.
name); | ||
|
||
let tamagotchi = Tamagotchi { | ||
name: name.clone(), |
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 need to clone the name
, it is better to move it.
name: name.clone(), | |
name, |
msg::reply( | ||
TmgEvent::Name(name), | ||
0 | ||
).unwrap(); |
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.
This reply is not defined in metadata, it is pretty senseless.
msg::reply( | |
TmgEvent::Name(name), | |
0 | |
).unwrap(); |
msg::reply(TmgEvent::Name(tmg.name.clone()), 0).expect("Name not loaded correctly"); | ||
} | ||
TmgAction::Age => { | ||
msg::reply(TmgEvent::Age(tmg.date_of_birth.clone()), 0).expect("Age not loaded correctly"); |
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 need to clone Copy
types. Also, Age
should depend on the current block timestamp.
let res = _program.send(2, TmgAction::Age); | ||
assert!(!res.log().is_empty()); |
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.
You could write a more expressive test by using the System::spend_blocks
function.
No description provided.