Executive Summary
Two complementary on-chain engines unify liquidity forecasting and tax-aware execution into one auditable pipeline. A predictive-liquidity contract maintains, per account, a liquidity profile — an emergency buffer, a rolling 30-day predicted need, and an auto-rebalance threshold — fed by an authorized AI-prediction role that pushes both an aggregate 30-day forecast and granular per-day predictions (each carrying a recurring-obligation flag and a confidence score). An authorized keeper role checks actual balance against required balance and, on shortfall, schedules a rebalance whose execution is split into a number of batches that scales with the shortfall's dollar size — more batches for larger amounts — specifically to reduce market impact.
A companion tax-optimized liquidator tracks per-position tax lots (cost basis, acquisition date, long/short-term status) and, when liquidity is needed, computes whether borrowing against the position or selling it is cheaper by comparing the estimated capital-gains tax cost against the annualized cost of borrowing; when selling is chosen, it applies a configurable lot-selection strategy — FIFO, LIFO, HIFO, specific-lot, or tax-loss-harvest — while enforcing an on-chain wash-sale lockout period per token.
Problem Statement
Treasury liquidity management is typically manual, executed in single large conversions with no systematic batch-sizing discipline, and entirely disconnected from tax-lot accounting. By the time a human applies FIFO or HIFO guidance from off-chain tax software, the trade generating the tax event has usually already happened.
Why Existing Solutions Are Insufficient
- Manual treasury rebalancing: a human decides when and how much to convert, with no systematic batch-sizing discipline and typically no tax-lot awareness at all.
- Naive keeper bots: execute an entire shortfall in a single transaction, maximizing market impact and slippage regardless of trade size.
- Off-chain tax software: disconnected from the execution venue — FIFO/HIFO guidance arrives after the trade has already been placed.
- Generic DCA/TWAP tools: spread execution over time but carry no concept of cost basis, holding period, or wash-sale rules whatsoever.
Technical Architecture
| Field | Purpose |
|---|---|
| emergencyBuffer | Minimum stablecoin balance always maintained |
| predictedNeeds30Day | AI-engine-updated rolling 30-day forecast |
| autoRebalanceThreshold | Trigger threshold for automatic rebalancing |
| predictionConfidence | 0–100 confidence score attached to the latest forecast |
| preferredStrategy | Default liquidation strategy for this account |
Prediction Pipeline
An authorized AI-prediction role updates both a rolling 30-day aggregate forecast with a confidence score, and a per-day granular prediction ledger that flags detected recurring obligations — giving the rebalancer both a headline number and the day-level texture behind it.
Batch-Scaled Rebalancing
An authorized keeper computes the shortfall between an account's required balance (predicted need plus emergency buffer) and its current balance, and schedules execution in a number of batches determined by the shortfall's size:
| Shortfall | Batches |
|---|---|
| Under $1,000 | 1 |
| $1,000 – $10,000 | 4 |
| $10,000 – $100,000 | 8 |
| $100,000 and above | 12 |
Each batch executes only after an interval computed by dividing the total execution window by the batch count has elapsed, enforced on-chain so a batch cannot be executed ahead of its scheduled slot.
Tax-Lot-Aware Liquidation
Each acquired position is recorded as a tax lot carrying its cost basis, cost basis per unit, acquisition timestamp, and a long-term flag (held over 365 days). Given a liquidity target, the liquidator compares the estimated tax cost of selling against the annualized cost of borrowing the same amount and computes a break-even point in months; when tax-loss opportunities exceed a materiality threshold, it recommends harvesting those losses first; otherwise it prioritizes long-term lots for their lower tax rate, applying whichever lot-selection strategy — FIFO, LIFO, HIFO, or a specific lot — the account has selected.
Wash-Sale Enforcement
A loss-harvesting sale of a given token is rejected on-chain if that same token was sold within the configured wash-sale lockout period of the current attempt, closing a gap that off-chain, after-the-fact tax software cannot enforce at the moment of the trade.
Prior Art Differentiation
| Approach | Liquidity Prediction | Market-Impact Batching | Tax-Lot Awareness | On-Chain Wash-Sale Rule |
|---|---|---|---|---|
| Robo-advisor tax-loss harvesting | No | No | Yes, off-chain and custodial | Off-chain only |
| Generic DeFi keeper/TWAP bots | No | Time-based only | No | No |
| Manual treasury operations | Human judgment | Ad hoc | Rarely systematic | Not enforced |
| JIL Sovereign | AI-fed, confidence-scored, on-chain | Amount-scaled batch count | FIFO/LIFO/HIFO/specific-lot, on-chain | Enforced at the contract level |