1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
use anchor_lang::prelude::*;
use anchor_spl::token::{self, Burn, Mint, MintTo, Token, TokenAccount, Transfer};

declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");

#[program]
pub mod rust_test {
    use super::*;

    pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
        Ok(())
    }

    pub fn swap(ctx: Context<Swap>, amount_in: u64, minimum_amount_out: u64) -> Result<()> {
        Ok(())
    }
}

#[derive(Accounts)]
pub struct Initialize {}

#[derive(Accounts)]
pub struct Swap<'info> {
    /// CHECK: This is not dangerous because we don't read or write from this account
    pub authority: AccountInfo<'info>,
    /// CHECK: This is not dangerous because we don't read or write from this account
    #[account(signer)]
    pub user_transfer_authority: AccountInfo<'info>,
    #[account(mut)]
    pub source_info: Box<Account<'info, TokenAccount>>,
    #[account(mut)]
    pub destination_info: Box<Account<'info, TokenAccount>>,
    #[account(mut)]
    pub swap_source: Box<Account<'info, TokenAccount>>,
    #[account(mut)]
    pub swap_destination: Box<Account<'info, TokenAccount>>,
    #[account(mut)]
    pub pool_mint: Box<Account<'info, Mint>>,
    #[account(mut)]
    pub fee_account: Box<Account<'info, TokenAccount>>,
    pub token_program: Program<'info, Token>,
    // pub host_fee_account: AccountInfo<'info>,
    /// CHECK: This is not dangerous because we don't read or write from this account
    pub pyth_account: AccountInfo<'info>,
    /// CHECK: This is not dangerous because we don't read or write from this account
    pub pyth_pc_account: AccountInfo<'info>,
}