Keeper Bot
Monitors fund state and triggers permissionless operations automatically. Any wallet can submit these transactions — the keeper simply automates the process.
Responsibilities
Keystone Alpha Fund
Trigger rebalance when the 7-day cooldown has elapsed
Deploy idle USDC to Marginfi lending
Keystone Neutral Fund
Service the withdrawal queue (unwind position + deliver USDC)
Deploy idle capital into the standard basis trade when funding is positive
Deploy reverse basis trade (borrow jitoSOL from Kamino + long SOL-PERP) when funding is negative
Settle Jupiter Perps position (read carry delta, update NAV)
Close standard basis on negative funding or NAV drawdown guard breach
Close reverse basis when funding recovers
Keystone Defense Fund
Refresh NAV every
min_settle_interval(default 4 hours) viasettleLend idle USDC via Marginfi when no deployment conditions are active
Open long SOL-PERP on Jupiter Perps when funding rates turn sufficiently negative
Settle open Jupiter Perps position funding carry (
settle_funding)Close position when funding recovers above threshold
Running
Environment Variables
Requirements
Funded wallet (~0.01 SOL for transaction fees)
Reliable RPC endpoint
Always-on process or cloud function
Keeper Cycle — Keystone Defense Fund
Auto mode executes in this priority order:
1
min_settle_interval elapsed
settle — refresh NAV and share price
2
Position open and funding settle interval elapsed
settle_funding — collect carry delta
3
Idle USDC > 0, no position, lending not active
lend_idle_usdc — deposit to Marginfi
4
Funding sufficiently negative (below min_negative_funding_threshold)
open_long_position — enter negative funding capture
5
Position open, funding recovered above threshold
close_long_position — exit and return to baseline
Environment variables:
NAV-only crank (permissionless):
Keeper Cycle — Keystone Neutral Fund
Each cycle evaluates conditions in priority order and executes the first applicable action:
1
Pending withdrawals > 0 and position open
unwind_position → claim_withdrawal
2
Pending withdrawals > 0 and position closed
claim_withdrawal
3
NAV drawdown guard triggered
emergency_close_position
4
Negative funding threshold met (standard basis open)
emergency_close_position
5
Reverse basis open, funding recovered
close_reverse
6
No position open, N consecutive negative periods
deploy_reverse — borrow jitoSOL from Kamino + open SOL-PERP long
7
No position open, USDC idle ≥ min_deploy, positive funding
deploy_capital — split USDC: collateral → Jupiter Perps short; remainder → jitoSOL
8
Standard basis open, settle interval elapsed
settle_funding
9
Health factor below threshold
adjust_position
Withdrawal Queue
deploy_capital and park_capital both require total_pending_withdrawals == 0 — the re-deploy step in step 4 is only reachable after all claim_withdrawal calls complete. Users receive USDC within one keeper cycle (≤ 5 minutes). NAV is locked at the time of the withdraw() call.
Jupiter Referral (Recommended)
Every fund swap routes through Jupiter. By registering a referral account, the keeper operator earns a fee share on every swap — paid by Jupiter from its existing fee, not charged to depositors.
One-time setup:
At startup, the keeper logs whether referral is active:
Fees accumulate in the fee token accounts and are claimable anytime at referral.jup.ag.
Keeper Rewards
Keepers currently pay their own transaction fees (~0.0001 SOL per transaction). On-chain keeper incentives are planned for a future release.
Last updated