Documentation

Draft technical specification for the proposed Commune protocol, intended for integrators, researchers and future security reviewers.

Version
0.1, draft
Interfaces
May change before audit
Standard
Proposed ERC-4626 vault
Specification only. Contract names, interfaces, timings and parameters are illustrative and unverified. No RPC endpoint or deployment address is available.

Overview

Commune proposes a pooled, non-custodial vault. Depositors receive shares that track their part of the pool. Autonomous agents allocate the pool's assets across approved lending markets and exchanges, inside limits written into the policy contract.

The proposed allocation process is designed to follow explicit rules. The intended design records each allocation and its inputs. Replayability depends on implementation and availability of the underlying data.

Proposed deposit flow

Illustrative flow only. No live app, contract address or deposit functionality is verified in this release.

  1. 1Open the app and connect a wallet.
  2. 2Pick the vault asset and the amount. The app shows the current policy and the last ten decisions before you confirm.
  3. 3Approve the token, then deposit. Shares arrive in your wallet in the same transaction.
  4. 4To exit, request a withdrawal. It settles at the end of the current epoch, then you claim the assets.

Key concepts

Pool
All deposited assets, held by the vault contract.
Share
A token representing a proportional claim on pool assets; its fraction changes as shares are minted or burned.
Venue
An approved lending market or exchange where the pool may hold assets.
Epoch
One allocation cycle. Withdrawal requests target settlement at its end; deposit timing remains a design choice.
Policy
The on-chain list of limits every agent must respect.
Reserve
The part of the pool kept idle in the vault to pay withdrawals.

Architecture

The proposed architecture contains five contract components. Asset-moving permissions and policy enforcement must be verified in implementation.

ContractWhat it doesMoves assets
CommuneVaultHolds the pool, mints and burns sharesyes
CommunePolicyStores parameters and the timelock queueno
AgentExecutorRuns agent actions after checking the policyyes
VenueAdapterOne per venue, translates deposits and withdrawalsno
DecisionLogAppend-only record of every decision and its inputsno

Epoch lifecycle

An epoch lasts six hours under the draft policy. Its steps always run in the same order.

OffsetStepDone by
+00:00Snapshot rates, utilization and depth at every venueAllocator
+00:05Score venues and compute target weightsAllocator
+00:10Match deposits against withdrawalsClearer
+00:15Move the net amount toward target weightsAllocator
+00:20Write the decision and its inputs hashRecorder
alwaysWatch oracles and venue health, pause on breachSentinel

Agent permissions

Each agent holds one role in the executor. Roles are fixed in the contract and cannot be widened by a policy change.

AgentRead venuesMove assetsPause venueChange policy
Allocatoryeswithin capsnono
Sentinelyesnoyesno
Clearernovault onlynono
Recorderyesnonono

Policy parameters

Values are stored in seconds and basis points. A change is queued with queue(key, value) and can be executed only after the timelock passes.

KeyDraft valueMeaning
epoch_length21600Six hours per epoch
max_venue_share3500Proposed cap per venue: 35% of the pool
reserve_floor1000At least 10% stays idle in the vault
oracle_halt200Pause a venue if two price sources differ by 2%
withdraw_queue_max1Target settlement within one epoch, subject to liquidity
timelock604800Seven days between queueing and executing a change

Withdrawals and netting

Withdrawal requests are paid first from new deposits arriving in the same epoch, then from the reserve, and only then from venues. Most of the time, only the difference between the two flows reaches the market.

Example epoch

Deposits
1,200,000 Withdrawals
900,000 Sent to venues
300,000

Without netting, 2,100,000 would have moved through venues. Figures are an example, in units of the vault asset.

Fees

Fees are policy parameters, so they follow the same timelock as every other limit. Rates remain unspecified; publish them before any deployment.

Deposit feeNot yet published
Withdrawal feeNot yet published
Performance fee on yieldNot yet published

Contracts

Addresses will be listed here after deployment. The proposed interface borrows ERC-4626 conventions and adds asynchronous withdrawal requests. Full standards compliance has not been verified.

ContractAddress
CommuneVaultNot yet published
CommunePolicyNot yet published
AgentExecutorNot yet published
DecisionLogNot yet published

ICommuneVault.sol, draft

interface ICommuneVault {
    function deposit(uint256 assets, address receiver) external returns (uint256 shares);
    function requestWithdraw(uint256 shares) external returns (uint256 requestId);
    function claim(uint256 requestId) external returns (uint256 assets);
    function totalAssets() external view returns (uint256);
    function currentEpoch() external view returns (uint64);
}

Events and decision log

Every agent action emits an event. The inputs hash points to the full snapshot the agent used, published alongside, so any decision can be recomputed and compared.

DecisionLog events

event Allocated(uint64 indexed epoch, address indexed venue, int256 delta, bytes32 inputsHash);
event Netted(uint64 indexed epoch, uint256 deposits, uint256 withdrawals);
event VenuePaused(address indexed venue, uint8 reason);
event PolicyQueued(bytes32 indexed key, uint256 value, uint64 eta);

Reading allocations with viem

import { createPublicClient, http, parseAbiItem } from 'viem'

const client = createPublicClient({ transport: http(RPC_URL) })

const logs = await client.getLogs({
  address: DECISION_LOG,
  event: parseAbiItem(
    'event Allocated(uint64 indexed epoch, address indexed venue, int256 delta, bytes32 inputsHash)'
  ),
  fromBlock: 0n,
})

Glossary

Basis point
One hundredth of a percent. 3500 bps is 35%.
Hurdle rate
The risk-adjusted yield a venue must beat to receive capital.
Inputs hash
A fingerprint of the market data an agent used for a decision.
Netting
Matching deposits and withdrawals so only the difference moves.
Timelock
A required wait between announcing a change and applying it.
Utilization
The share of a lending market's supply that is currently borrowed.

FAQ

Can the team move my funds?

The intended design restricts asset movement to policy-checked execution. These permissions and the seven-day timelock still require implementation and verification.

Why can't I withdraw instantly?

Withdrawals settle at the end of the epoch so they can be netted against deposits. One epoch is the target settlement window; actual settlement depends on available liquidity and system health.

What happens if a venue is exploited?

The proposed 35% venue cap limits direct exposure to one venue, not total losses or correlated risks. The Sentinel pauses the venue and no new capital goes in.

Is Commune audited?

Not yet. Audit status and known risks are kept up to date on the security page.