1
- use {
2
- super :: MeteoraDlmmDecoder ,
3
- crate :: PROGRAM_ID ,
4
- carbon_core:: { account:: AccountDecoder , deserialize:: CarbonDeserialize } ,
5
- } ;
1
+ use carbon_core:: account:: AccountDecoder ;
2
+ use carbon_core:: deserialize:: CarbonDeserialize ;
3
+
4
+ use crate :: PROGRAM_ID ;
5
+
6
+ use super :: MeteoraDlmmDecoder ;
6
7
pub mod bin_array;
7
8
pub mod bin_array_bitmap_extension;
9
+ pub mod claim_fee_operator;
8
10
pub mod lb_pair;
9
11
pub mod oracle;
10
12
pub mod position;
11
13
pub mod position_v2;
12
14
pub mod preset_parameter;
15
+ pub mod preset_parameter2;
16
+ pub mod token_badge;
13
17
18
+ #[ allow( clippy:: large_enum_variant) ]
14
19
pub enum MeteoraDlmmAccount {
15
- BinArrayBitmapExtension ( Box < bin_array_bitmap_extension:: BinArrayBitmapExtension > ) ,
16
- BinArray ( Box < bin_array:: BinArray > ) ,
17
- LbPair ( Box < lb_pair:: LbPair > ) ,
20
+ BinArrayBitmapExtension ( bin_array_bitmap_extension:: BinArrayBitmapExtension ) ,
21
+ BinArray ( bin_array:: BinArray ) ,
22
+ ClaimFeeOperator ( claim_fee_operator:: ClaimFeeOperator ) ,
23
+ LbPair ( lb_pair:: LbPair ) ,
18
24
Oracle ( oracle:: Oracle ) ,
19
- Position ( Box < position:: Position > ) ,
20
- PositionV2 ( Box < position_v2:: PositionV2 > ) ,
25
+ Position ( position:: Position ) ,
26
+ PositionV2 ( position_v2:: PositionV2 ) ,
27
+ PresetParameter2 ( preset_parameter2:: PresetParameter2 ) ,
21
28
PresetParameter ( preset_parameter:: PresetParameter ) ,
29
+ TokenBadge ( token_badge:: TokenBadge ) ,
22
30
}
23
31
24
32
impl AccountDecoder < ' _ > for MeteoraDlmmDecoder {
@@ -38,7 +46,7 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
38
46
{
39
47
return Some ( carbon_core:: account:: DecodedAccount {
40
48
lamports : account. lamports ,
41
- data : MeteoraDlmmAccount :: BinArrayBitmapExtension ( Box :: new ( decoded_account) ) ,
49
+ data : MeteoraDlmmAccount :: BinArrayBitmapExtension ( decoded_account) ,
42
50
owner : account. owner ,
43
51
executable : account. executable ,
44
52
rent_epoch : account. rent_epoch ,
@@ -48,7 +56,19 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
48
56
if let Some ( decoded_account) = bin_array:: BinArray :: deserialize ( account. data . as_slice ( ) ) {
49
57
return Some ( carbon_core:: account:: DecodedAccount {
50
58
lamports : account. lamports ,
51
- data : MeteoraDlmmAccount :: BinArray ( Box :: new ( decoded_account) ) ,
59
+ data : MeteoraDlmmAccount :: BinArray ( decoded_account) ,
60
+ owner : account. owner ,
61
+ executable : account. executable ,
62
+ rent_epoch : account. rent_epoch ,
63
+ } ) ;
64
+ }
65
+
66
+ if let Some ( decoded_account) =
67
+ claim_fee_operator:: ClaimFeeOperator :: deserialize ( account. data . as_slice ( ) )
68
+ {
69
+ return Some ( carbon_core:: account:: DecodedAccount {
70
+ lamports : account. lamports ,
71
+ data : MeteoraDlmmAccount :: ClaimFeeOperator ( decoded_account) ,
52
72
owner : account. owner ,
53
73
executable : account. executable ,
54
74
rent_epoch : account. rent_epoch ,
@@ -58,7 +78,7 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
58
78
if let Some ( decoded_account) = lb_pair:: LbPair :: deserialize ( account. data . as_slice ( ) ) {
59
79
return Some ( carbon_core:: account:: DecodedAccount {
60
80
lamports : account. lamports ,
61
- data : MeteoraDlmmAccount :: LbPair ( Box :: new ( decoded_account) ) ,
81
+ data : MeteoraDlmmAccount :: LbPair ( decoded_account) ,
62
82
owner : account. owner ,
63
83
executable : account. executable ,
64
84
rent_epoch : account. rent_epoch ,
@@ -78,7 +98,7 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
78
98
if let Some ( decoded_account) = position:: Position :: deserialize ( account. data . as_slice ( ) ) {
79
99
return Some ( carbon_core:: account:: DecodedAccount {
80
100
lamports : account. lamports ,
81
- data : MeteoraDlmmAccount :: Position ( Box :: new ( decoded_account) ) ,
101
+ data : MeteoraDlmmAccount :: Position ( decoded_account) ,
82
102
owner : account. owner ,
83
103
executable : account. executable ,
84
104
rent_epoch : account. rent_epoch ,
@@ -89,7 +109,19 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
89
109
{
90
110
return Some ( carbon_core:: account:: DecodedAccount {
91
111
lamports : account. lamports ,
92
- data : MeteoraDlmmAccount :: PositionV2 ( Box :: new ( decoded_account) ) ,
112
+ data : MeteoraDlmmAccount :: PositionV2 ( decoded_account) ,
113
+ owner : account. owner ,
114
+ executable : account. executable ,
115
+ rent_epoch : account. rent_epoch ,
116
+ } ) ;
117
+ }
118
+
119
+ if let Some ( decoded_account) =
120
+ preset_parameter2:: PresetParameter2 :: deserialize ( account. data . as_slice ( ) )
121
+ {
122
+ return Some ( carbon_core:: account:: DecodedAccount {
123
+ lamports : account. lamports ,
124
+ data : MeteoraDlmmAccount :: PresetParameter2 ( decoded_account) ,
93
125
owner : account. owner ,
94
126
executable : account. executable ,
95
127
rent_epoch : account. rent_epoch ,
@@ -108,6 +140,17 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
108
140
} ) ;
109
141
}
110
142
143
+ if let Some ( decoded_account) = token_badge:: TokenBadge :: deserialize ( account. data . as_slice ( ) )
144
+ {
145
+ return Some ( carbon_core:: account:: DecodedAccount {
146
+ lamports : account. lamports ,
147
+ data : MeteoraDlmmAccount :: TokenBadge ( decoded_account) ,
148
+ owner : account. owner ,
149
+ executable : account. executable ,
150
+ rent_epoch : account. rent_epoch ,
151
+ } ) ;
152
+ }
153
+
111
154
None
112
155
}
113
156
}
0 commit comments