Skip to content

Commit 36b7bb3

Browse files
outsmartchadclaude
andcommitted
fix: correct Raydium CPMM decimal offsets (331/332 not 323/324)
The CPMM pool layout has an observation_key Pubkey (32 bytes) at offset 296-328 that was missing from the layout documentation. This shifted the decimal offsets from 323/324 to 331/332: 328: auth_bump, 329: status, 330: lp_mint_decimals, 331: mint_0_decimals, 332: mint_1_decimals Verified on mainnet with SOL/USELESS CPMM pool via gRPC + live buy test. Co-authored-by: Claude Code <noreply@anthropic.com>
1 parent 6f47a39 commit 36b7bb3

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "outsmart",
3-
"version": "2.0.0-alpha.12",
3+
"version": "2.0.0-alpha.13",
44
"description": "Solana trading CLI — 18 DEX adapters, 12 TX landing providers.",
55
"engines": {
66
"node": ">=20.0.0"

src/dex/percolator/grpc-keeper.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ function decodeCpmmPoolInfo(data: Buffer): VaultBasedPoolInfo {
161161
vault1: new PublicKey(data.slice(104, 136)),
162162
mint0: new PublicKey(data.slice(168, 200)),
163163
mint1: new PublicKey(data.slice(200, 232)),
164-
decimals0: data.readUInt8(323),
165-
decimals1: data.readUInt8(324),
164+
decimals0: data.readUInt8(331),
165+
decimals1: data.readUInt8(332),
166166
};
167167
}
168168

src/dex/percolator/ws-keeper.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,14 @@ const WSOL_MINT = "So11111111111111111111111111111111111111112";
137137
* 136..168 lp_mint
138138
* 168..200 token_0_mint
139139
* 200..232 token_1_mint
140-
* ...
141-
* 323 mint_0_decimals (u8)
142-
* 324 mint_1_decimals (u8)
140+
* 232..264 token_0_program
141+
* 264..296 token_1_program
142+
* 296..328 observation_key
143+
* 328 auth_bump (u8)
144+
* 329 status (u8)
145+
* 330 lp_mint_decimals (u8)
146+
* 331 mint_0_decimals (u8)
147+
* 332 mint_1_decimals (u8)
143148
*/
144149
function decodeCpmmPoolInfo(data: Buffer): VaultBasedPoolInfo {
145150
return {
@@ -148,8 +153,8 @@ function decodeCpmmPoolInfo(data: Buffer): VaultBasedPoolInfo {
148153
vault1: new PublicKey(data.slice(104, 136)),
149154
mint0: new PublicKey(data.slice(168, 200)),
150155
mint1: new PublicKey(data.slice(200, 232)),
151-
decimals0: data.readUInt8(323),
152-
decimals1: data.readUInt8(324),
156+
decimals0: data.readUInt8(331),
157+
decimals1: data.readUInt8(332),
153158
};
154159
}
155160

0 commit comments

Comments
 (0)