Friktion
Search…
Volt #03 & #04

Initialize

const ulMint = friktionSDK.net.mints.USDC;
const ulNormFactor = Math.pow(
10,
(await getMint(connection, ulMint)).decimals
); // 10^9 for SOL
const { instruction: initializeIx, voltKey } =
await VoltSDK.initializeEntropyVolt({
sdk: friktionSDK,
adminKey: user,
vaultName: "testEntropyVolt" + user.toString().slice(0, 5),
depositMint: ulMint,
capacity: new BN(10000 * ulNormFactor), // 10000 USDC
individualCapacity: new BN(100 * ulNormFactor), // 100 USDC
whitelistTokenMintKey: friktionSDK.net.MM_TOKEN_MINT,
serumProgramId: friktionSDK.net.SERUM_DEX_PROGRAM_ID,
entropyProgramId: ENTROPY_PROGRAM_ID,
entropyGroupKey: friktionSDK.net.ENTROPY_GROUP,
// perp market keys (https://github.com/Friktion-Labs/entropy-client/blob/main/src/ids.json)
// this is the BTC^2 perp market
targetPerpMarket: new PublicKey(
"HTrVoLyfjS3WbvTdSemAHdtHYv4MYPg3WdXuqxKDGNsu"
),
// BTC perp market
spotPerpMarket: new PublicKey(
"9GE4Q4RR6jTXZSGMf9GK4purKxSPVgRCVM7WLqxi8k8i"
),
// BTC spot market (https://github.com/blockworks-foundation/mango-client-v3/blob/b3e9387b98c3ea7167ac497de863e1e53b9c9984/src/ids.json#L359)
spotMarket: new PublicKey("A8YFbxQYFVqKZaoYJLLUVcQiWP7G2MeEgW5wsAQgMvFw"),
targetLeverageRatio: -1.0,
targetLeverageLenience: 0.1,
shouldHedge: true,
hedgeWithSpot: false,
targetHedgeRatio: -2.0,
targetHedgeLenience: 0.05,
rebalancingLenience: 0.1,
requiredBasisFromOracle: 0.0,
exitEarlyRatio: 0.0,
});
​
const tx = new Transaction().add(initializeIx);
const txResult = await provider.sendAndConfirm(tx);
Your volt can now be loaded!
const voltSdk = await friktionSDK.loadEntropyVoltSDKByKey(voltKey)

Position Statistics

await voltSdk.printPositionStats()
​
//// EXAMPLE OUTPUT (on volt = JPmAHJBocDi1539s2wfqiGzVTZd4quYJgx5dg6Ysq2k) ////
// EntropyAccount VKH3Tf7yAgxU5JKkuU7HLmrYCvnGM2LKsPL9bvgRHq3
// Owner: 3A9M3rMmAg6SZmNgMuZ1sinriFaTdS9Fmj6c54w1vDG4
// Equity: 844154.9184
// Token: Net Balance / Base In Orders / Quote In Orders
// USDC: 807314.3099 / 0.0000 / 0.0000
// Perps:
// Market: Base Pos / Quote Pos (* base) / Quote Pos (full) / Unsettled Funding / Health / Oracle Px
// BTC^2-PERP: -955.9672 / BTC^2-PERP: -412362.5179 / 882855.2056 / -50.2011 / 429156033755.5390 / 431.3563
// BTC-PERP: 41.4813 / BTC-PERP: 861530.0975 / -1295182.1767 / -11.5552 / -476728584081.2330 / 20769.1200
// BTC_1D_IV-PERP: 0.0000 / BTC_1D_IV-PERP: 0.0000 / 0.0000 / 0.0000 / 0.0000 / 78.8100

Rebalancing

For more information on how we rebalance Volt #4 (basis yield), check out our automation script (twapEntropyVolt.ts)
Copy link
On this page
Initialize
Position Statistics
Rebalancing