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>
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();
|