Skip to content

Setup and permissions ​

Deploying a capital flow means installing a Capital Tree plugin and its budget, actions and optional splitters into an existing DAO.sol contract. That contract holds the funds and executes the flow. We recommend a dedicated contract for each tree.

Deploy a flow ​

  1. Choose the flow and its settings. For a buyback and burn, choose the tokens, spending rate, maximum offer and amount to buy. Choose a manager to change settings and a guardian to pause or resume the flow.
  2. Prepare the installation. Run the repository's installer against a published Capital Tree version on your network. It deploys your plugin and components, connects them, and produces the calls governance must approve.
  3. Approve the installation. Submit those calls through your DAO.sol contract's governance or multisig. Executing the proposal grants the plugin permission to run the flow.
  4. Fund the flow. Send the spending token to the DAO.sol contract. For a Stream budget, call sync() after funding; solvers can then trigger buybacks as the offer grows.

The repository installation guide provides the commands and buy-and-burn configuration.

How installation works ​

What must already exist ​

You need a governed DAO.sol contract, the network's PluginSetupProcessor, and a published Capital Tree version in a PluginRepo. A PluginRepo is an onchain catalogue of installable versions.

The DAO.sol contract must run OSx 1.3.0 or later: the plugin's balance checks rely on it rejecting a nested execute. The supplied recipes also grant TRIGGER_PERMISSION_ID to ANY_ADDR without a condition, which the contract's permission manager accepts from OSx 1.4.0. On an earlier version, the approved installation reverts when it executes.

The Capital Tree publisher deploys the shared component implementations, their registry and the setup contract, then publishes the setup as a plugin version. The registry associates names such as StreamBudget@1 with implementation addresses. Each flow reuses these implementations through separate instances with its own settings and state.

If Capital Tree has not been published on your network, follow the deployment runbook first. This shared deployment is separate from installing each client's flow.

What you supply ​

A recipe tells setup which budget, actions and splitters to create, how to connect them, and which settings and permissions to apply. The supplied buyAndBurn recipe already connects Stream, Open Fill and Burn; you supply:

InputExample
Treasury contractYour DAO.sol contract address
Stream settingsUSDC; offer grows by 1 USDC/hour, capped at 10 USDC
Purchase settingsBuy 100 MYTOKEN per fill; MYTOKEN supports burn(uint256)
ManagementManager and guardian addresses, which can be the same

Recipes.buyAndBurn turns those inputs into the complete recipe. The installer encodes it as abi.encode(recipe) for preparation. Token amounts use their smallest units.

What preparation deploys ​

Anyone can pay to prepare an installation. Install.s.sol calls the processor's prepareInstallation with the treasury address, plugin version and encoded recipe. The current script selects release 1, build 1.

The processor calls Capital Tree's setup contract. Setup looks up each component in the registry, deploys separate instances, applies their settings and connects the tree. A buy-and-burn installation creates four contracts: the plugin, Stream budget, Open Fill action and Burn action.

Preparation returns the plugin address, component addresses and permissions to grant. The installer uses these to print the approval calls. The contracts now exist; the next step authorizes them to operate through the DAO.sol contract.

The install proposal ​

Follow the OSx guide to install a plugin into an existing contract using the calls printed by the Capital Tree installer.

For a Stream budget, the installer adds writeCheckpoint() after installation to start accrual at zero when the proposal executes. Review the flow's settings, role holders and complete permission list before approval.

Roles and permissions ​

The supplied buy-and-burn recipe installs these permissions:

HolderPermission and targetEffect
PluginEXECUTE_PERMISSION_ID on DAO.sol contractSubmits the flow's calls for execution
DAO.sol contractCONFIGURE_PERMISSION_ID on pluginReplaces the flow with setFlow
Any address (ANY_ADDR)TRIGGER_PERMISSION_ID on pluginMakes triggering permissionless
ManagerSET_SETTINGS_PERMISSION_ID on Stream budget and Open FillChanges stream and purchase settings
GuardianPAUSE_PERMISSION_ID on pluginPauses or resumes runs
DAO.sol contractCHECKPOINT_PERMISSION_ID on Stream budgetStarts or restarts the stream
Open Fill actionCHECKPOINT_PERMISSION_ID on Stream budgetRestarts the stream when the demand changes

The manager controls the flow's economic terms: it can increase the spending rate, raise or remove the budget cap, and reduce the tokens required per fill. A compromised manager can therefore configure exchanges that deplete the treasury's input token for negligible return. Assign this role to governance or a trusted multisig. The supplied recipe requires a nonzero cap at installation, but the manager can subsequently remove it by setting maxBudget to zero.

These permissions apply to the configured components. Replacing the tree requires CONFIGURE_PERMISSION_ID, held by the DAO.sol contract; the manager role alone does not grant arbitrary treasury execution.

Fund and run ​

Funds belong in the DAO.sol contract. Read budget() on the plugin to find its Stream budget, then call sync() after depositing USDC. See operating the stream for later deposits and withdrawals.

For buybacks, a solver triggers each exchange. The DAO.sol contract executes the purchase and burn, and successful completion restarts the offer from zero.

Uninstalling ​

Follow the OSx uninstallation guide. For Capital Tree, supply abi.encode(originalPermissions) as the uninstall data: the complete PermissionLib.MultiTargetPermission[] returned during installation preparation.