Recurve Docs
Website GitHub Open app

Protocol

Governance

One governor per vault runs the proposal lifecycle: propose, veto window, watcher review, execute, settle.

One governor per vault

Governors are never shared. A shared governor would let a large holder in one fund influence the schedule of another. The governor's parameters are set in its constructor and have no setters: vetoWindow, vetoThresholdBps, watcherBlockThreshold, performanceFeeBps, feeRecipient. The only mutable thing on a governor is its agent set.

ParameterDeployedMeaning
vetoWindow24 hoursHow long depositors have to object, in seconds
vetoThresholdBps2000 (20%)Share of supply at the snapshot that kills a proposal, reached at or above
watcherBlockThreshold2Block verdicts at which execute refuses
performanceFeeBps500 (5%)Fee on profit at settle, see Fees
feeRecipientthe treasuryWhere the fee goes; the zero address means "compute, never transfer"

Values are what script/DeployMainnet.s.sol passes to the constructor.

Proposal states

enum State { None, Pending, Vetoed, Blocked, Executed, Settled }   // 0..5
TransitionHow
None → Pendingpropose
Pending → Vetoedveto reaches the threshold. Terminal.
Pending → Executedexecute after the window, with fewer blocks than the threshold
Executed → Settledsettle. Terminal.
Pending → Pendingexecute with enough blocks writes Blocked, emits, then reverts with WatchersBlocked — which undoes the write. The proposal stays Pending forever.

Blocked is in the enum but never persists. There is no cancel and no expiry. A Pending proposal whose window has closed and that will never execute — blocked, or with a price floor the market moved past — is simply left there; anyone reading the chain has to derive "abandoned" from Pending + window closed + not executed. stateOf(id) returns the state; executableAt(id) returns postedAt + vetoWindow.

Propose

propose(address target, uint256 assets, bytes callData) -> bytes32   // agents only

Calldata is committed in full before anyone decides. What watchers simulate is what will run. The id is keccak256(target, assets, callData, block.timestamp, governor), so read it from the ProposalPosted(id, target, assets, executableAt) event rather than a simulation. Two identical proposals in the same second get the same id and the second overwrites the first; the SDK and the runner never post twice in a second, but a custom agent should not either.

Nothing is validated at propose time: not that the target has code, not that assets fits the float, not the calldata. An oversized assets surfaces at execute as FloatTooLow and a failing call as ExecutionFailed; a target with no code never surfaces at all — the call succeeds and the proposal executes silently. A proposal with assets == 0 is a pure call, which is how sell and returnToVault on a strategy are posted; one with empty calldata just funds the target.

Agents and agentAdmin

Agents are a set, not a single address. A fund often wants a signal agent, an execution agent, and a fallback, and forcing them to share one key means a compromise of any is a compromise of all. isAgent(address) gates propose, execute and settle — any agent can execute or settle any agent's proposal. allAgents() and agentCount() enumerate the set.

addAgent(address agent)       // onlyAgentAdmin, reverts AlreadyAgent
removeAgent(address agent)    // onlyAgentAdmin, reverts NotAnAgent
setAgentAdmin(address admin)  // onlyAgentAdmin

The constructor's agent_ becomes both the first agent and the agentAdmin. Each change emits AgentAdded, AgentRemoved or AgentAdminUpdated. Removing an agent does not cancel its pending proposals: they stay live, still go through the window and review, and any remaining agent can execute them. Anything else would hand the admin a silent veto that bypasses the depositor vote.

Handle with care

None of the admin calls check for the zero address. setAgentAdmin(0) freezes the agent set forever, and removeAgent will happily remove the last agent, after which nothing can be proposed, executed or settled on that vault until the admin adds one back.

Veto

veto(bytes32 proposalId)   // anyone with weight at the snapshot

A holder votes against inside the window, weighted by getPastVotes one block before the proposal was posted — zero unless they had delegated by then. One veto per address. When the gathered weight reaches vetoThresholdBps of getPastTotalSupply(snapshot) — all shares, delegated or not — the proposal moves to Vetoed and can never execute. Reverts: UnknownProposal, WrongState (not Pending), VetoWindowClosed, AlreadyVetoed, NoVotingWeight. There is no vote in favour and no un-veto.

Execute

execute(bytes32 proposalId)   // agents only

After the window closes an agent calls execute. In order, it reverts with UnknownProposal, WrongState if the proposal is not Pending, VetoWindowOpen if early, and WatchersBlocked if blockCount on the registry has reached the threshold. Then it marks the proposal Executed, moves assets out through vault.fundStrategy (which can revert FloatTooLow), and if there is calldata makes a plain call to the target with the governor as msg.sender, reverting ExecutionFailed if the call does. A call to an address with no code succeeds, so a wrong target executes silently.

Settle

settle(bytes32 proposalId, uint256 returned)   // agents only, proposal must be Executed

settle books the result of a funded proposal: it marks it Settled, computes the fee on returned − assets if positive, calls vault.settleStrategy(target, returned), pulls the fee from the calling agent's own wallet to feeRecipient, and emits ProposalSettled(id, returned, fee). returned is the agent's report — the contract checks it against nothing. The assets themselves come back before this call, through the strategy's returnToVault, and that return has already closed the deployment in the vault (see Accounting): for such a strategy settle charges the fee and marks the proposal, and the vault's books do not move. Details on the fee are under Fees.

One settle per funding is the rule: fund once, unwind, return, settle the funding proposal. settle on a zero-asset follow-up proposal is allowed as well, and would charge a fee on the whole of whatever returned it is given.

For agents

Settle once the return has executed. Nothing is mispriced while it waits, but the fee is not charged and the proposal stays open until it runs.