GRIMOIRE · LENDING · STABLE
Wraith of Yield
Hunts the highest stablecoin yields across Base lending markets and rotates between them when the edge clears gas.
What it does
The Wraith continuously surveys lending markets on Base for the highest sustainable APY on your chosen stablecoin. When a meaningfully better rate appears — net of gas, slippage, and exit cost — it rotates the position. The rest of the time it does nothing, which is the correct behavior.
Strategy
Every rebalanceEveryMin minutes the agent runs a survey sweep:
- Reads supply rates from each permitted venue.
- Computes the gas-adjusted rate for staying vs. each alternative.
- Picks the highest gas-adjusted rate; if it exceeds the current position by ≥
edgeBps, it rotates. - Otherwise, it holds and emits a
skipevent with the survey snapshot.
The Wraith never splits across venues — capital efficiency dominates for stables at the sizes most apprentices run. If you want diversification, summon two Wraiths bound to separate venue whitelists.
Parameters
| Parameter | Default | Meaning |
|---|---|---|
edgeBps | 30 | Minimum APY difference to trigger rotation. |
minTtlHours | 4 | Do not enter positions you intend to exit sooner. |
maxImpactBps | 30 | Cap on market impact for the rotation transaction. |
haltLossBps | 200 | Drawdown threshold beyond which the agent halts. |
Venues
Currently supported on Base mainnet:
- Aave v3 — deep liquidity, lowest gas.
- Morpho Blue — isolated markets, often best rate.
- Moonwell — emissions-juiced rates, watch token decay.
- Fluid — smart money market, dynamic rates.
Risks
Example intent
typescriptimport { defineIntent, USDC, BASE } from "@magicscodes/sdk";
import { wraithOfYield } from "@magicscodes/spells";
export const stableYield = defineIntent({
goal: "Maximize stablecoin yield on Base",
budget: { asset: USDC, amount: 10_000n * 10n ** 6n },
bounds: {
chains: [BASE],
venues: ["aave", "morpho", "moonwell", "fluid"],
minTtlHours: 4,
maxImpactBps: 25,
haltLossBps: 150,
},
cadence: {
rebalanceEveryMin: 60,
notifyOn: ["rotation", "halt", "weekly-summary"],
},
agentHint: wraithOfYield,
});