-
Notifications
You must be signed in to change notification settings - Fork 29
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
I fixed my own dumbass issue sending 1.5sols to fanout instead hodlin… #24
base: main
Are you sure you want to change the base?
Conversation
…g account, merge plz ser
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
let hodling = ctx.accounts.holding_account.to_account_info(); | ||
let snapshot: u64 = fanout.lamports(); | ||
|
||
**fanout.lamports.borrow_mut() = 0; |
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 is going to drop the fanout to below rent-exempt minimum?
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.
afaik from my previous work with candy machine refunds it will empty the thing and solana conveniently kicks it out (can't afford rent).
It's ? a weird process?
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.
oh - good point - we don't want to destroy the fanout in this particular case.
There's a function somewhere for RENT_EXEMPT_MINIMUM or w/e?
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.
let required_lamports = ctx.accounts.rent.minimum_balance(token_manager.to_account_info().data_len());
let token_manager_lamports = token_manager.to_account_info().lamports();
if token_manager_lamports > required_lamports {
let diff = token_manager_lamports.checked_sub(required_lamports).expect("Sub error");
**token_manager.to_account_info().try_borrow_mut_lamports()? = required_lamports;
**ctx.accounts.collector.to_account_info().try_borrow_mut_lamports()? = ctx.accounts.collector.to_account_info().lamports().checked_add(diff).expect("Add error");
};
this example gets rent minimum and removes any extra lamports above that
@@ -1,2 +1,4 @@ | |||
pub mod init_for_mint; | |||
pub mod init_parent; | |||
pub mod transfer_to_hodling; |
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.
strongly dislike this name for a instruction in publicly available smart contract 😬
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.
Gm haha :) my PRs are always suggestions, some are lulzy && for the culture - this trend continues :) in a newer one I've used 'inverse_bruh' as a variable, much to @ChewingGlass dismay - and in one a long time ago @austbot had to rewrite most of my output to the CLI in favor of 'consider supporting free & open source developers'
I trust the maintainers to make calls about what's culture and what's better without the lulz
…g account, merge plz ser
gm
#23