-
Notifications
You must be signed in to change notification settings - Fork 0
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
Tamagotchi_nft #5
base: master
Are you sure you want to change the base?
Conversation
.payload(TmgEvent::Transferred(1.into())); | ||
assert!(result.contains(&log)); | ||
|
||
// let result = program.send(1, TmgAction::Approve(2.into())); |
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.
Need to check the transfer from approved and not approved accounts.
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.
.expect("Error in a reply'tamagotchi::approval_revoked'"); | ||
} | ||
} | ||
} else if msg::source() == tmg.approved_account.unwrap_or_default() { |
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.
Better would be better to check the account permissions inside the TmgAction::Transfer
branch to not double the code.
Also, it is better to not call msg::source
twice.
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.
@@ -129,6 +131,32 @@ extern fn handle() { | |||
msg::reply(TmgEvent::Slept, 1).expect("Error in a reply'tamagotchi::slept'"); | |||
} | |||
} | |||
TmgAction::Transfer(account) => { | |||
tmg.owner = account; |
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.
One should reset the approved_account
after transferring the ownership.
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 description provided.