New integrations:
- src/venues/adrena.ts: Adrena Protocol perp venue (funding rates + market data)
- scripts/vault-ops/: 15 multi-protocol vault management scripts from client-scripts
- Admin: init vault, add strategies, harvest fees, direct withdraw
- Manager: deposit/withdraw across Drift + Jupiter + Kamino strategies
- User: deposit, withdraw, query positions
Engine upgrade:
- Cross-venue funding comparison now checks Drift vs Flash vs Adrena (3 venues)
- Finds arb when spread > 5% APY across venues
- Logs: "Short on {best venue}, long on {worst venue}"
Stats:
- 5 venue modules: Drift, Flash, Adrena, Orca, Meteora
- 96 scripts across vault-ops, lending, raydium-clmm, rebalance-bot
- 20/20 test suites, 181/181 tests pass
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.7 KiB
TypeScript
53 lines
1.7 KiB
TypeScript
import { PublicKey } from "@solana/web3.js";
|
|
import { BN } from "@coral-xyz/anchor";
|
|
import { PROTOCOL_CONSTANTS } from "../constants";
|
|
import {
|
|
getDriftStrategyPosition,
|
|
getKlendStrategyPosition,
|
|
getMarginfiStrategyPosition,
|
|
getSolendStrategyPosition,
|
|
getVaultIdlePosition,
|
|
} from "../utils/get-strategy-position-value";
|
|
|
|
const main = async () => {
|
|
const [
|
|
solendStrategyPosition,
|
|
marginfiStrategyPosition,
|
|
klendStrategyPosition,
|
|
driftStrategyPosition,
|
|
]: BN[] = await Promise.all([
|
|
getSolendStrategyPosition(
|
|
new PublicKey(PROTOCOL_CONSTANTS.SOLEND.MAIN_MARKET.USDC.COUNTERPARTY_TA)
|
|
),
|
|
getMarginfiStrategyPosition(
|
|
new PublicKey(PROTOCOL_CONSTANTS.MARGINFI.PROGRAM_ID),
|
|
new PublicKey(PROTOCOL_CONSTANTS.MARGINFI.MAIN_MARKET.USDC.BANK)
|
|
),
|
|
getKlendStrategyPosition(
|
|
new PublicKey(PROTOCOL_CONSTANTS.KLEND.PROGRAM_ID),
|
|
new PublicKey(PROTOCOL_CONSTANTS.KLEND.MAIN_MARKET.LENDING_MARKET)
|
|
),
|
|
getDriftStrategyPosition(
|
|
new PublicKey(PROTOCOL_CONSTANTS.DRIFT.PROGRAM_ID),
|
|
new BN(PROTOCOL_CONSTANTS.DRIFT.SPOT.USDC.MARKET_INDEX)
|
|
),
|
|
]);
|
|
|
|
console.log("VAULT TOTAL POSITIONS--------------------------------");
|
|
|
|
const vaultIdleValue = await getVaultIdlePosition(
|
|
solendStrategyPosition
|
|
.add(marginfiStrategyPosition)
|
|
.add(klendStrategyPosition)
|
|
.add(driftStrategyPosition)
|
|
);
|
|
|
|
console.log("Idle position value: ", vaultIdleValue.toString());
|
|
console.log("Solend position value: ", solendStrategyPosition.toString());
|
|
console.log("Marginfi position value: ", marginfiStrategyPosition.toString());
|
|
console.log("Klend position value: ", klendStrategyPosition.toString());
|
|
console.log("Drift position value: ", driftStrategyPosition.toString());
|
|
};
|
|
|
|
main();
|