On-chain (programs/): - driftbear_custom_adaptor (1,058 lines, deployed devnet) - drift_vaults (15,243 lines) - raydium_clmm (20,909 lines) - drift_rs_sdk (55,940 lines) - ctoken_market_program + mock (673 lines) New TypeScript modules (ported from 19 plugins): - JIT maker (sniper+shotgun from jit-proxy) - Filler bot (DLOB fills from keeper-bots-v2) - FloatingMaker (slot-based from keeper-bots-v2) - Executor upgrades (tx simulation, Jito bundles, ALTs) - Event stream (WebSocket + Yellowstone gRPC) - DLOB orderbook + price impact + funding TWAP - Ranger Data API (funding arbs, liquidation signals) - Ranger SOR (full API: quotes, withdraw, deposit collateral) - Sanctum LST (swap, APY, best LST selection) - Lulo lending aggregator - Pyth oracle cross-validation - Helius DAS API + smart priority fees - Flash Trade, Orca, Meteora, deBridge venue clients - Voltr vault strategy client - Drift insurance fund staking - Adaptor CPI client for on-chain program - Raydium LP strategy All wired into strategy engine runCycle(): - 11 data sources called every cycle - 3 background execution modules (JIT, Filler, FloatingMaker) - Multi-venue funding rate comparison - Lending yield optimizer across protocols - LP yield scanning (Orca + Meteora) - Auto-deploy idle capital to best lending protocol - Pyth oracle cross-validation - Realistic backtest mode (0.30% round-trip costs) Tests: 20/20 suites, 181/181 pass Build: zero TypeScript errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
77 lines
1.9 KiB
TypeScript
77 lines
1.9 KiB
TypeScript
import {
|
|
Connection,
|
|
Keypair,
|
|
PublicKey,
|
|
TransactionInstruction,
|
|
} from "@solana/web3.js";
|
|
import * as fs from "fs";
|
|
import { sendAndConfirmOptimisedTx, setupTokenAccount } from "../utils/helper";
|
|
import {
|
|
adminFilePath,
|
|
heliusRpcUrl,
|
|
managerFilePath,
|
|
vaultAddress,
|
|
} from "../variables";
|
|
import { VoltrClient } from "@voltr/vault-sdk";
|
|
import { PROTOCOL_ADMIN } from "../constants/global";
|
|
|
|
const adminKpFile = fs.readFileSync(adminFilePath, "utf-8");
|
|
const adminKpData = JSON.parse(adminKpFile);
|
|
const adminSecret = Uint8Array.from(adminKpData);
|
|
const adminKp = Keypair.fromSecretKey(adminSecret);
|
|
const admin = adminKp.publicKey;
|
|
|
|
const managerKpFile = fs.readFileSync(managerFilePath, "utf-8");
|
|
const managerKpData = JSON.parse(managerKpFile);
|
|
const managerSecret = Uint8Array.from(managerKpData);
|
|
const managerKp = Keypair.fromSecretKey(managerSecret);
|
|
const manager = managerKp.publicKey;
|
|
|
|
const protocolAdmin = new PublicKey(PROTOCOL_ADMIN);
|
|
|
|
const vault = new PublicKey(vaultAddress);
|
|
|
|
const connection = new Connection(heliusRpcUrl);
|
|
const vc = new VoltrClient(connection);
|
|
|
|
const harvestFeeHandler = async () => {
|
|
let transactionIxs: TransactionInstruction[] = [];
|
|
const lpMint = vc.findVaultLpMint(vault);
|
|
|
|
await setupTokenAccount(connection, admin, lpMint, admin, transactionIxs);
|
|
|
|
await setupTokenAccount(connection, admin, lpMint, manager, transactionIxs);
|
|
|
|
await setupTokenAccount(
|
|
connection,
|
|
admin,
|
|
lpMint,
|
|
protocolAdmin,
|
|
transactionIxs
|
|
);
|
|
|
|
const harvestFeeIx = await vc.createHarvestFeeIx({
|
|
harvester: admin,
|
|
vaultManager: manager,
|
|
vaultAdmin: admin,
|
|
protocolAdmin,
|
|
vault,
|
|
});
|
|
|
|
transactionIxs.push(harvestFeeIx);
|
|
|
|
const txSig = await sendAndConfirmOptimisedTx(
|
|
transactionIxs,
|
|
heliusRpcUrl,
|
|
adminKp
|
|
);
|
|
|
|
console.log(`Harvested fee with signature: ${txSig}`);
|
|
};
|
|
|
|
const main = async () => {
|
|
await harvestFeeHandler();
|
|
};
|
|
|
|
main();
|