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
48
49
50
51
52
53
54
55
56
57
58
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/codama-idl/codama>
//!
use borsh::BorshDeserialize;
use borsh::BorshSerialize;
use solana_pubkey::Pubkey;
/// Emitted by when a swap is performed for a pool
#[derive(BorshSerialize, BorshDeserialize, Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct SwapEvent {
/// The pool for which token_0 and token_1 were swapped
#[cfg_attr(
feature = "serde",
serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
)]
pub pool_state: Pubkey,
/// The address that initiated the swap call, and that received the callback
#[cfg_attr(
feature = "serde",
serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
)]
pub sender: Pubkey,
/// The payer token account in zero for one swaps, or the recipient token account
/// in one for zero swaps
#[cfg_attr(
feature = "serde",
serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
)]
pub token_account0: Pubkey,
/// The payer token account in one for zero swaps, or the recipient token account
/// in zero for one swaps
#[cfg_attr(
feature = "serde",
serde(with = "serde_with::As::<serde_with::DisplayFromStr>")
)]
pub token_account1: Pubkey,
/// The real delta amount of the token_0 of the pool or user
pub amount0: u64,
/// The transfer fee charged by the withheld_amount of the token_0
pub transfer_fee0: u64,
/// The real delta of the token_1 of the pool or user
pub amount1: u64,
/// The transfer fee charged by the withheld_amount of the token_1
pub transfer_fee1: u64,
/// if true, amount_0 is negtive and amount_1 is positive
pub zero_for_one: bool,
/// The sqrt(price) of the pool after the swap, as a Q64.64
pub sqrt_price_x64: u128,
/// The liquidity of the pool after the swap
pub liquidity: u128,
/// The log base 1.0001 of price of the pool after the swap
pub tick: i32,
}