add_decimals/
events.rs

1//! Events.
2
3use anchor_lang::prelude::*;
4
5/// Called when a new token wrapper is initialized.
6#[event]
7pub struct InitEvent {
8    /// User that paid to create the token.
9    #[index]
10    pub payer: Pubkey,
11
12    /// Number of decimals of the wrapped token.
13    pub decimals: u8,
14    /// Amount to multiply by to wrap the token. Cached here for performance reasons, but equivalent to 10 **decimals
15    pub multiplier: u64,
16    /// Mint of the underlying token.
17    pub wrapper_underlying_mint: Pubkey,
18    /// Token account holding the underlying token.
19    pub wrapper_underlying_tokens: Pubkey,
20    /// Mint of the token of this wrapper.
21    pub wrapper_mint: Pubkey,
22}
23
24/// Called when tokens are deposited into the wrapper.
25#[event]
26pub struct DepositEvent {
27    /// Owner of the account that deposited.
28    #[index]
29    pub owner: Pubkey,
30    /// Underlying token mint
31    #[index]
32    pub underlying_mint: Pubkey,
33    /// Wrapped token mint
34    #[index]
35    pub wrapped_mint: Pubkey,
36    /// Amount deposited.
37    pub deposit_amount: u64,
38    /// Wrapped tokens minted.
39    pub mint_amount: u64,
40}
41
42/// Called when tokens are withdrawn from the wrapper.
43#[event]
44pub struct WithdrawEvent {
45    /// Owner of the account that withdrew.
46    #[index]
47    pub owner: Pubkey,
48    /// Underlying token mint
49    #[index]
50    pub underlying_mint: Pubkey,
51    /// Wrapped token mint
52    #[index]
53    pub wrapped_mint: Pubkey,
54    /// Amount withdrawn.
55    pub withdraw_amount: u64,
56    /// Wrapped tokens burned.
57    pub burn_amount: u64,
58    /// Wrapped tokens remaining as dust.
59    pub dust_amount: u64,
60}