A minimal compliance-on-chain demo for reserve-backed tokens that enforces continuous solvency checks, bridging TradFi reserve requirements with blockchain transparency.
- β 1:1 Reserve Backing: Every token is backed by equivalent reserves
- β Continuous Solvency Checks: All transfers validate reserve coverage
- β On-Chain Compliance: Reserve ratio events logged for audit trails
- β Access Control: Only authorized issuer can mint new tokens
- π Oracle Integration: Real-world asset price feeds (Week 2)
- Foundry
- Node.js 16+ (for additional tooling)
# Clone the repository
git clone https://github.com/yourusername/specchain-reserve-token
cd specchain-reserve-token
# Install dependencies
forge install
# Copy environment variables
cp .env.example .env
# Edit .env with your values# Run all tests with gas reporting
forge test -vv --gas-report
# Run specific test
forge test --match-test testTransferSucceedsWhenReserveCoversSupply -vvflowchart LR
A[TradFi Legal Covenant<br/>1:1 Reserve] --> B[Specs/YAML]
B --> C[Invariant Tests Foundry]
C --> D[Smart Contract RwaToken]
D --> E[On-Chain Proof<br/>Tx + Events]
A -.Analogy.-> F[Custodian Bank]
D -.Analogy.-> G[Transfer Agent/Registrar]
E -.Analogy.-> H[Audit Trail]
Comprehensive Testing: 18 Tests, 100% Coverage
| Test | Description | Status |
|---|---|---|
testTransferSucceedsWhenReserveCoversSupply |
Validates transfers work with adequate reserves | β Pass |
testTransferRevertsWhenReserveBelowSupply |
Ensures transfers fail when reserves are insufficient | β Pass |
testMintGatedByCoverage |
Confirms minting is blocked when it would break reserve ratio | β Pass |
- β Access control validation
- β Overflow/underflow protection
- β Reentrancy attack prevention
- β Front-running protection
- β Reserve manipulation resistance
- β Gas optimization validation
- β Random mint amounts (256 runs)
- β Multi-operation sequences (256 runs)
- β Reserve manipulation scenarios (256 runs)
- β Transfer edge cases (256 runs)
- β TransferFrom variations (256 runs)
Coverage Report: View detailed coverage on Codecov
# Deploy to Sepolia testnet
source .env
forge script script/Deploy.s.sol:Deploy \
--rpc-url $RPC_URL \
--broadcast \
--verify- Sepolia:
0x4958f53445C83F81101c4A7b7D352c330D9Edfb1 - Explorer: View on Etherscan
- Deployment Tx: 0x64cc4285a4b8931c4e67b60f50fc6ad36cfb3ec1c39b94cd75f82c8e25c264a1
- Issuer:
0x61829Da7A106fcA416e143276c9cbCf63D66fccE - Reserve Wallet:
0x61829Da7A106fcA416e143276c9cbCf63D66fccE - Network: Sepolia Testnet (Chain ID: 11155111)
- Gas Used: 1,331,617
- Deployed: October 25, 2025
// Mint new tokens (only issuer)
function mint(address to, uint256 amount) external onlyIssuer
// Transfer with reserve check
function transfer(address to, uint256 amount) external returns (bool)
// Internal reserve validation
function _checkReserveBacking() internal returns (bool)| Traditional Finance | On-Chain Implementation |
|---|---|
| Custodian Bank | Reserve Wallet Address |
| Transfer Agent | Smart Contract |
| Compliance Officer | Modifier Checks |
| Audit Report | Block Explorer Events |
| Reserve Requirement | _checkReserveBacking() |
| Quarterly Audits | Continuous On-Chain Verification |
- Reserve Reading: Uses
address.balance- production requires oracle feeds - Custody: Simple EOA wallet - production needs qualified custodian integration
- Governance: No pause/upgrade mechanisms - production requires admin controls
- Compliance: Basic implementation - production needs full KYC/AML integration
This project demonstrates expertise in:
- Solidity Smart Contracts
- Blockchain Testing
- TradFi RWA Compliance
- DevOps Deployment
- Technical Documentation
Week 2: Oracle integration for real-world asset prices Week 3: Multi-sig custody and governance Week 4: Cross-chain bridge for multi-network deployment Week 5: Compliance dashboard and reporting tools
MIT License - see LICENSE for details
Contributions are welcome! Please read our Contributing Guidelines first.
- Security: security@specchain.io
- Twitter: @specchain
- Discord: Join our community