Skip to content

Conversation

grod220
Copy link
Member

@grod220 grod220 commented Mar 7, 2025

Ensures program successfully wraps and unwraps with native mint

@grod220 grod220 force-pushed the native-program-test branch from f0b8742 to 3511119 Compare March 7, 2025 16:59
@grod220 grod220 requested a review from joncinque March 7, 2025 17:07
Copy link
Contributor

@joncinque joncinque left a 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 adding the test case!

state.pack_base();

let native_token_account = Account {
lamports: Rent::default().minimum_balance(Mint::LEN),
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this should really be Rent.minimum_balance(Account::LEN) + balance since it's a wrapped SOL account. Its lamports should be the total amount minus the rent exempt requirement to be a token account


let native_token_account = Account {
lamports: Rent::default()
.minimum_balance(Mint::LEN)
Copy link
Contributor

Choose a reason for hiding this comment

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

This still isn't a mint 😉

Suggested change
.minimum_balance(Mint::LEN)
.minimum_balance(Account::LEN)

Copy link
Member Author

Choose a reason for hiding this comment

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

Whoops! Fixing.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sometimes I get confused with the two different account types. It's spl_token_2022::state::Account::LEN right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep you got it right!

@grod220 grod220 merged commit a63aa85 into main Mar 10, 2025
7 checks passed
@grod220 grod220 deleted the native-program-test branch March 10, 2025 12:54
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