22: Add dummy AnchorIdlJupiterPerpsCustodyDecoder.decodeCurrentCumulativeInterestRate() method
This commit is contained in:
+21
-3
@@ -4,6 +4,7 @@ import com.r35157.libs.codec.Base58Codec;
|
|||||||
import com.r35157.libs.codec.impl.ref.Base58CodecImpl;
|
import com.r35157.libs.codec.impl.ref.Base58CodecImpl;
|
||||||
import com.r35157.libs.solana.SolanaAccountInfo;
|
import com.r35157.libs.solana.SolanaAccountInfo;
|
||||||
|
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.util.Base64;
|
import java.util.Base64;
|
||||||
|
|
||||||
class AnchorIdlJupiterPerpsCustodyDecoder {
|
class AnchorIdlJupiterPerpsCustodyDecoder {
|
||||||
@@ -22,6 +23,10 @@ class AnchorIdlJupiterPerpsCustodyDecoder {
|
|||||||
return readPublicKey(data, MINT_OFFSET);
|
return readPublicKey(data, MINT_OFFSET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BigInteger decodeCurrentCumulativeInterestRate(SolanaAccountInfo custodyAccountInfo) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private ΩSPLMintAddressΩ readPublicKey(
|
private ΩSPLMintAddressΩ readPublicKey(
|
||||||
byte[] data,
|
byte[] data,
|
||||||
int offset
|
int offset
|
||||||
@@ -42,9 +47,22 @@ class AnchorIdlJupiterPerpsCustodyDecoder {
|
|||||||
private static final int ANCHOR_DISCRIMINATOR_LENGTH = 8;
|
private static final int ANCHOR_DISCRIMINATOR_LENGTH = 8;
|
||||||
private static final int PUBLIC_KEY_LENGTH = 32;
|
private static final int PUBLIC_KEY_LENGTH = 32;
|
||||||
|
|
||||||
private static final int MINT_OFFSET =
|
// Offsets:
|
||||||
ANCHOR_DISCRIMINATOR_LENGTH
|
// 8 discriminator
|
||||||
+ PUBLIC_KEY_LENGTH; // pool
|
// +32 pool
|
||||||
|
// +32 mint
|
||||||
|
// +32 token_account
|
||||||
|
// +1 decimals
|
||||||
|
// +1 is_stable
|
||||||
|
// +45 oracle
|
||||||
|
// +48 pricing
|
||||||
|
// +7 permissions
|
||||||
|
// +8 target_ratio_bps
|
||||||
|
// +48 assets
|
||||||
|
|
||||||
|
private static final int MINT_OFFSET = ANCHOR_DISCRIMINATOR_LENGTH + PUBLIC_KEY_LENGTH;
|
||||||
|
private static final int FUNDING_RATE_STATE_OFFSET = 262;
|
||||||
|
private static final int CUMULATIVE_INTEREST_RATE_OFFSET = FUNDING_RATE_STATE_OFFSET;
|
||||||
|
|
||||||
private static final Base58Codec base58 = new Base58CodecImpl();
|
private static final Base58Codec base58 = new Base58CodecImpl();
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user