Unykorn Legal
Section 04 · Template Registry

Open-source smart contract templates.

Curated registry of production-grade smart contract standards and templates used across tokenized securities, RWA structures, and DeFi primitives. Every entry links to the canonical implementation and specifies its license.

Live · smartcontract.unykorn.ai

Unykorn's own Solidity library is live at smartcontract.unykorn.ai — 24 production-shaped contracts across 17 families (draw escrow, permissioned securities, REIT distribution, CMBS waterfalls, SREC, Chainlink oracle consumers, custody attestation registries, ERC-7540 async vaults). Every contract compiles clean under a pinned solc + vendored OpenZeppelin, ships with tests, and is drivable from the Unykorn Studio console with a hash-chained audit trail per action. MIT-licensed; source at github.com/FTHTrading/smart-contract-builder.

Unykorn Contract Library

The Unykorn library at smartcontract.unykorn.ai ships the following families as of v0.5. All contracts are MIT-licensed; source in contracts/rwa/<family>/ and viewable directly at each linked path.

Real Estate / Structured Finance

  • Draw Escrow — milestone-indexed construction escrow with EIP-712 waiver attestation, AIA G703 milestone mapping. source
  • CMBS Waterfall — 3-tranche cash-flow waterfall (senior / mezzanine / equity) with reserve triggers. source
  • REIT Distribution — NOI distribution token + on-chain distributor with pro-rata sweep. source
  • Real Estate Debt Token — mortgage-note participation certificate. source
  • Fractional Property Token — ERC-20 wrapper for fractional ownership units. source

Securities / Compliance

  • Permissioned Token — ERC-3643-inspired permissioned security token with IdentityRegistry + ClaimTopicsRegistry (jurisdiction, accreditation, holding-period gating). source
  • Custody Attestation Registry — qualified-custodian proof-of-reserve register with rotation and revocation. source
  • Custody Reserve Guard — transfer-blocker if attested reserves fall below a token's outstanding supply. source

Private Credit / Institutional Lending

  • Bridge Loan Tranche Pool — senior/mezz tranched bridge-loan pool with waterfall distribution. source
  • Pool Delegate Pool — Maple-style delegated credit pool with delegate-managed underwriting. source
  • Invoice Factoring Pool — receivables-financing pool with obligor-diversified exposure. source
  • Inventory Financing SPV — inventory-backed lending SPV for import/export working capital. source

Tokenized Funds

  • Cash Management Vault — ERC-4626-compliant institutional cash-management vault, Maple-style. source
  • Async Vault (ERC-7540) — asynchronous subscription/redemption vault following EIP-7540. source
  • Tokenized Treasury / Wrapped Treasury — T-bill-backed yield-bearing token with wrapper for cross-chain use. source
  • Gold-Backed Token — bullion-backed token with vaulted-attestation reserve gating. source

ESG / Climate / Sovereignty

  • SREC Token — Solar Renewable Energy Certificate token with meter-attested issuance. source

Oracles / Cross-chain

  • Chainlink RWA Oracle — consumer that pulls RWA valuation feeds with staleness guards. source
  • Proof of Reserve Consumer — Chainlink PoR consumer that gates supply mint against attested reserves. source
  • CCIP Bridged Token — Chainlink CCIP-integrated token for cross-chain settlement. source

Status legend. Each contract on smartcontract.unykorn.ai carries a SHIPPED or DESIGN CONTRACT badge. Shipped = compiles clean under the pinned solc, tested, deployable to Anvil via Unykorn Studio right now. Design contract = interface + integration shape defined; the corresponding step exists in Studio's executor as an unwired branch that fails loudly with a specific reason (honest v0 behaviour) pending an external dependency (Toucan bridge, BitGo Enterprise API, XRPL adapter).

Other Unykorn Contract Repositories

Beyond the RWA library above, additional Solidity work lives in dedicated repos for specific initiatives:

External Standards & References

The following are third-party standards Unykorn contracts interoperate with or reference. Not Unykorn code; canonical repos linked with licence noted.

Permissioned Security Token Standards

ERC-3643 T-REX — Permissioned Security Tokens GPL-3.0

The dominant standard for regulated security tokens. Every holder requires an on-chain identity (ONCHAINID) with verifiable claims. Every transfer is validated against configurable compliance modules (jurisdiction, accreditation, transfer amount, holding period) before execution.

Use for: Reg D 506(c) tokens, MiCA asset-referenced tokens, tokenized fund shares with KYC-gated participation.

Canonical: github.com/ERC-3643/ERC-3643 — note the original TokenySolutions/T-REX repo was archived 28 October 2025.

Adopted by: Securitize, INX, Prometheum, Backed, multiple institutional issuers. EIP-3643 approved 2023.

ERC-1400 Partitioned Security Tokens Apache-2.0

Earlier security-token standard supporting partitioning (multiple tranches with different rules), forced transfers, operator control, and document management on-chain. Widely implemented despite non-final EIP status.

Use for: Multi-tranche debt securities, tokenized preferred equity, structured products with holder-class distinctions.

Canonical: EIP-1400 (spec). Note: the historical ConsenSys/UniversalToken reference implementation was archived 25 March 2025. There is no currently-maintained canonical reference implementation.

Convertible & Pre-Issuance Instruments

SAFT Simple Agreement for Future Tokens Public

Investment agreement in which purchasers pay for future delivery of tokens once a network launches. Structured as a security at signing (under Reg D) with delivery of (potentially non-security) utility tokens at network launch.

Use for: Pre-launch protocol financings; institutional participation in early-stage token projects.

Reference: Cooley GO SAFT Framework; Coinbase SAFT template

Token Warrant Rights to Future Tokens License varies

Convertible instrument giving the holder the right to receive tokens on a defined trigger event (typically token generation event or protocol launch). Typically issued alongside an equity SAFE for hybrid equity+token deals.

Use for: Venture financings of companies building token-based protocols where the company entity is separate from the token issuer.

Reference: No single canonical open repository currently maintained. Historical a16z Crypto Legal Templates repo is no longer resolving at the previously-published URL; check a16z Crypto Publications for current published forms.

SAFE Simple Agreement for Future Equity Publicly available (no open-source grant)

Y Combinator's convertible-instrument standard for early-stage equity financings. Post-money and pre-money variants. Not debt; converts to equity on a defined trigger event (typically priced round).

Note: The SAFE is publicly available on Y Combinator's documents page, but YC does not publish it under an open-source license; the documents page disclaims responsibility and grants no license. Firms typically treat the forms as industry-standard practice while relying on counsel for the actual execution version.

Reference: Y Combinator SAFE Documents

Vaults & Yield Primitives

ERC-4626 Tokenized Vault Standard MIT

Standard interface for yield-bearing vaults: deposit an underlying token, receive vault-share tokens; withdraw by burning shares; NAV per share updates with underlying performance. Foundation of the yield-primitives DeFi layer.

Use for: Tokenized fund shares (money-market, credit, real-estate), yield-bearing stablecoin wrappers, LP-token normalization.

Canonical: EIP-4626; OpenZeppelin reference implementation at openzeppelin-contracts

Morpho Blue Isolated Lending Vaults GPL-2.0-or-later

Permissionless isolated lending-market factory. Each market has its own collateral asset, borrow asset, LLTV, oracle, and IRM. Non-upgradeable; minimalist trust model. MetaMorpho vaults on top provide managed exposure across multiple markets.

Use for: On-chain private-credit markets, RWA-collateralized lending, institutional yield strategies.

Canonical: github.com/morpho-org/morpho-blue

Custody & Multi-Sig

Safe (Gnosis Safe) Multi-Sig Wallet LGPL-3.0 (contracts)

The dominant multi-signature wallet standard. Configurable m-of-n approval, modules for extended functionality (spending limits, session keys, delegation), and formal-verification history. Foundation of institutional on-chain custody.

Use for: SPV treasury custody, DAO treasuries, multi-approver spending controls, guardian-based recovery.

Canonical: github.com/safe-global/safe-smart-account

Escrow & Milestone Release

OpenZeppelin Escrow Simple Payment Escrow MIT

Reference implementations of payment escrow (hold funds pending beneficiary claim), conditional escrow (release on off-chain event), and refund escrow (support for cancellation and refund flows).

Use for: Simple payment holds, subscription-with-hold patterns, dispute-resolution intermediaries.

Canonical: OpenZeppelin Escrow docs

Milestone Escrow Attested Multi-Milestone Release Internal (planned)

Multi-party escrow releasing funds against attested milestone completion. Requires signed oracle input (inspector, drone/BIM, mechanic's-lien waiver hash). Multi-sig approval on release. Reserved for construction-draw and phased-project financing.

Use for: Ground-up development draws, project-finance milestone payments, staged-delivery contracts.

Status: Reference implementation coming to smartcontract.unykorn.ai.

Distribution Waterfalls

0xSplits Configurable Payment Splits GPL-3.0

Immutable smart contract that receives payments and distributes them per configured recipient shares. Supports controlled + immutable variants, and split-of-splits patterns. Battle-tested in NFT royalty and creator-economy contexts.

Use for: Fund distribution waterfalls (pref return + catch-up + carried interest), royalty splits among creators/rightholders.

Canonical: github.com/0xSplits

Superfluid Streams Continuous Payment Streaming AGPL-3.0 (contracts) / MIT (SDK only)

Constant-flow money-streaming primitive. Recipient balance updates in real time based on stream rate. Enables continuous-vesting, salary-streaming, and subscription patterns without discrete transactions.

Use for: Investor distribution streaming (in stablecoin), employee compensation flows, subscription revenue.

Load-bearing license warning: the actual streaming contracts (ethereum-contracts) are AGPL-3.0, not MIT. Only the client SDK is MIT. Embedding the contracts in a proprietary or white-label stack triggers AGPL network-copyleft — the entire product would need to be released under AGPL. This is the single most common license mistake in this category; treat it as a hard warning before adoption.

Canonical: github.com/superfluid-finance/protocol-monorepo

Vesting & Cliff Schedules

OpenZeppelin VestingWallet Linear Vesting with Cliff MIT

Reference implementation of time-based vesting. Supports linear vesting after a cliff period. Composable with any ERC-20 or ETH.

Use for: Founder / employee token vesting, investor-lockup enforcement, team allocation schedules.

Canonical: OpenZeppelin VestingWallet docs

Sablier Streaming Token Distributions GPL-3.0 (relicensed from BUSL 13 July 2026)

Advanced streaming and vesting primitive with LockUp (cliff), LockUp Dynamic (custom curve), and LockUp Tranched (staged) variants. Cancelable + transferable streams; audit-verified.

Use for: Sophisticated vesting programs, employee token grants with custom curves, tokenized-payroll systems.

Status: the monorepo is no longer actively maintained and is not accepting pull requests. GPL-3.0 imposes strong copyleft — not suitable for embedding in a proprietary or white-label product without releasing the whole stack.

Canonical org: github.com/sablier-labs

Identity & Compliance

ONCHAINID On-Chain Identity Contracts GPL-3.0

ERC-734 / ERC-735-based on-chain identity system. Holds verifiable claims issued by claim issuers (accredited-investor status, KYC-completion, jurisdictional residence). Required for holders of ERC-3643 permissioned tokens.

Use for: Permissioned-token holder identity, KYC-gated protocol access, compliance-scoped whitelists.

Canonical: github.com/onchain-id/solidity

Circle Verite Verifiable Credentials Deprecated (archived April 2025)

W3C Verifiable Credentials framework for privacy-preserving KYC + accreditation attestation. Both Verite repositories were archived 4 April 2025; the product is no longer maintained. Actual license was MIT (not Apache as previously listed).

Do not adopt for new work. Consider alternatives: ONCHAINID (GPL-3.0) for permissioned tokens; Ethereum Attestation Service (EAS, MIT) for general attestations; W3C DIDs + verifiable credentials via other frameworks (Sovrin/Aries, Veramo).

Historical repo: github.com/centrehq/verite (archived)

Governance

OpenZeppelin Governor On-Chain DAO Governance MIT

Modular on-chain governance framework. Supports Compound-Bravo-style proposal + voting + timelock execution. Composable modules for voting power (token weight, ERC-20Votes, ERC-721Votes) and quorum rules.

Use for: DAO LLC governance execution layer, protocol treasury management, investor-vehicle governance where on-chain voting is preferred.

Canonical: OpenZeppelin Governance docs

Bridges & Cross-Chain

Chainlink CCIP Cross-Chain Interoperability Protocol BUSL-1.1

Permissioned cross-chain messaging and token-transfer standard. Programmable token transfers between supported chains with integrated risk-management network. Reference for institutional cross-chain applications.

Use for: Multi-chain token distribution, cross-chain RWA settlement, unified compliance across chain deployments. BUSL restricts competing hosted use during the source-available period.

Also relevant: Chainlink Functions sunset 30 June 2026 — if your integration path referenced Functions, migrate to CCIP or an alternative.

Canonical: docs.chain.link/ccip

How to select a template

  1. Match to legal structure. If your legal instrument is a Reg D 506(c) security, use ERC-3643 with active compliance modules. If it's a utility token post-network-launch, ERC-20 with SAFT delivery may be appropriate.
  2. Prefer audited canonical implementations. Use OpenZeppelin, Tokeny, Sablier, 0xSplits, Superfluid canonical repos over unofficial forks unless you have specific reason.
  3. Match the security model to the trust model. Multi-sig for treasuries. Non-upgradeable for maximum-trust primitives (Morpho Blue-style). Upgradeable proxies only when governance is truly decentralized or where regulatory requires operator control.
  4. Get an audit for anything above six figures in TVL. Trail of Bits, OpenZeppelin, ConsenSys Diligence, Halborn, Zellic are the current top-tier firms.
  5. Get a legal opinion. Especially for permissioned tokens and any token that could be construed as a security. See the Legal Ops System for the workflow.
Contribute a template

Missing a standard or template? Submit a PR at github.com/FTHTrading/legal. Every accepted entry must include: canonical repo link, license identifier, and one production use case.