Skip to content

Commit ed16136

Browse files
authored
Fix mint parsing for token22 tokens in orca whirlpool prices (#14)
1 parent f20bb11 commit ed16136

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

programs/scope/src/oracles/orca_whirlpool.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use anchor_lang::prelude::*;
2-
use anchor_spl::token::spl_token::state::Mint;
2+
use anchor_spl::token_2022::spl_token_2022::state::Mint;
33
use solana_program::program_pack::Pack;
44
use whirlpool::state::Whirlpool;
55

@@ -45,12 +45,12 @@ where
4545
// Load extra accounts
4646
let mint_a_decimals = {
4747
let mint_borrow = mint_token_a_account_info.data.borrow();
48-
Mint::unpack(&mint_borrow)?.decimals
48+
Mint::unpack_from_slice(&mint_borrow[..Mint::LEN])?.decimals
4949
};
5050

5151
let mint_b_decimals = {
5252
let mint_borrow = mint_token_b_account_info.data.borrow();
53-
Mint::unpack(&mint_borrow)?.decimals
53+
Mint::unpack_from_slice(&mint_borrow[..Mint::LEN])?.decimals
5454
};
5555

5656
// Compute price

0 commit comments

Comments
 (0)