rust_test/
lib.rs

1use anchor_lang::prelude::*;
2use anchor_spl::token::{self, Burn, Mint, MintTo, Token, TokenAccount, Transfer};
3
4declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
5
6#[program]
7pub mod rust_test {
8    use super::*;
9
10    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
11        Ok(())
12    }
13
14    pub fn swap(ctx: Context<Swap>, amount_in: u64, minimum_amount_out: u64) -> Result<()> {
15        Ok(())
16    }
17}
18
19#[derive(Accounts)]
20pub struct Initialize {}
21
22#[derive(Accounts)]
23pub struct Swap<'info> {
24    /// CHECK: This is not dangerous because we don't read or write from this account
25    pub authority: AccountInfo<'info>,
26    /// CHECK: This is not dangerous because we don't read or write from this account
27    #[account(signer)]
28    pub user_transfer_authority: AccountInfo<'info>,
29    #[account(mut)]
30    pub source_info: Box<Account<'info, TokenAccount>>,
31    #[account(mut)]
32    pub destination_info: Box<Account<'info, TokenAccount>>,
33    #[account(mut)]
34    pub swap_source: Box<Account<'info, TokenAccount>>,
35    #[account(mut)]
36    pub swap_destination: Box<Account<'info, TokenAccount>>,
37    #[account(mut)]
38    pub pool_mint: Box<Account<'info, Mint>>,
39    #[account(mut)]
40    pub fee_account: Box<Account<'info, TokenAccount>>,
41    pub token_program: Program<'info, Token>,
42    // pub host_fee_account: AccountInfo<'info>,
43    /// CHECK: This is not dangerous because we don't read or write from this account
44    pub pyth_account: AccountInfo<'info>,
45    /// CHECK: This is not dangerous because we don't read or write from this account
46    pub pyth_pc_account: AccountInfo<'info>,
47}