This repository contains the reference implementation for ERC-7518, a security token standard that extends ERC-1155 to provide a flexible framework for managing compliant real-asset security tokens.
ERC-7518 introduces partitioned token management through the ERC-1155 multi-token paradigm, where each tokenId represents a distinct partition with its own set of rights, privileges, and compliance rules. This architecture enables management of tokenized real-world assets including fractional ownership, multiple share classes, and granular compliance controls. The standard also defines features like token locks, forced transfers, freezing, payouts, wrapping, and compliance hooks. (eips.ethereum.org)
- Partitions via
tokenId: Enables semi-fungible tokens with partition‑specific logic. - Compliance Hooks: Methods like
canTransfer,lockTokens,forceTransfer, andfreezeprovide dynamic and enforceable rules. - Payouts & Batch Payouts: Built-in functions for token‑holder distributions.
- Interoperability: Wrapping and unwrapping tokens, enabling cross‑chain or cross‑standard compatibility.
- Built on ERC‑1155 + ERC‑165: Ensures backward compatibility and easy integration with wallets and dApps.
erc‑7518‑foundry/
├── src/
│ ├── ERC7518.sol # Core implementation
│ └── interfaces/
│ └── IERC7518.sol # Interface contract
├── test/
│ └── ERC7518.t.sol # Basic Foundry tests
├── script/
│ └── Deploy.s.sol # Simple deployment script
├── lib/ # Dependencies (e.g., OZ contracts)
├── foundry.toml
├── README.md
└── LICENSE
- Each
tokenIdrepresents a unique partition with independent compliance rules - Dynamic allocation of tokens between different classes or categories
- Support for temporary non-fungibility during regulatory holding periods
- Efficient management of complex asset structures within a single contract
canTransfer()- Pre-transfer compliance validationrestrictTransfer()/removeRestriction()- Dynamic transfer restrictions per partitionfreezeAddress()/unFreeze()- Account-level compliance actions- Off-chain voucher support for dynamic compliance verification
lockTokens()- Time-based token vesting and holding periodsunlockToken()- Automated release after lock expirytransferableBalance()- Query available balance excluding locked tokenslockedBalanceOf()- Query locked token amounts
forceTransfer()- Authorized recovery for lost keys or compliance violations- Bypass standard transfer restrictions for regulatory enforcement
payout()- Single recipient distributionsbatchPayout()- Efficient multi-recipient payouts in single transaction
wrapToken()/unwrapToken()- ERC-20 token wrapping- Full backward compatibility with ERC-1155
- Foundry installed (
forge,cast). - Solidity ≥ 0.8.x.
# Install dependencies
forge install
# Build contracts
forge build
# Run tests
forge test -vvv
# Run gas snapshot
forge snapshot
# Deploy to network
forge script script/Deploy.s.sol --rpc-url <RPC_URL> --broadcast --verify# Run all tests with verbosity
forge test -vvv
# Run specific test file
forge test --match-path test/ERC7518.t.sol
# Gas report
forge test --gas-report- Fractional real estate classes: Define separate tranches (e.g., common vs. preferred) as partitions.
- Tranche-based finance: Different risk/return tiers represented by partition-specific token IDs.
- Cross-chain compliant RWAs: Tokens retain compliance state while moving across chains.
- Implement compliance logic: Add
canTransfer(...)checks using off-chain vouchers or on-chain registries. - Add recovery and lock features: Support token recovery via
forceTransfer, and vesting vialockTokens. - Support freezing: Allow
freeze()andunfreeze()on accounts or partitions. - Enable payouts: Safely distribute payouts using
payout()andbatchPayout(). - Incorporate interoperability: Use
wrapToken()andunwrapToken()for cross-chain or cross-standard compatibility. - Audit, document, license: Add comments, documentation, and choose a suitable open-source license (e.g., MIT).
This project is released under the GPL-3.0 License.
Maintained by Zoniqx
