-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
token-2022: Execute transfer hook during confidential transfer #6098
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.
Sorry it took a while to catch up on some of the transfer hook interface. All the changes look fine to me. Thanks for fixing the variables names as well. I think the convention of using u64::MAX
is reasonable to keep things as simple as possible.
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.
Looks good to me! You mentioned you'll want to rebase this once the PRs go in for fixing #6064, but that should be a pretty minimal change here.
Pull request has been modified.
I added a new helper for this since |
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.
Lgtm, just some up-to-you nits!
Pull request has been modified.
Problem
If a mint is configured with a transfer hook, the program is meant to be called during all transfers. This doesn't happen during confidential transfers though.
Summary of changes
The program changes are pretty simple: just execute the transfer hook, as in a normal transfer. This comes with a few other changes:
destination_token_account_info
->destination_account_info
for consistencyThe biggest issue is that we don't know the amount transferred when calling the hook. I decided to go with
u64::MAX
as a convention, rather than adding another instruction to the interface. Transfer hooks are complicated enough as is, so forcing programs to implement another instruction seems like a bad idea. Let me know if you have better ideas!