This project provides a StarkNet implementation of the ERC3643 T-REX (Token for Regulated EXchanges) standard. It enables the compliant tokenization of financial assets on StarkNet while maintaining the regulatory compliance features of the ERC3643 standard.
ERC3643 is a token standard for regulated exchanges that extends ERC20 with identity management, compliance rules, forced transfers, and other features required for securities tokens. This implementation provides all the necessary components to create compliant security tokens on StarkNet.
- Regulatory Compliance: Security tokens that meet regulatory requirements
- Identity Management: Manage investor identities with verification
- Transfer Compliance: Enforce transfer restrictions based on regulatory rules
- Claim Verification: Verify required claims for each identity
- Forced Transfers: Allow authorized agents to force transfer tokens
- Recovery: Support token recovery from lost addresses
- Freezing: Ability to freeze tokens at address level
The implementation consists of several interconnected components:
- Token: The main contract representing the token itself
- Identity Registry: Manages investor identities
- Identity Storage: Stores identity data
- Compliance: Enforces transfer restrictions based on regulatory requirements
- Claim Topics Registry: Defines required identity claims
- Trusted Issuers Registry: Manages trusted identity verifiers
The codebase is organized into:
- Interfaces: Standardized interfaces for all components (
src/interfaces/) - Core Components: Reusable component implementations (
src/components/) - Examples: Reference implementations for quick start (
src/examples/) - Tests: Comprehensive test suite (
tests/)
┌─────────────────┐ ┌───────────────────┐ ┌────────────────────┐
│ Token │◄─────────►│ IdentityRegistry │◄────────►│ ClaimTopicsRegistry│
└────────┬────────┘ └─────────┬─────────┘ └────────────────────┘
│ │ ▲
│ │ │
▼ ▼ │
┌─────────────────┐ ┌───────────────────┐ ┌────────────────────┐
│ Compliance │ │ IdentityStorage │◄────────►│TrustedIssuersRegistry│
└─────────────────┘ └───────────────────┘ └────────────────────┘
- Scarb - Cairo package manager
- StarkNet Foundry - Testing framework for StarkNet
-
Clone the repository:
git clone https://github.com/yourusername/erc3643.git cd erc3643 -
Build the project:
scarb build
-
Run tests:
snforge test
To deploy a new ERC3643 token on StarkNet, use the deployment script:
./scripts/deploy.sh [testnet|mainnet]This will deploy all necessary contracts (Token, Identity Registry, Compliance, etc.) in the correct order and configure them properly.
The project uses StarkNet Foundry for testing. To run tests:
# Run all tests
snforge test
# Run a specific test
snforge test test_token_initialization
# Run tests with a specific filter
snforge test test_compliance
# Run comprehensive test suite
snforge test test_comprehensiveThe testing framework includes:
- Comprehensive tests: End-to-end testing of all components
- Unit tests: Testing individual contract functions
- Integration tests: Testing interactions between contracts
- Testing utilities: Using StarkNet Foundry's cheatcodes for state manipulation
This project is licensed under the MIT License - see the LICENSE file for details.