I fixed my own dumbass issue sending 1.5sols to fanout instead hodlin… - #24
I fixed my own dumbass issue sending 1.5sols to fanout instead hodlin…#24staccDOTsol wants to merge 1 commit into
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.
This is going to drop the fanout to below rent-exempt minimum?
There was a problem hiding this comment.
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.
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.
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.
strongly dislike this name for a instruction in publicly available smart contract 😬
There was a problem hiding this comment.
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