Skip to content

Commit 716cd14

Browse files
committed
feat: update Meteora DLMM to v0.9.0
1 parent 2218f8c commit 716cd14

File tree

103 files changed

+9002
-172
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+9002
-172
lines changed

decoders/meteora-dlmm-decoder/meteora_dlmm.json

Lines changed: 7369 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
use {
2-
super::super::types::*,
3-
carbon_core::{borsh, CarbonDeserialize},
4-
};
1+
use super::super::types::*;
52

6-
#[derive(CarbonDeserialize, Debug)]
3+
use carbon_core::{borsh, CarbonDeserialize};
4+
5+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
76
#[carbon(discriminator = "0x5c8e5cdc059446b5")]
87
pub struct BinArray {
98
pub index: i64,
109
pub version: u8,
1110
pub padding: [u8; 7],
1211
pub lb_pair: solana_pubkey::Pubkey,
12+
#[serde(with = "serde_big_array::BigArray")]
1313
pub bins: [Bin; 70],
1414
}

decoders/meteora-dlmm-decoder/src/accounts/bin_array_bitmap_extension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use carbon_core::{borsh, CarbonDeserialize};
22

3-
#[derive(CarbonDeserialize, Debug)]
3+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
44
#[carbon(discriminator = "0x506f7c7137ed1205")]
55
pub struct BinArrayBitmapExtension {
66
pub lb_pair: solana_pubkey::Pubkey,
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
use carbon_core::{borsh, CarbonDeserialize};
2+
3+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
4+
#[carbon(discriminator = "0xa630865622c8bc96")]
5+
pub struct ClaimFeeOperator {
6+
pub operator: solana_pubkey::Pubkey,
7+
#[serde(with = "serde_big_array::BigArray")]
8+
pub padding: [u8; 128],
9+
}

decoders/meteora-dlmm-decoder/src/accounts/lb_pair.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use {
2-
super::super::types::*,
3-
carbon_core::{borsh, CarbonDeserialize},
4-
};
1+
use super::super::types::*;
52

6-
#[derive(CarbonDeserialize, Debug)]
3+
use carbon_core::{borsh, CarbonDeserialize};
4+
5+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
76
#[carbon(discriminator = "0x210b3162b565b10d")]
87
pub struct LbPair {
98
pub parameters: StaticParameters,
@@ -17,7 +16,7 @@ pub struct LbPair {
1716
pub require_base_factor_seed: u8,
1817
pub base_factor_seed: [u8; 2],
1918
pub activation_type: u8,
20-
pub padding0: u8,
19+
pub creator_pool_on_off_control: u8,
2120
pub token_x_mint: solana_pubkey::Pubkey,
2221
pub token_y_mint: solana_pubkey::Pubkey,
2322
pub reserve_x: solana_pubkey::Pubkey,
@@ -36,5 +35,7 @@ pub struct LbPair {
3635
pub padding3: [u8; 8],
3736
pub padding4: u64,
3837
pub creator: solana_pubkey::Pubkey,
39-
pub reserved: [u8; 24],
38+
pub token_mint_x_program_flag: u8,
39+
pub token_mint_y_program_flag: u8,
40+
pub reserved: [u8; 22],
4041
}

decoders/meteora-dlmm-decoder/src/accounts/mod.rs

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
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;
67
pub mod bin_array;
78
pub mod bin_array_bitmap_extension;
9+
pub mod claim_fee_operator;
810
pub mod lb_pair;
911
pub mod oracle;
1012
pub mod position;
1113
pub mod position_v2;
1214
pub mod preset_parameter;
15+
pub mod preset_parameter2;
16+
pub mod token_badge;
1317

18+
#[allow(clippy::large_enum_variant)]
1419
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),
1824
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),
2128
PresetParameter(preset_parameter::PresetParameter),
29+
TokenBadge(token_badge::TokenBadge),
2230
}
2331

2432
impl AccountDecoder<'_> for MeteoraDlmmDecoder {
@@ -38,7 +46,7 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
3846
{
3947
return Some(carbon_core::account::DecodedAccount {
4048
lamports: account.lamports,
41-
data: MeteoraDlmmAccount::BinArrayBitmapExtension(Box::new(decoded_account)),
49+
data: MeteoraDlmmAccount::BinArrayBitmapExtension(decoded_account),
4250
owner: account.owner,
4351
executable: account.executable,
4452
rent_epoch: account.rent_epoch,
@@ -48,7 +56,19 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
4856
if let Some(decoded_account) = bin_array::BinArray::deserialize(account.data.as_slice()) {
4957
return Some(carbon_core::account::DecodedAccount {
5058
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),
5272
owner: account.owner,
5373
executable: account.executable,
5474
rent_epoch: account.rent_epoch,
@@ -58,7 +78,7 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
5878
if let Some(decoded_account) = lb_pair::LbPair::deserialize(account.data.as_slice()) {
5979
return Some(carbon_core::account::DecodedAccount {
6080
lamports: account.lamports,
61-
data: MeteoraDlmmAccount::LbPair(Box::new(decoded_account)),
81+
data: MeteoraDlmmAccount::LbPair(decoded_account),
6282
owner: account.owner,
6383
executable: account.executable,
6484
rent_epoch: account.rent_epoch,
@@ -78,7 +98,7 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
7898
if let Some(decoded_account) = position::Position::deserialize(account.data.as_slice()) {
7999
return Some(carbon_core::account::DecodedAccount {
80100
lamports: account.lamports,
81-
data: MeteoraDlmmAccount::Position(Box::new(decoded_account)),
101+
data: MeteoraDlmmAccount::Position(decoded_account),
82102
owner: account.owner,
83103
executable: account.executable,
84104
rent_epoch: account.rent_epoch,
@@ -89,7 +109,19 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
89109
{
90110
return Some(carbon_core::account::DecodedAccount {
91111
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),
93125
owner: account.owner,
94126
executable: account.executable,
95127
rent_epoch: account.rent_epoch,
@@ -108,6 +140,17 @@ impl AccountDecoder<'_> for MeteoraDlmmDecoder {
108140
});
109141
}
110142

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+
111154
None
112155
}
113156
}

decoders/meteora-dlmm-decoder/src/accounts/oracle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use carbon_core::{borsh, CarbonDeserialize};
22

3-
#[derive(CarbonDeserialize, Debug)]
3+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
44
#[carbon(discriminator = "0x8bc283b38cb3e5f4")]
55
pub struct Oracle {
66
pub idx: u64,
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
use {
2-
super::super::types::*,
3-
carbon_core::{borsh, CarbonDeserialize},
4-
};
1+
use super::super::types::*;
52

6-
#[derive(CarbonDeserialize, Debug)]
3+
use carbon_core::{borsh, CarbonDeserialize};
4+
5+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
76
#[carbon(discriminator = "0xaabc8fe47a40f7d0")]
87
pub struct Position {
98
pub lb_pair: solana_pubkey::Pubkey,
109
pub owner: solana_pubkey::Pubkey,
10+
#[serde(with = "serde_big_array::BigArray")]
1111
pub liquidity_shares: [u64; 70],
12+
#[serde(with = "serde_big_array::BigArray")]
1213
pub reward_infos: [UserRewardInfo; 70],
14+
#[serde(with = "serde_big_array::BigArray")]
1315
pub fee_infos: [FeeInfo; 70],
1416
pub lower_bin_id: i32,
1517
pub upper_bin_id: i32,
1618
pub last_updated_at: i64,
1719
pub total_claimed_fee_x_amount: u64,
1820
pub total_claimed_fee_y_amount: u64,
1921
pub total_claimed_rewards: [u64; 2],
22+
#[serde(with = "serde_big_array::BigArray")]
2023
pub reserved: [u8; 160],
2124
}
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1-
use {
2-
super::super::types::*,
3-
carbon_core::{borsh, CarbonDeserialize},
4-
};
1+
use super::super::types::*;
52

6-
#[derive(CarbonDeserialize, Debug)]
3+
use carbon_core::{borsh, CarbonDeserialize};
4+
5+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
76
#[carbon(discriminator = "0x75b0d4c7f5b485b6")]
87
pub struct PositionV2 {
98
pub lb_pair: solana_pubkey::Pubkey,
109
pub owner: solana_pubkey::Pubkey,
10+
#[serde(with = "serde_big_array::BigArray")]
1111
pub liquidity_shares: [u128; 70],
12+
#[serde(with = "serde_big_array::BigArray")]
1213
pub reward_infos: [UserRewardInfo; 70],
14+
#[serde(with = "serde_big_array::BigArray")]
1315
pub fee_infos: [FeeInfo; 70],
1416
pub lower_bin_id: i32,
1517
pub upper_bin_id: i32,
@@ -21,5 +23,6 @@ pub struct PositionV2 {
2123
pub lock_release_point: u64,
2224
pub padding0: u8,
2325
pub fee_owner: solana_pubkey::Pubkey,
26+
#[serde(with = "serde_big_array::BigArray")]
2427
pub reserved: [u8; 87],
2528
}

decoders/meteora-dlmm-decoder/src/accounts/preset_parameter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use carbon_core::{borsh, CarbonDeserialize};
22

3-
#[derive(CarbonDeserialize, Debug)]
3+
#[derive(CarbonDeserialize, Debug, serde::Serialize, serde::Deserialize)]
44
#[carbon(discriminator = "0xf23ef422b5703aaa")]
55
pub struct PresetParameter {
66
pub bin_step: u16,

0 commit comments

Comments
 (0)