Skip to content

DualNova/tokenization-templates

Repository files navigation

@dualnova/tokenization-templates

Production-ready Solidity templates for regulated tokenization: ERC-20 with vesting, ERC-721 with EIP-2981 royalties, and a multi-signature custodial vault. Built with Hardhat, OpenZeppelin 5, and a full TypeScript test suite.

License: MIT Solidity OpenZeppelin Hardhat

⚠️ These contracts are templates. They have been written carefully with internal review, but they have not been audited by a third party. Always have your deployment audited by a qualified smart-contract security firm before handling real value on mainnet.

🇪🇸 Léeme en español


What's in this repo

Three battle-tested patterns DualNova has shipped to production across ICO, real-estate, and mineral-mining tokenization platforms.

Contract Use case Standard LoC
ERC20Vesting.sol Team / advisor / seed-investor token grants with cliff + linear vesting + revoke ERC-20 + custom vesting ~120
MultiSigVault.sol M-of-N institutional custody of ETH and ERC-20s Custom (Gnosis Safe-style minimal) ~150
RoyaltyNFT.sol Per-token-metadata NFT with EIP-2981 royalties for RWA and brand collabs ERC-721 + ERC-2981 ~80

Each contract has:

  • A header doc-comment explaining design choices and trade-offs
  • Custom errors instead of string reverts (gas-efficient + machine-readable)
  • A focused test suite (8-12 tests per contract) covering happy path + rejection paths

Why publish these?

Most "starter" smart-contract templates online either: (a) blindly inherit half of OpenZeppelin and never get audited, (b) ship without tests, or (c) are 5 years old and still target Solidity 0.6.

This repo is the opposite of all three: small, tested, modern (0.8.24), and honest about what it doesn't do.

Quick start

git clone https://github.com/DualNova/tokenization-templates
cd tokenization-templates
npm install
npx hardhat compile
npx hardhat test

Contracts

1. ERC20Vesting

ERC-20 token with built-in per-beneficiary linear vesting and a cliff. Used for team grants, advisor allocations, and seed-investor unlocks.

// Deploy with 1M initial supply minted to the owner (a multisig).
new ERC20Vesting("Acme Token", "ACME", 1_000_000e18, multisig);

// Grant a beneficiary 100k tokens vesting over 4 years with a 1-year cliff.
token.grant(
    beneficiary,
    100_000e18,
    uint64(block.timestamp),        // start now
    365 days,                       // cliff = 1 year
    4 * 365 days                    // duration = 4 years
);

Properties:

  • One schedule per beneficiary. New schedules for the same address revert.
  • Cliff is a hard wall: nothing claimable before start + cliff, then the cliff-portion becomes claimable atomically and the rest unlocks linearly.
  • Owner can revoke (e.g. for terminated employees). Unvested portion returns to owner; vested portion remains claimable by the beneficiary.
  • Anyone can call release(beneficiary) — tokens always go to the beneficiary.

Read the full design notes in the contract header. Tests in test/ERC20Vesting.test.ts.

2. MultiSigVault

Minimal M-of-N multi-signature vault for ETH and ERC-20 custody. Designed for institutional custody flows where 2-of-3 or 3-of-5 signers approve withdrawals on a per-transaction basis.

// 2-of-3 vault
new MultiSigVault([alice, bob, carol], 2);

// Anyone can fund: vault.receive() {}
// An owner submits a withdrawal:
uint256 txId = vault.submit(recipient, 1 ether, "");
// A second owner confirms:
vault.confirm(txId);
// Any owner executes:
vault.execute(txId);

Properties:

  • Owner set is fixed at deployment but mutable via self-call: changing the owners/threshold requires the existing quorum to approve it (just submit a setOwners(...) transaction to the vault itself).
  • Per-transaction nonce → replay-protected.
  • Custom errors (NotAnOwner, AlreadyExecuted, NotEnoughConfirmations, ...) → gas-efficient and easy to surface in front-ends.

For production custody flows DualNova combines this with MPC (multi-party computation) for the key shards — see dualnova.org/services.

3. RoyaltyNFT

ERC-721 with per-token metadata URI and EIP-2981 royalties. Suitable for fractional real-estate certificates, brand-collab drops, and any RWA scenario where each token represents a unique off-chain asset.

new RoyaltyNFT(
    "Acme Collection",
    "ACME",
    multisig,            // owner
    royaltyReceiver,
    500                  // 5% royalty in basis points
);

nft.mint(buyer, "ipfs://bafy.../1.json");
nft.setTokenRoyalty(1, premiumReceiver, 1000); // 10% for this special edition

Properties:

  • Compliant with EIP-2981 → OpenSea, Rarible, Magic Eden, Manifold, etc. all respect the royalty.
  • Sequential token IDs starting at 1.
  • Owner mints; production deployments typically wrap this in a marketplace contract that gates minting on payment or KYC.

Stack

Solidity 0.8.24
Optimizer enabled, 200 runs, viaIR off
Framework Hardhat 2.22 + hardhat-toolbox
Libraries @openzeppelin/contracts 5.1
Testing TypeScript, chai, hardhat-network-helpers
Networks (sample config) Polygon, Base, Sepolia

Project layout

contracts/             ← three Solidity templates
test/                  ← TypeScript unit tests, one file per contract
hardhat.config.ts      ← Polygon + Base + Sepolia, etherscan verify
.env.example           ← template for RPC / deployer keys
docs/                  ← deeper design notes per contract (coming soon)

Deploy

Copy .env.example to .env, fill in your RPC URL and deployer key, then:

# Compile + run tests first (you should)
npx hardhat compile
npx hardhat test

# Deploy ERC20Vesting to Polygon
npx hardhat run scripts/deploy-vesting.ts --network polygon

# Verify on PolygonScan
npx hardhat verify --network polygon <ADDRESS> "Acme" "ACME" 1000000000000000000000000 <OWNER>

A deploy script for each contract will be added to scripts/ in v0.2.

Security

These templates are not yet audited by a third party. The recommended path:

  1. Fork this repo.
  2. Customize the constructor parameters and any business-specific behavior.
  3. Run the test suite and add tests for your customizations.
  4. Have the result audited by a qualified firm (DualNova has working relationships with several LATAM and US firms — we can introduce you if useful).
  5. Deploy to a testnet, simulate the lifecycle (grant → cliff → release → revoke for vesting; submit → confirm → execute → revoke for the vault).
  6. Deploy to mainnet.

If you find a security issue in these templates, please email security@dualnova.org before opening a public issue.

Roadmap

  • v0.2 — Deploy scripts per contract; gas reports in CI; deployment addresses table for our reference partners.
  • v0.3WhitelistedERC20Vesting (KYC-gated grants) + FractionalRealEstate (RWA-specific helper).
  • v0.4StakingPool for token-based governance + reward distribution.

Open an issue with a use case you want covered.

License

MIT © DualNova LLC.

Includes code patterns inspired by:


🇪🇸 Léeme en español

Qué hay aquí

Tres patrones probados en producción que DualNova ha desplegado para plataformas de ICO, tokenización inmobiliaria y minería de minerales.

Contrato Caso de uso Estándar
ERC20Vesting.sol Vesting de equipo / advisors / seed investors con cliff + lineal + revoke ERC-20
MultiSigVault.sol Custodia M-de-N de ETH y ERC-20 Custom (estilo Gnosis Safe minimal)
RoyaltyNFT.sol NFT con metadata por token + royalties EIP-2981 para RWA ERC-721 + ERC-2981

Por qué publicarlos

La mayoría de "starter templates" en GitHub heredan medio OpenZeppelin sin auditar, vienen sin tests, o todavía están en Solidity 0.6. Este repo es lo contrario: chico, probado, moderno (0.8.24), y honesto sobre lo que no hace.

Quick start

git clone https://github.com/DualNova/tokenization-templates
cd tokenization-templates
npm install
npx hardhat compile
npx hardhat test

Seguridad

Estos templates no están auditados aún por una firma externa. Camino recomendado: forkea → personaliza → audita con una firma calificada → despliega a testnet → mainnet. DualNova tiene relaciones con varias firmas LATAM y US — escríbenos si necesitas introducción.

Licencia

MIT © DualNova LLC — equipo bilingüe basado en Caracas, Bogotá y Miami.


Built by DualNova — blockchain and AI software development for LATAM and the US.

About

Production-ready Solidity templates for regulated tokenization: ERC-20 with vesting, ERC-721 with EIP-2981 royalties, multi-sig custodial vault. Hardhat + OpenZeppelin 5 + full TypeScript test suite.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors