2.3 KiB
2.3 KiB
TokenFactory138 Compilation Test Guide
Date: 2025-12-24
Purpose: Test and verify TokenFactory138 compilation before deployment
Quick Test
Run the compilation test script:
cd /home/intlc/projects/proxmox/smom-dbis-138
./scripts/compile-and-test-tokenfactory.sh
Or manually:
cd /home/intlc/projects/proxmox/smom-dbis-138
# Test standard compilation
forge build --contracts contracts/emoney/TokenFactory138.sol 2>&1 | tee /tmp/tf138-std.log
# Test via-ir compilation (recommended for stack too deep)
forge build --via-ir --contracts contracts/emoney/TokenFactory138.sol 2>&1 | tee /tmp/tf138-viair.log
Dependencies Check
TokenFactory138 requires these contracts to exist:
- ✅
contracts/emoney/interfaces/ITokenFactory138.sol - ✅
contracts/emoney/interfaces/IeMoneyToken.sol - ✅
contracts/emoney/interfaces/IPolicyManager.sol - ✅
contracts/emoney/eMoneyToken.sol - ✅
contracts/emoney/errors/FactoryErrors.sol - ✅
contracts/emoney/errors/RegistryErrors.sol - ✅ OpenZeppelin contracts (AccessControl, ERC1967Proxy)
Known Issues
1. Stack Too Deep Error
Symptom: Error: Stack too deep. Try compiling with --via-ir
Solution: Use --via-ir flag:
forge build --via-ir
forge script ... --via-ir
2. Missing Dependencies
Symptom: Source "..." not found
Solution: Ensure all dependency contracts are present and compile successfully.
Deployment Requirements
TokenFactory138 constructor requires:
admin- Admin address (DEFAULT_ADMIN_ROLE)implementation_- eMoneyToken implementation addresspolicyManager_- PolicyManager contract addressdebtRegistry_- DebtRegistry contract addresscomplianceRegistry_- ComplianceRegistry contract address
Deployment Order (from DeployChain138.s.sol):
- ComplianceRegistry
- DebtRegistry
- PolicyManager
- eMoneyToken (implementation)
- TokenFactory138 (requires all above)
Verification Commands
After compilation, verify:
# Check if bytecode was generated
ls -lh out/TokenFactory138.sol/TokenFactory138.json
# Check bytecode size
cat out/TokenFactory138.sol/TokenFactory138.json | jq -r '.bytecode.object' | wc -c
Expected: > 1000 bytes for a factory contract.
Last Updated: 2025-12-24