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

Tamagotchi_nft #5

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

Tamagotchi_nft #5

wants to merge 7 commits into from

Conversation

Jackliu-miaozi
Copy link
Owner

No description provided.

.payload(TmgEvent::Transferred(1.into()));
assert!(result.contains(&log));

// let result = program.send(1, TmgAction::Approve(2.into()));

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.

Copy link
Owner Author

@Jackliu-miaozi Jackliu-miaozi Dec 19, 2023

Choose a reason for hiding this comment

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

Why am I unable to pass the test?
IMAGE 2023-12-19 10:02:43

.expect("Error in a reply'tamagotchi::approval_revoked'");
}
}
} else if msg::source() == tmg.approved_account.unwrap_or_default() {

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.

Copy link
Owner Author

Choose a reason for hiding this comment

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

image

@@ -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;

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.

Copy link
Owner Author

Choose a reason for hiding this comment

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

image

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