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

Completed HW 01 of Gear Academy #55

Closed
wants to merge 1 commit into from

Conversation

jonar12
Copy link

@jonar12 jonar12 commented Jan 11, 2024

No description provided.

Copy link
Contributor

@shamilsan shamilsan left a 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(),
Copy link
Contributor

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.

Suggested change
name: name.clone(),
name,

Comment on lines +28 to +31
msg::reply(
TmgEvent::Name(name),
0
).unwrap();
Copy link
Contributor

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.

Suggested change
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");
Copy link
Contributor

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.

Comment on lines +20 to +21
let res = _program.send(2, TmgAction::Age);
assert!(!res.log().is_empty());
Copy link
Contributor

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.

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