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
2.2 KiB
Rust
77 lines
2.2 KiB
Rust
use anchor_lang::prelude::*;
|
|
|
|
use drift::error::ErrorCode as DriftErrorCode;
|
|
|
|
pub type VaultResult<T = ()> = std::result::Result<T, ErrorCode>;
|
|
|
|
#[error_code]
|
|
#[derive(PartialEq, Eq)]
|
|
pub enum ErrorCode {
|
|
#[msg("Default")]
|
|
Default,
|
|
#[msg("InvalidVaultRebase")]
|
|
InvalidVaultRebase,
|
|
#[msg("InvalidVaultSharesDetected")]
|
|
InvalidVaultSharesDetected,
|
|
#[msg("CannotWithdrawBeforeRedeemPeriodEnd")]
|
|
CannotWithdrawBeforeRedeemPeriodEnd,
|
|
#[msg("InvalidVaultWithdraw")]
|
|
InvalidVaultWithdraw,
|
|
#[msg("InsufficientVaultShares")]
|
|
InsufficientVaultShares,
|
|
#[msg("InvalidVaultWithdrawSize")]
|
|
InvalidVaultWithdrawSize,
|
|
#[msg("InvalidVaultForNewDepositors")]
|
|
InvalidVaultForNewDepositors,
|
|
#[msg("VaultWithdrawRequestInProgress")]
|
|
VaultWithdrawRequestInProgress,
|
|
#[msg("VaultIsAtCapacity")]
|
|
VaultIsAtCapacity,
|
|
#[msg("InvalidVaultDepositorInitialization")]
|
|
InvalidVaultDepositorInitialization,
|
|
#[msg("DelegateNotAvailableForLiquidation")]
|
|
DelegateNotAvailableForLiquidation,
|
|
#[msg("InvalidEquityValue")]
|
|
InvalidEquityValue,
|
|
#[msg("VaultInLiquidation")]
|
|
VaultInLiquidation,
|
|
#[msg("DriftError")]
|
|
DriftError,
|
|
#[msg("InvalidVaultInitialization")]
|
|
InvalidVaultInitialization,
|
|
#[msg("InvalidVaultUpdate")]
|
|
InvalidVaultUpdate,
|
|
#[msg("PermissionedVault")]
|
|
PermissionedVault,
|
|
#[msg("WithdrawInProgress")]
|
|
WithdrawInProgress,
|
|
#[msg("SharesPercentTooLarge")]
|
|
SharesPercentTooLarge,
|
|
#[msg("InvalidVaultDeposit")]
|
|
InvalidVaultDeposit,
|
|
#[msg("OngoingLiquidation")]
|
|
OngoingLiquidation,
|
|
#[msg("VaultProtocolMissing")]
|
|
VaultProtocolMissing,
|
|
#[msg("InvalidTokenization")]
|
|
InvalidTokenization,
|
|
#[msg("InvalidFuelDistributionMode")]
|
|
InvalidFuelDistributionMode,
|
|
#[msg("FeeUpdateMissing")]
|
|
FeeUpdateMissing,
|
|
#[msg("InvalidFeeUpdateStatus")]
|
|
InvalidFeeUpdateStatus,
|
|
#[msg("InvalidVaultClass")]
|
|
InvalidVaultClass,
|
|
#[msg("InvalidBorrowAmount")]
|
|
InvalidBorrowAmount,
|
|
#[msg("InvalidRepayAmount")]
|
|
InvalidRepayAmount,
|
|
}
|
|
|
|
impl From<DriftErrorCode> for ErrorCode {
|
|
fn from(_: DriftErrorCode) -> Self {
|
|
ErrorCode::DriftError
|
|
}
|
|
}
|