Protocol
Strategies
PortfolioStrategy is the only target a proposal needs: a fixed token set, one swap per call, and no way to send value anywhere but the vault.
Why a strategy contract
RecurveGovernor.execute forwards arbitrary calldata to an arbitrary target. The
veto and watcher review are real, but they are social defences on a hot path. A strategy
contract narrows the surface to something a reviewer can check in seconds: the token set is
fixed at construction, the only outbound call is a swap between two tokens already in that set
on a router fixed at construction, and the only place value can go afterwards is the vault.
An agent proposing against it cannot invent a transfer, cannot reach a token nobody approved,
and cannot redirect the exit.
Shape
constructor(
address vault_, address governor_, IERC20 baseAsset_, ISwapRouter router_,
address[] tokens_, uint24[] feeTiers_, uint256 maxSlippageBps_
)
| Fixed at construction | Meaning |
|---|---|
vault | The only address returnToVault pays |
governor | The only caller of anything that moves tokens |
baseAsset | The vault's asset; every leg is bought from and sold back into it |
router | Uniswap V3 SwapRouter02 |
tokens, feeTier[token] | The basket and the pool tier per leg. Storage rather than immutable, but with no setters, so fixed for life |
maxSlippageBps | Cap on how far below the stated quote a floor may sit; at most 1000 (10%) |
The constructor rejects an empty basket (NoTokens), a duplicate
(DuplicateToken), a mismatched tier list (WeightCountMismatch) and a
slippage cap over 10% (SlippageTooHigh). The Recurve Fund's strategy is a one-token basket,
NVDA, on the 0.05% tier (500) with a 3% cap.
The four calls
All four are onlyGovernor, which means each one is a proposal that clears its
own veto window before it runs.
buy (address token, uint256 amountIn, uint256 minAmountOut, uint256 quotedOut) -> amountOut
sell(address token, uint256 amountIn, uint256 minAmountOut, uint256 quotedOut) -> amountOut
returnToVault() -> amount
setWeights(uint256[] bps)
buyspendsamountInof the base asset the vault just funded it with ontokenthroughexactInputSingleon the leg's tier, withminAmountOutas the hard floor. Approves the router for exactlyamountInand clears the approval after. EmitsRebalanced(token, amountIn, amountOut).sellis the mirror image, leg back into base asset. Same event.returnToVaulthands the strategy's entire base-asset balance back through the vault'sreturnFromStrategy, which closes the strategy's deployment in the same transaction, and emitsLiquidated(amount). With nothing to send it sends nothing, closes nothing, and still emits the event with zero. Legs are never moved: sell them first. Once a return has run the vault counts nothing that is still held here, until it comes back.setWeightsrecords target weights that must sum to exactly 10,000 bps. They are a declaration, not a constraint — nothing inbuyorsellreads them.
The floor
floor = quotedOut * (10_000 - maxSlippageBps) / 10_000
require(quotedOut != 0 && minAmountOut >= floor) // else SlippageTooHigh
The agent supplies both numbers because it has the price context; the contract refuses a
floor looser than maxSlippageBps below the stated quote so a careless or hostile
floor cannot hand value to a sandwich. quotedOut is not checked against any
quoter or oracle — it is the agent's statement, and the reviewer's job is to compare it with
the market. A quote of zero is refused outright.
Because a proposal executes a day after it is quoted, the runner
writes quote × (1 − tolerance) as the stated quote rather than the live one, and
the strategy's own cap then applies below that. A watcher reads the effective floor straight
off the calldata: minAmountOut.
A cycle in proposals
| Step | Proposal | What moves |
|---|---|---|
| 1 | propose(strategy, X, buy(...)) | execute funds the strategy with X and buys the leg in the same transaction |
| 2 | propose(strategy, 0, sell(...)) | The leg becomes base asset, still inside the strategy |
| 3 | propose(strategy, 0, returnToVault()) | Base asset returns to the vault; Liquidated says how much |
| 4 | settle(id of step 1, amount from Liquidated) | Books the result, pulls the fee |
Steps 1–3 each wait a full veto window, so a round trip is about three days on the scripted
24-hour window. A queued exit that needs the position unwound waits at least two more windows
(sell, then return) — about two days, three if the buy has not executed yet.
holdings() returns the strategy's base balance and every leg's raw balance —
balances only, never a valuation: a strategy that priced itself would be the thing deciding
what the vault is worth.
Deployed
The Recurve Fund's strategy is PortfolioStrategyV2 on Robinhood Chain: basket
[NVDA], tier 500, 3% cap, against Uniswap's official SwapRouter02. Its
address is under Contracts, the router and the pool under
Deployment.