Skip to content

Solidity implementation of ERC-1400 security tokens with partition logic, compliance validators, holds, and DvP. Legacy RWA reference stack.

License

Notifications You must be signed in to change notification settings

OnDemandWorld/erc1400-contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

โ›“๏ธ ERC1400 Security Token Smart Contracts

Part of the ODW ASSETTECH Legacy RWA / STO Reference Stack

โšก About This Repository

This is the ERC-1400 Smart Contracts: a Solidity implementation of the ERC-1400 security token standard and its supporting extensions (validators, holdable tokens, partition logic, DvP swaps, etc.). It is the on-chain core of the legacy STO stack, and serves as a useful reference for designing compliant, partitioned security tokens before migrating to ERC-3643 or other modern standards.

Back in 2024, the ODW Team built a full Security Token Offering (STO) solution using the ERCโ€‘1400 token standard on a private EVM chain running ConsenSys Quorum. Since then, the ecosystem has evolved: Quorum is no longer actively supported by ConsenSys (with Hyperledger Besu recommended as the successor), and STOs are now more commonly framed under the broader Realโ€‘World Assets (RWA) narrative.

On the token side, ERCโ€‘3643 (Tโ€‘REX) and ERCโ€‘1155 have emerged as the most commonly used standards for regulated STO/RWA projects, with ERCโ€‘3643 gaining prominence for its advanced, onโ€‘chain compliance (DID, KYC/AML, transfer restrictions), and ERCโ€‘1155 enabling efficient multiโ€‘asset, multiโ€‘class tokenization.

We are openโ€‘sourcing this repository as a reference implementation to share architecture, design patterns, and integration approaches around ERCโ€‘1400โ€‘based STOs on permissioned EVM chains.

Important: This repository is not intended for production use. A productionโ€‘grade RWA/STO system today should:

  • Migrate from Quorum โ†’ Hyperledger Besu (or another actively maintained EVM execution client), and
  • Refactor token logic from ERCโ€‘1400 โ†’ ERCโ€‘3643 and/or ERCโ€‘1155, with modern compliance and identity tooling.

๐Ÿ“š Repository Series

This repository is part of the ODW ASSETTECH legacy RWA collection:

  1. ERC1400 Token Dashboard (Frontend Dashboard)
  2. STO Backend API (Express.js API with JWT, Wallet Auth)
  3. STO Web Client (Next.js Web Interface)
  4. ERC1400 Smart Contracts โ† You are here (Solidity Implementation)

Each repository can be explored independently, but together they form a complete STO platform architecture.


๐ŸŽฏ Overview

This repository implements the ERC1400 security token standard, designed for tokenized financial assets. ERC1400 extends ERC20 with advanced compliance features including partitioned tokens, granular transfer controls, and certificate-based authorization.

Core Features

  • Partitioned Tokens: Partial fungibility - tokens within a partition are fungible, across partitions they're non-fungible
  • Granular Transfer Controls: Certificate-based and allowlist/blocklist validation
  • Token Holds: Lock tokens while maintaining accurate investor registry
  • Document Management: Bind legal documents to tokens (IERC1643)
  • Operator Management: Global and partition-specific operator authorization
  • Controller Operations: Force transfers and redemptions for compliance

๐Ÿ—๏ธ Architecture

Core Components

  1. ERC1400 Core (contracts/ERC1400.sol)

    • Main token implementation
    • ERC20 retrocompatible
    • Partition management
    • Document management
  2. Token Extensions

    • ERC1400TokensValidator: Transfer validation, holds, certificates
    • ERC1400TokensChecker: View-only transfer validation
  3. User Extensions

    • IERC1400TokensSender: Sender hooks
    • IERC1400TokensRecipient: Recipient hooks
  4. Holdable Token (contracts/tokens/ERC1400HoldableToken.sol)

    • Pre-configured token with validator extension
    • Ready-to-deploy implementation
  5. Delivery-vs-Payment (contracts/tools/Swaps.sol)

    • Atomic token swaps
    • Multi-standard support (ETH, ERC20, ERC721, ERC1400)
    • Price oracle integration

Contract Structure

contracts/
โ”œโ”€โ”€ ERC1400.sol                          # Core token implementation
โ”œโ”€โ”€ IERC1400.sol                         # ERC1400 interface
โ”œโ”€โ”€ tokens/
โ”‚   โ”œโ”€โ”€ ERC1400HoldableToken.sol        # Pre-configured holdable token
โ”‚   โ”œโ”€โ”€ ERC20Token.sol                  # Basic ERC20 implementation
โ”‚   โ””โ”€โ”€ ERC721Token.sol                  # Basic ERC721 implementation
โ”œโ”€โ”€ extensions/
โ”‚   โ”œโ”€โ”€ tokenExtensions/
โ”‚   โ”‚   โ”œโ”€โ”€ ERC1400TokensValidator.sol  # Transfer validation extension
โ”‚   โ”‚   โ””โ”€โ”€ ERC1400TokensChecker.sol    # View-only validation
โ”‚   โ””โ”€โ”€ userExtensions/
โ”‚       โ”œโ”€โ”€ IERC1400TokensSender.sol     # Sender hooks
โ”‚       โ””โ”€โ”€ IERC1400TokensRecipient.sol # Recipient hooks
โ”œโ”€โ”€ tools/
โ”‚   โ”œโ”€โ”€ Swaps.sol                        # Delivery-vs-payment
โ”‚   โ”œโ”€โ”€ FundIssuer.sol                   # Fund issuance tool
โ”‚   โ””โ”€โ”€ BatchTokenIssuer.sol            # Batch issuance
โ”œโ”€โ”€ roles/                               # Role-based access control
โ”œโ”€โ”€ certificate/                         # Certificate implementations
โ””โ”€โ”€ interface/                           # Interface definitions

Key Features Explained

Partition System

Partitions enable partial fungibility:

  • Tokens within a partition are fungible
  • Tokens across partitions are non-fungible
  • Use cases: asset classes, lock-up periods, corporate actions

Certificate-Based Transfers

Off-chain signed certificates for granular transfer control:

  • Nonce-based: Sequential nonce prevents replay
  • Salt-based: Unique salt for one-time use
  • Enhanced security and auditability

Token Holds

Alternative to escrow that preserves investor registry:

  • Tokens remain in holder's wallet but are locked
  • Supports HTLC (Hash Time Locked Contracts)
  • Enables delivery-vs-payment without registry loss

๐Ÿ“‹ ERC1400 Standard

ERC1400 introduces new concepts on top of ERC20:

  • Granular transfer controls: Certificate-based validation via data field
  • Controllers: Force transfers and redemptions
  • Partitioned tokens: Partial fungibility for asset classes
  • Document management: Legal document binding (IERC1643)
  • Hooks: Sender/recipient hooks via ERC1820 (optional)
  • Upgradeability: ERC1820-based migration support

๐Ÿš€ Quick Start

Prerequisites

# Install Node.js and Yarn
brew install yarn
brew install nvm

Installation

git clone https://github.com/OnDemandWorld/erc1400-contracts.git
cd erc1400-contracts
nvm use
yarn install

Testing

# Run all tests
yarn test

# Run with coverage
yarn coverage

โš™๏ธ Environment Setup

Create a .env file:

# Copy example
cp .env.example .env

# Required variables:
MNEMONIC=your_wallet_mnemonic_here           # [MANDATORY]
INFURA_API_KEY=your_infura_key              # [OPTIONAL]
RPC_ENDPOINT=http://localhost:8545          # [OPTIONAL]
NETWORK_ID=1337                             # [OPTIONAL]

Required Variables

  • MNEMONIC - Ethereum wallet mnemonic for deployment

Optional Variables

  • INFURA_API_KEY - For mainnet/ropsten/testnet access
  • RPC_ENDPOINT - Custom RPC endpoint
  • NETWORK_ID - Network ID for deployment

๐Ÿšข Deployment

Step 1: Deploy to Local Network (Ganache)

# Start Ganache
yarn start:chain
# or
ganache-cli -p 7545

# In another terminal, deploy
yarn truffle migrate

Step 2: Deploy to Testnet/Mainnet

# Deploy to Ropsten
yarn truffle migrate --network ropsten

# Deploy using .env configuration
yarn migrate

Deployment Networks

Supported networks:

  • development - Local Ganache
  • ropsten - Ethereum Ropsten testnet
  • mainnet - Ethereum mainnet (not recommended for legacy code)

๐Ÿงช Testing

# Run all tests
yarn test

# Run with coverage
yarn coverage

# Lint code
yarn lint:all

# Fix linting issues
yarn lint:all:fix

Test Coverage

Tests cover:

  • Core ERC1400 functionality
  • Partition management
  • Transfer validation
  • Document management
  • Hold functionality
  • Operator management
  • Controller operations

๐Ÿ“ Usage Examples

Basic Token Operations

// ERC20 compatible transfer
token.transfer(recipient, 1000);

// ERC1400 transfer with data
token.transferWithData(recipient, 1000, "");

// Partition transfer
bytes32 partition = keccak256("equity");
token.transferByPartition(partition, recipient, 1000, "");

Creating a Hold

bytes32 holdId = keccak256("hold-1");
bytes32 secretHash = keccak256(abi.encodePacked(secret));
uint256 expiration = block.timestamp + 30 days;

validator.hold(
    address(token),
    holdId,
    recipient,
    notary,
    partition,
    1000,
    expiration,
    secretHash,
    certificate
);

Managing Partitions

// Issue tokens to a specific partition
token.issueByPartition(partition, recipient, 1000, "");

// Get balance in partition
uint256 balance = token.balanceOfByPartition(partition, holder);

// Get partition list
bytes32[] memory partitions = token.partitionsOf(holder);

๐Ÿ”’ Security Considerations

Certificate Validation

โš ๏ธ Important: See certificate documentation for known security considerations regarding certificate validation.

Best Practices

  1. Access Control: Properly configure controllers and operators
  2. Certificate Management: Use secure certificate signing
  3. Hold Management: Validate hold parameters carefully
  4. Migration: Test migration procedures thoroughly
  5. Audit: Have contracts professionally audited before production use

๐Ÿ› ๏ธ Development

Building

# Build all contracts
yarn build

# Build specific contract
yarn build:ERC1400

Code Quality

# Lint Solidity
yarn lint:sol

# Lint JavaScript
yarn lint

# Fix all linting issues
yarn lint:all:fix

Remix IDE

# Start Remix for contract interaction
yarn remix

๐Ÿ”ง Implementation Notes

Gas Optimization

Recent improvements:

  • โœ… Removed SafeMath (Solidity 0.8.0+ built-in protection)
  • โœ… Optimized partition management
  • โœ… Efficient storage layout

Implementation Choices

Based on EIP-1400 specification with modifications for:

Business Requirements

  • Sender/recipient hooks (ERC777-inspired, ERC1400-compliant)
  • Validator hooks for upgradeable validation policies
  • Partition-aware allowances
  • ERC1820 migration support

Gas Optimizations

  • Removed separate controller functions (merged into operator functions)
  • Optional checker hooks (view functions moved to optional extension)
  • SafeMath removed (Solidity 0.8.0+ has built-in overflow protection)

๐Ÿ”„ Migration Support

The contract supports ERC1820-based migration:

// Migrate to new contract
token.migrate(newContractAddress, false); // Non-definitive
token.migrate(newContractAddress, true);  // Definitive

๐Ÿ“š Documentation

๐Ÿ”— Resources

๐Ÿ“„ License

Apache 2.0 - See LICENSE file for details.


๐ŸŒŸ Support & Community

If this repository is useful to you as a reference for STO/RWA design, please consider:

  • Giving the project a โญ star on GitHub
  • Watching the repo to follow updates
  • Opening issues for questions, ideas, or problems you hit
  • Submitting pull requests with improvements or fixes

Your feedback and contributions help us decide how much more to invest in evolving these openโ€‘source building blocks.


๐Ÿ’ผ Work with the ODW Team

ODW ASSETTECH specializes in:

  • RWA / STO architecture & solution design
  • Smart contract engineering (ERCโ€‘3643, ERCโ€‘1155, custom compliance modules)
  • Blockchain infrastructure - Hyperledger Besu setup and deployment
  • Security auditing - Contract review and optimization
  • Migration of legacy ERCโ€‘1400 / Quorum stacks to Hyperledger Besu and modern standards
  • Regulated environments: focusing on complianceโ€‘aware tokenization flows

If you are:

  • A financial institution or issuer exploring tokenization,
  • A startup building an RWA platform, or
  • An engineering team looking to modernize an existing STO stack,

we'd be happy to discuss how we can help.

๐Ÿ“ง Contact the ODW Team


๐Ÿ”— Related Repositories in This Series

This repository is one component of a 4โ€‘repo reference stack. For a fuller picture, explore the other repos in the ODW ASSETTECH organization.


Made by the ODW Team โ€“ sharing our 2024 STO stack as a reference for today's RWA builders.

About

Solidity implementation of ERC-1400 security tokens with partition logic, compliance validators, holds, and DvP. Legacy RWA reference stack.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published