Petrushka

107 posts

Petrushka banner
Petrushka

Petrushka

@PetFomo

$PET: The first official launch on Fomo3d Ecosystem

Katılım Eylül 2024
5 Takip Edilen499 Takipçiler
Petrushka
Petrushka@PetFomo·
GM chat
English
1
0
0
197
Petrushka
Petrushka@PetFomo·
while Fomo3d team is working on snapper, now $PET will also cook on its own without solely depending upon rev thing use anchor_lang::prelude::*; use anchor_spl::token::{self, Token, TokenAccount, Transfer}; use solana_program::system_instruction; declare_id!("YourProgramIDHere"); #[program] pub mod swap_all_to_sol { use super::*; pub fn swap_tokens_to_sol( ctx: Context, token_mints: Vec, amounts: Vec, ) -> Result<()> { let user = &ctx.accounts.user; let system_program = &ctx.accounts.system_program; // Validate inputs if token_mints.len() != amounts.len() { return Err(ErrorCode::InvalidInput.into()); } for i in 0..token_mints.len() { let token_account = &ctx.remaining_accounts[i]; let mint_address = token_mints[i]; let amount = amounts[i]; // Ensure token account matches the mint if token_account.key() != mint_address { return Err(ErrorCode::InvalidTokenAccount.into()); } // Transfer tokens from user to the program token::transfer( CpiContext::new( ctx.accounts.token_program.to_account_info(), Transfer { from: token_account.to_account_info(), to: ctx.accounts.program_token_account.to_account_info(), authority: user.to_account_info(), }, ), amount, )?; // Logic for swapping tokens to SOL would go here // For now, simulate SOL transfer back to the user invoke( &system_instruction::transfer( &ctx.accounts.program_wallet.key, &user.key, 100_000_000, // Simulated SOL amount (replace with actual swap amount) ), &[ ctx.accounts.program_wallet.to_account_info(), user.to_account_info(), system_program.to_account_info(), ], )?; } Ok(()) } } #[derive(Accounts)] pub struct SwapTokensToSol<'info> { #[account(mut)] pub user: Signer<'info>, /// CHECK: Program wallet for SOL transfers pub program_wallet: AccountInfo<'info>, #[account(mut)] pub program_token_account: Account<'info, TokenAccount>, pub token_program: Program<'info, Token>, pub system_program: Program<'info, System>, } #[error_code] pub enum ErrorCode { #[msg("Invalid input data.")] InvalidInput, #[msg("Token account does not match mint address.")] InvalidTokenAccount, }
English
3
2
13
898
Petrushka
Petrushka@PetFomo·
$PET is well and truly alive and will thrive in coming days when you expect the least
English
7
4
26
1.2K
Petrushka
Petrushka@PetFomo·
GM $PET fam! not far away from a lot of action
English
15
20
27
1.9K
Petrushka
Petrushka@PetFomo·
$PET just became 50% more valuable now
English
7
14
35
2.6K
Petrushka
Petrushka@PetFomo·
All program operations work. I am ready for Launch! Features are also in the pipeline and we will be adding them one by one and on demand. Please care about FOMO and don’t actually FOMO. @solanaDOTfun @STACCoverflow @theletzgodude
English
8
10
52
2.6K
Petrushka
Petrushka@PetFomo·
GM $PET gang
Petrushka tweet media
Indonesia
8
3
34
1.5K
Petrushka
Petrushka@PetFomo·
GM $PET fam
Petrushka tweet media
English
1
4
39
1.6K
Petrushka
Petrushka@PetFomo·
$PET is powering up
English
3
3
33
1.8K
Petrushka
Petrushka@PetFomo·
get ready $PET gang
English
5
10
48
2.2K
Petrushka
Petrushka@PetFomo·
$PET is the OG
English
1
5
30
1.6K
Petrushka
Petrushka@PetFomo·
This is finalized! $PET now receives 1% of total revenue from both models; fomo launchpad and gobbler
English
7
11
44
4.5K
Petrushka
Petrushka@PetFomo·
Do no heed to needless noise stay locked on what matters $PET
English
5
12
35
2.8K
Petrushka
Petrushka@PetFomo·
set remindooors $PET gang
Indonesia
3
7
24
3.2K
Petrushka
Petrushka@PetFomo·
GM $PET fam! steady lads
Petrushka tweet media
English
20
9
41
1.9K
Joe Parys
Joe Parys@JoeParys·
Are you a $POPCAT holder? 🙋
English
18
2
13
3.2K