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

lang: Close account macro #270

Closed
armaniferrante opened this issue May 10, 2021 · 0 comments
Closed

lang: Close account macro #270

armaniferrante opened this issue May 10, 2021 · 0 comments
Labels

Comments

@armaniferrante
Copy link
Member

armaniferrante commented May 10, 2021

We can add a macro to close account to recover rent exemption SOL. One example of this might look like

#[derive(Accounts)]
struct MyAccounts<'info> {
  #[account(close = sol_destination)]
  account: AccountInfo<'info>,
  sol_destination: AccountInfo<'info>,
}

Where the account discriminator is set to a special Closed flag, so that it cannot be safely deserialized again, and where the account's remaining balance get's sent to the sol_destination account.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant