# TokenFactory138 Pre-Deployment Checklist **Date**: 2025-12-24 **Purpose**: Complete checklist before deploying TokenFactory138 --- ## ✅ Compilation Test ### Run Compilation Test ```bash cd /home/intlc/projects/proxmox/smom-dbis-138 # Option 1: Use test script ./scripts/compile-and-test-tokenfactory.sh # Option 2: Manual compilation forge build --via-ir --contracts contracts/emoney/TokenFactory138.sol -vv # Option 3: Full project build forge build --via-ir -vv ``` ### Expected Results - ✅ Compilation successful - ✅ No "Stack too deep" errors (when using --via-ir) - ✅ All imports resolved - ✅ Bytecode generated in `out/TokenFactory138.sol/TokenFactory138.json` --- ## ✅ Dependency Verification TokenFactory138 requires these contracts to be deployed first: 1. **ComplianceRegistry** ✅ (Already deployed: `0xf52504A9c0DAFB0a35dEE0129D6991AA27E734c8`) 2. **DebtRegistry** ⏳ (Check if deployed) 3. **PolicyManager** ⏳ (Check if deployed) 4. **eMoneyToken** (implementation) ⏳ (Check if deployed) ### Check Dependencies ```bash cd /home/intlc/projects/proxmox/smom-dbis-138 source .env # Check if dependencies are deployed cast code $COMPLIANCE_REGISTRY_ADDRESS --rpc-url $RPC_URL | wc -c # Check for other dependencies in .env or deployment logs grep -E "DEBT_REGISTRY|POLICY_MANAGER|EMONEY_TOKEN" .env ``` --- ## ✅ Contract Analysis ### TokenFactory138 Constructor Parameters ```solidity constructor( address admin, // Governance admin address implementation_, // eMoneyToken implementation address policyManager_, // PolicyManager contract address debtRegistry_, // DebtRegistry contract address complianceRegistry_ // ComplianceRegistry contract ) ``` ### Required Addresses Before deployment, ensure you have: - ✅ Admin address (deployer or multisig) - ⏳ eMoneyToken implementation address - ⏳ PolicyManager address - ⏳ DebtRegistry address - ✅ ComplianceRegistry address: `0xf52504A9c0DAFB0a35dEE0129D6991AA27E734c8` --- ## ✅ Deployment Script Check The deployment script `DeployChain138.s.sol` deploys in this order: 1. ComplianceRegistry ✅ 2. DebtRegistry 3. PolicyManager 4. eMoneyToken (implementation) 5. **TokenFactory138** ← Target 6. BridgeVault138 ### Check Script ```bash cd /home/intlc/projects/proxmox/smom-dbis-138 # Verify script exists and is correct cat script/emoney/DeployChain138.s.sol | grep -A 20 "TokenFactory138" ``` --- ## ✅ Known Issues to Check ### 1. Stack Too Deep Error **If you see**: `Error: Stack too deep` **Solution**: Always use `--via-ir` flag: ```bash forge script script/emoney/DeployChain138.s.sol:DeployChain138 \ --rpc-url $RPC_URL \ --broadcast \ --legacy \ --gas-price 20000000000 \ --via-ir \ -vv ``` ### 2. Missing Dependencies **If you see**: `Source "..." not found` **Solution**: - Check all dependency contracts exist - Run `forge build --via-ir` to compile all dependencies first ### 3. Constructor Parameter Mismatch **If you see**: `Wrong argument count for function call` **Solution**: Verify constructor parameters match exactly: - 5 parameters required - All addresses must be valid (non-zero) --- ## ✅ Pre-Deployment Verification ### 1. Compile Successfully ```bash forge build --via-ir ``` ### 2. Check Bytecode Size ```bash cat out/TokenFactory138.sol/TokenFactory138.json | jq -r '.bytecode.object' | wc -c ``` Expected: > 1000 bytes ### 3. Verify Dependencies ```bash # Check all required contracts compile forge build --via-ir --contracts contracts/emoney/*.sol ``` ### 4. Test Deployment Script (Dry Run) ```bash cd /home/intlc/projects/proxmox/smom-dbis-138 source .env # Dry run (no broadcast) forge script script/emoney/DeployChain138.s.sol:DeployChain138 \ --rpc-url $RPC_URL \ --via-ir \ -vv ``` --- ## 🚀 Deployment Command Once all checks pass: ```bash cd /home/intlc/projects/proxmox/smom-dbis-138 source .env forge script script/emoney/DeployChain138.s.sol:DeployChain138 \ --rpc-url $RPC_URL \ --broadcast \ --legacy \ --gas-price 20000000000 \ --via-ir \ -vv ``` **Note**: This will deploy the entire eMoney system, not just TokenFactory138. --- ## 📋 Checklist - [ ] TokenFactory138 compiles with `--via-ir` - [ ] All dependencies compile successfully - [ ] All required addresses available - [ ] Deployment script verified - [ ] Dry run successful - [ ] Ready for deployment --- **Last Updated**: 2025-12-24