-
Notifications
You must be signed in to change notification settings - Fork 132
Add unwrap_lamports instruction
#857
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
base: main
Are you sure you want to change the base?
Conversation
a49dba9 to
0d937fe
Compare
|
@joncinque 🙏 Could I get a high level review of this before I mark it ready for review? |
joncinque
left a comment
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 was in such good shape that I gave it a full review. Thanks for your contribution, and for making it so complete!
Most of the comments are pretty minor, so we should be able to land this pretty quickly.
cc @febo to also give it a look since he wrote the p-token implementation
|
I've made the changes, i'll resolve the conversation with the commit references after the last comment(the one about the p-token implementation) has been resolved since it would affect most of the code. |
…te display messages
5641bcc to
210d576
Compare
joncinque
left a comment
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.
Just a couple of last bits, then this is good to on my side!
|
Can you re-run client generation and commit the results? Looks like there's a failure on that job. Otherwise, the rust legacy tests are failing at the end due to running out of space, so that shouldn't be your problem 😄 Let's get final approval from @febo too before merging. |
|
The commits have gotten quite large, would it be better to squash them? |
joncinque
left a comment
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 great, thanks for all your work! We squash on merging, but that leaves one line per commit in the final commit message, so feel free to rewrite history if you like.
Once @febo approves too, we'll merge
febo
left a comment
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 very good – left few small nits.
Co-authored-by: Fernando Otero <[email protected]>
Co-authored-by: Fernando Otero <[email protected]>
The fixes have been made, thanks for the review! |
Background
This PR adds the
unwrap_lamportsinstruction originally proposed here to the Token-2022 program. It also addresses and closes issue #773.Problem
In order to transfer out lamports from native SOL accounts, currently it is necessary to create and close ATAs or token accounts all the time.
Solution
This PR adds a new
unwrap_lamportsinstruction that allows transferring out lamports directly to any destination account. This eliminates the need for creating temporary native token accounts for the recipient.The new instruction uses the discriminator
45, which is currently unused in Token-2022.The amount to unwrap is specified as an
Option<u64>:None: the entire token balance is unwrapSome(amount): the specified amount is unwrapScope