TSV V1 is a Solidity protocol that gates Uniswap V4 stock pools by participant credentials, issuer permissions, pool lifecycle and per-security daily volume quotas. The implementation lives in src/v1/. This README describes that code; design proposals and dated review reports are indexed separately in docs/README.md.
TSV uses three asset identities:
| Symbol | Meaning | On-chain role |
|---|---|---|
| W | Issuer permissioned stock adapter created by the configured Permissions Adapter Factory | Stock currency held by a V4 pool |
| U | Original stock token wrapped by W | User-facing settlement and canonical legal-share conversion input |
| Q | Registered quote ERC-20 | Quote currency held by the pool and used for user settlement |
Every registered pool is a single W/Q V4 pool with exactly one registered stock side and one registered quote side. The Router accepts exact-input requests. On the stock side, the user pays or receives U while the PoolManager settles W through the issuer adapter; Q remains the quote settlement asset. The Registry ties every W for one U to a single security ID and legal-share adapter, so all pools for that security consume the same daily quota.
flowchart LR
User[Participant] -->|Caller-bound swap| Router[TSVSwapRouterV1]
User --> Adapter[Approved adapter]
Adapter --> Router
User --> LP[TSVLPManagerV1]
Router --> PM[Uniswap V4 PoolManager]
LP --> PM
PM --> Hook[TSVHookV1]
Hook --> Registry[TSVRegistryV1]
Hook --> Ledger[TSVVolumeLedgerV1]
Router --> Registry
LP --> Registry
Registry --> Factory[Permissions Adapter Factory]
Registry --> SBT[Participant SBT]
W[W permissioned stock] --- U[U original stock]
Pool[Pool currency pair: W/Q] --> W
Pool --> Q[Q quote token]
The code has five TSV business contracts: TSVRegistryV1, TSVVolumeLedgerV1, TSVHookV1, TSVSwapRouterV1, and TSVLPManagerV1. There is no DataInbox or Governance Anchor in the current source tree. Operators call Registry and Ledger role-gated setters directly; upgrades use UUPS authorization checked against roles held by the Registry.
- Admission: the Registry verifies W provenance and metadata against the configured Factory, binds W to U and a security, validates the legal-share adapter, and separately registers Q. A pool can only be registered through the LP Manager and must contain one W and one Q.
- Participant access: the Registry combines permissions from the participant's registered SBT identities. The Router requires
SWAP_ALLOWED; ordinary position actions requireLIQUIDITY_ALLOWEDfor both executor and position owner. W also applies its issuer-sideswappingEnabledand allowlist checks. - Swap execution: participants can call the Router's caller-bound exact-input entry point, or an approved adapter can call an adapter entry point. The caller-bound path uses the caller as participant, payer, and recipient; both paths retain SBT, issuer, pool, pause, and quota checks. The requested input must be fully spent and the minimum output must be met.
- Volume limits:
setQuotawrites absolute WAD values by security and fixed EST epoch day. A missing quota is zero, so a positive-volume swap needs a quota set for the current day.setUsedWadis an explicit correction and may lower usage, set it to zero, or set it above quota; later swaps enforce the resulting quota. - LP positions: the LP Manager registers and initializes pools, processes supported position actions, and maintains an NFT count per pool. The two delta-funded mint/increase actions are rejected.
withdrawClaimis disabled. Forced exits are full-position operations and can fail if token delivery is rejected or the PoolManager delta exceeds itsint128range. - Pauses: security pause mode is assigned as a final
NONE,TRADE,LP, orALLvalue. Pool lifecycle isLIST,PAUSE, orDELIST. A separate global emergency pause blocks execution paths;isTradableandisLPAlloweddo not include that global flag.
See docs/SYSTEMS_OVERVIEW.md for call flows and role boundaries and docs/CODING_SPEC_V1.md for current public interfaces and state rules.
Requirements: Python 3.11+, Foundry (validated with 1.7.1), Git submodules, and network access for dependency installation. All submodules use public HTTPS repositories. SBT, issuer checkers and DEX adapters are external contracts; no private implementation checkout is required.
git submodule update --init --recursive
forge soldeer install
make build
make check
make test
make artifacts-checkThe compiler configuration is Solidity 0.8.26, Cancun, via-IR, and optimizer runs 200, as set in foundry.toml. make test also runs the SDK configuration and execution-boundary tests. The default Solidity test profile runs unit tests and local PoolManager integrations; it excludes test/integration/xlayer/, which currently contains no executable fork tests.
Useful focused commands:
make test-unit
make test-local
make test-governance
make test-trading
make test-liquidity
make test-operations
make test-invariants
make test-sdk
make coverageThe executable test architecture, fixture boundaries, and current test assumptions are in test/README.md. Local tests use mocks for issuer, SBT, and some external dependencies; they do not establish production-token or deployment acceptance.
src/v1/core/ Registry, Hook, and Volume Ledger
src/v1/periphery/ Swap Router and LP Manager
src/v1/governance/ Shared AccessControl and UUPS authorization base
src/v1/adapters/ ERC-8056 direct legal-share converter
src/v1/libraries/ Admission, settlement, and LP action logic
src/v1/deployment/ ERC-1967 proxy and CREATE2 Hook proxy factory
src/v1/types/ Pool, asset, pause, identity, and request types
test/unit/ Contract-level tests
test/integration/ Local integration and X Layer test configuration
docs/ Current code guide and explicitly labeled historical designs
- System overview — components, execution paths, access control, quotas, and pauses.
- Contract architecture — code boundaries, design choices, and external risk assumptions.
- Coding specification — current interfaces and behavior derived from
src/v1/. - Registry and W/U/Q admission — asset and pool admission details.
- Token admission standard — on-chain checks and off-chain review requirements.
- Backend integration guide — Router, LP Manager, and Ledger calls.
- Deployment checklist — required configuration and explicit deployment gaps.
- Test guide — suites, commands, fixtures, and coverage limits.
- Full documentation index — current references versus design and audit archives.
Public preproduction and production address inventories are maintained in deployment/, with public deployment guidance in docs/deployments/. See the release workflow for version pinning and verification. Address records do not mean that current main is the deployed implementation. test/integration/xlayer/ has no executable fork suite. Production Factory, PoolManager, SBT, issuer tokens, roles, and transfers must be verified on the target deployment; local mocks are not evidence of those external systems.
The TSV V1 core contracts (first-party Solidity under src/v1, excluding src/v1/vendor) are licensed under BUSL-1.1, a source-available license that is not an Open Source license during its BUSL period. They convert to GPL-2.0-or-later on 2029-11-06. Third-party licenses remain unchanged; see licensing status and third-party notices.
This repository does not distribute private SBT or DEX-adapter implementations. Integration scripts use the public ABI boundary and deployment-configured addresses. The incomplete standalone Securitize checker copy is not included; issuers may supply an existing checker implementing IAllowlistChecker. Deployment addresses must be independently verified, and this repository's tests do not audit those external implementations.