Documents
The contracts
The vault and its factory: the roles, the fee, the budgets and the exits.
4. Contracts (contracts/, Solidity 0.8.26 + Foundry + OpenZeppelin)
FundVault.sol — minimal-proxy clone; vault = ERC-20 share token (6 decimals)
- Initialization grants the ONLY approvals ever given: pUSD → both exchanges + Offramp; USDC.e → Onramp; ConditionalTokens → both exchanges + NegRiskAdapter. No owner, no pause, no upgrade path. The implementation constructor bricks itself; clones start fresh.
- Trading authority =
isValidSignature(ERC-1271 + ERC-7739). A signature counts only if:- the ERC-7739 TypedDataSign envelope binds to the exact digest validated;
- the app domain separator is whitelisted — exactly three: CTF Exchange V2, NegRisk CTF
Exchange V2,
ClobAuthDomain(API login; cannot move funds). This whitelist is the trust boundary — without it a manager signature could authorize e.g. an EIP-2612/EIP-3009 pull on a 1271-aware token and drain the vault; - the inner ECDSA signer is the manager or an on-chain-registered delegate (
isSigner).
- Deposits —
depositPUSD(amount, quote, sig, minShares);depositUSDCe(...)wraps to pUSD via the Onramp inside the call. Priced by an EIP-712Quote{op, account, maxAmount, sharePriceMicro, nonce, issuedAt, deadline}on the vault's own domain (no cross-vault replay). The vault hands the quote, its digest and its own cash, registered-token and supply figures to the factory, which checks the signatures, the binding and the nonce, the price floor and the issuance budget (authorizeDeposit). First deposit needs no quote ($1.00/share, min $1) and first sweeps anything left in the empty vault to the protocol treasury.minSharesenforces the investor's slippage bound on-chain. A deposit takes only what its whole shares cost, rounded up,ceil(shares × price / 1e6); the rest of the amount asked stays with the depositor (PM-139, the contract review's C1). The factory charges and bounds that cost, the quote'smaxAmountincluded. TheDepositevent'samountis the cost taken, not the amount asked; the ABI is unchanged. Before PM-139 a deposit kept the whole amount while its shares were rounded down, so in a fund made of a few costly share units the rounding went to the other holders. Entry fee (PM-162). Every deposit, the first included, paysENTRY_FEE_BPS = 100(1%) on top of its cost: the shares are priced onamount × 10_000 / 10_100, rounded down, and the vault takescost + fee, wherefee = ceil(cost × 1%), socost + fee ≤ amountalways. The fee goes in pUSD to the protocol treasury before the shares are minted (a USDC.e deposit wrapscost + fee, then sends the fee), andEntryFee(investor, fee)is emitted besideDeposit, whose signature is unchanged. The factory is handedcost, so the budgets bind only what enters the vault. redeemInKind(shares)— the trustless exit. Burns shares for a pro-rata slice of pUSD + USDC.e + every registered position (ERC-1155 batch transfer). No quote, no platform, no manager cooperation needed.redeemCash(shares, quote, sig, minPayout, unwrapToUSDCe)— instant cash exit at the quoted price, bounded by vault pUSD; optional Offramp unwrap to USDC.e. The factory checks the quote, the price ceiling and the cash budget (authorizeCashExit); an exit that would leave no cash while other shares remain reverts.sweepResidual()— while the supply is zero, anyone can send leftover pUSD, USDC.e and registered positions to the vault's protocol treasury; impossible while any share exists.- Permissionless keepers —
redeemResolvedCTF/redeemResolvedNegRiskconvert resolved winning positions to collateral;wrapIdleUSDCere-wraps idle USDC.e. Balance-before/ -after accounting ensures proceeds always land in the vault. - Fees —
harvest()mints 1.25%/yr of share supply (MANAGEMENT_FEE_BPS = 125; the protocol treasury's part isPROTOCOL_CUT_BPS = 2000, a fifth: 1% to the manager, 0.25% to the treasury), called automatically at the start of every deposit and both redemptions. Pie inflation, not NAV-based dollars; no oracle involved. The fraction of a share that rounding leaves unminted, and the protocol's fraction of the split, carry to the next harvest, so frequent harvests lose nothing to rounding (PM-119). They still compound very slightly, since each harvest accrues on the fee shares already minted. - Position registry — CTF token ids auto-register in
onERC1155Receivedonly when the operator is a Polymarket contract (blocks dust-registration griefing). Capped at 128; a full registry reverts incoming settlement untilprunePositions— deliberate fail-closed behavior so the in-kind basket always covers every held position.registerPositionlets the manager adopt donations.
FundVaultFactory.sol
Deploys the implementation in its constructor and createVault(name, symbol, manager, salt)
clones deterministically (CREATE2, salt namespaced by deployer to prevent squatting).
Anyone can call — managers deploy from their own browser wallet and pay gas (~cents).
Exchange domain separators are read live (ERC-5267) at deploy time, never hardcoded.
The factory is also every vault's quote guard (PM-117):
- Signer set and threshold. A quote needs
thresholdsignatures from distinct signers in ascending address order (1 for the pilot). - Price envelope. Deposit price ≥ cash per share; cash-exit price ≤ (cash + registered tokens at $1) per share, both after the fee accrual.
- Budgets, per vault. A deposit is charged
max(1, v_hi / v_hi′)against the issuance budget and a cash exitmax(1, v_lo / v_lo′)against the cash budget, wherev_lo = cash / supplyandv_hi = (cash + tokens) / supply. Budgets refill only with time (1% a day), up to 1 / (1 − 2%); charges round up, budgets down. Together they bound a quiet holder's loss by1 − (1 − b)(1 − g)e^{−(r_b + r_g)t}(PM-116 §6). - Governance. The owner or the guardian can instantly revoke a signer, pause, raise the
threshold, cut settings (clamping, never refilling) and cancel a pending change. Adding a
signer, lowering the threshold, raising or restoring settings, unpausing, replacing the
guardian and renouncing ownership (which needs a guardian) wait 72 h via
proposeChange/executeChange; the guardian cannot cancel its own replacement. Settings never exceed the fixed maxima (2% at once, 1% a day). setProtocolTreasury(owner) affects new vaults only — live vaults snapshot theirs at initialize.
Source
This page is the project's own document, shown as it is: ARCHITECTURE.md, section 4.