Skip to main content

percli_program/instructions/
events.rs

1use anchor_lang::prelude::*;
2
3#[event]
4pub struct MarketInitialized {
5    pub authority: Pubkey,
6    pub mint: Pubkey,
7    pub oracle: Pubkey,
8    pub matcher: Pubkey,
9    pub init_slot: u64,
10    pub init_oracle_price: u64,
11}
12
13#[event]
14pub struct Deposited {
15    pub user: Pubkey,
16    pub account_idx: u16,
17    pub amount: u64,
18}
19
20#[event]
21pub struct Withdrawn {
22    pub user: Pubkey,
23    pub account_idx: u16,
24    pub amount: u64,
25}
26
27#[event]
28pub struct TradeExecuted {
29    pub matcher: Pubkey,
30    pub account_a: u16,
31    pub account_b: u16,
32    pub size_q: i128,
33    pub exec_price: u64,
34}
35
36#[event]
37pub struct Cranked {
38    pub cranker: Pubkey,
39    pub oracle_price: u64,
40    pub slot: u64,
41}
42
43#[event]
44pub struct Liquidated {
45    pub liquidator: Pubkey,
46    pub account_idx: u16,
47    pub liquidated: bool,
48}
49
50#[event]
51pub struct Settled {
52    pub user: Pubkey,
53    pub account_idx: u16,
54}
55
56#[event]
57pub struct AccountClosed {
58    pub user: Pubkey,
59    pub account_idx: u16,
60}
61
62#[event]
63pub struct AccountReclaimed {
64    pub reclaimer: Pubkey,
65    pub account_idx: u16,
66}
67
68#[event]
69pub struct InsuranceWithdrawn {
70    pub authority: Pubkey,
71    pub amount: u64,
72}
73
74#[event]
75pub struct InsuranceToppedUp {
76    pub depositor: Pubkey,
77    pub amount: u64,
78}
79
80#[event]
81pub struct FeeCreditsDeposited {
82    pub user: Pubkey,
83    pub account_idx: u16,
84    pub amount: u64,
85}
86
87#[event]
88pub struct PnlConverted {
89    pub user: Pubkey,
90    pub account_idx: u16,
91    pub x_req: u64,
92}
93
94#[event]
95pub struct MarketAccrued {
96    pub signer: Pubkey,
97    pub oracle_price: u64,
98    pub slot: u64,
99}
100
101#[event]
102pub struct MatcherUpdated {
103    pub authority: Pubkey,
104    pub old_matcher: Pubkey,
105    pub new_matcher: Pubkey,
106}
107
108#[event]
109pub struct OracleUpdated {
110    pub authority: Pubkey,
111    pub old_oracle: Pubkey,
112    pub new_oracle: Pubkey,
113}