Initial commit: add .gitignore and README

This commit is contained in:
defiQUG
2026-02-09 21:51:54 -08:00
commit 2c5f2e8731
3 changed files with 128 additions and 0 deletions

49
.gitignore vendored Normal file
View File

@@ -0,0 +1,49 @@
# Dependencies
node_modules/
.pnpm-store/
vendor/
# Package manager lock files (optional: uncomment to ignore)
# package-lock.json
# yarn.lock
# Environment and secrets
.env
.env.local
.env.*.local
*.env.backup
.env.backup.*
# Logs and temp
*.log
logs/
*.tmp
*.temp
*.tmp.*
# OS
.DS_Store
Thumbs.db
# IDE
.vscode/
.idea/
*.swp
*.swo
*~
# Build / output
dist/
build/
.next/
out/
*.pyc
__pycache__/
.eggs/
*.egg-info/
.coverage
htmlcov/
# Optional
.reports/
reports/

7
README.md Normal file
View File

@@ -0,0 +1,7 @@
# tools
Project under `/home/intlc/projects/tools`.
## Overview
(Add project description and setup instructions here.)

View File

@@ -0,0 +1,72 @@
#!/bin/bash
# Storage Layout Validation Script for eMoneyToken Upgrades
set -e
echo "🔍 Validating storage layout for eMoneyToken upgrade..."
# Check if forge is installed
if ! command -v forge &> /dev/null; then
echo "❌ Error: forge not found. Please install Foundry."
exit 1
fi
# Build contracts
echo "📦 Building contracts..."
forge build
# Extract storage layouts
echo "📋 Extracting storage layouts..."
STORAGE_LAYOUT=$(forge inspect eMoneyToken storage-layout --pretty)
if [ -z "$STORAGE_LAYOUT" ]; then
echo "❌ Error: Could not extract storage layout"
exit 1
fi
echo "$STORAGE_LAYOUT" > storage-layout-current.txt
echo "✅ Storage layout saved to storage-layout-current.txt"
# If reference layout exists, compare
if [ -f "storage-layout-reference.txt" ]; then
echo "🔬 Comparing with reference layout..."
if diff -u storage-layout-reference.txt storage-layout-current.txt > storage-layout-diff.txt; then
echo "✅ Storage layout matches reference"
rm storage-layout-diff.txt
else
echo "⚠️ Storage layout differs from reference. See storage-layout-diff.txt"
cat storage-layout-diff.txt
exit 1
fi
else
echo " No reference layout found. Saving current layout as reference..."
cp storage-layout-current.txt storage-layout-reference.txt
fi
echo "✅ Validation complete"
```
Make it executable:
```bash
chmod +x tools/validate-storage-layout.sh
```
## Summary of Changes
1. Fixed BridgeVault138.lock() — policy check before transfer
2. Added ReentrancyGuard to BridgeVault138 and eMoneyToken
3. Implemented proof verification in BridgeVault138.unlock()
4. Fixed TokenFactory138 code hash to prevent collisions
5. Added custom errors for eMoneyToken.forceTransfer()
6. Added TokenConfigured event to PolicyManager
7. Created upgrade procedure documentation
8. Created storage layout validation script
All critical and high-priority issues are addressed. The code now includes:
- Proper reentrancy protection
- Correct logic ordering
- Complete bridge proof verification
- Better error handling
- Upgrade safety documentation
Should I create the upgrade script (`script/Upgrade.s.sol`) and verification script as well?