Migrate contracts directory from npm to pnpm

- Delete package-lock.json and create pnpm-lock.yaml
- Add .npmrc with strict peer deps and frozen lockfile settings
- Update CI workflows to use pnpm instead of npm
- Update shell scripts to use pnpm instead of npm/npx
- Update documentation to reference pnpm commands
- Validate migration with successful hardhat compile
This commit is contained in:
aitbc
2026-05-22 22:28:32 +02:00
parent de8e08cc0a
commit dcc08e7569
15 changed files with 783 additions and 7531 deletions

View File

@@ -50,7 +50,13 @@ jobs:
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npm install
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Run gas usage benchmarks
@@ -60,7 +66,7 @@ jobs:
echo "🧪 Running gas usage benchmarks"
# Run benchmarks (gas reporting will be added when tests are implemented)
npx hardhat test test/benchmarks/gas-usage.test.js
pnpm hardhat test test/benchmarks/gas-usage.test.js
echo "✅ Gas usage benchmarks completed"
@@ -103,7 +109,13 @@ jobs:
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npm install
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Run execution time benchmarks
@@ -112,7 +124,7 @@ jobs:
echo "🧪 Running execution time benchmarks"
npx hardhat test test/benchmarks/execution-time.test.js
pnpm hardhat test test/benchmarks/execution-time.test.js
echo "✅ Execution time benchmarks completed"
@@ -154,7 +166,13 @@ jobs:
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npm install
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Run throughput benchmarks
@@ -163,7 +181,7 @@ jobs:
echo "🧪 Running throughput benchmarks"
npx hardhat test test/benchmarks/throughput.test.js
pnpm hardhat test test/benchmarks/throughput.test.js
echo "✅ Throughput benchmarks completed"

View File

@@ -61,8 +61,14 @@ jobs:
if: inputs.skip_tests != true
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npm install
npx hardhat test
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
pnpm hardhat test
echo "✅ Contract tests passed"
- name: Verify deployment readiness
@@ -105,13 +111,19 @@ jobs:
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npm install
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Compile contracts
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npx hardhat compile
pnpm hardhat compile
echo "✅ Contracts compiled"
- name: Deploy contracts to mainnet
@@ -124,7 +136,7 @@ jobs:
export MAINNET_RPC_URL=${{ secrets.MAINNET_RPC_URL }}
# Deploy contracts with gas optimization
npx hardhat run scripts/deploy-mainnet.js --network mainnet
pnpm hardhat run scripts/deploy-mainnet.js --network mainnet
echo "✅ Contracts deployed to mainnet"
@@ -140,16 +152,16 @@ jobs:
echo "🔍 Verifying contracts on Etherscan..."
# Verify PaymentProcessor
npx hardhat verify --network mainnet $PAYMENT_PROCESSOR_ADDRESS --constructor-args scripts/deployment/args/payment-processor-args.js
pnpm hardhat verify --network mainnet $PAYMENT_PROCESSOR_ADDRESS --constructor-args scripts/deployment/args/payment-processor-args.js
# Verify AgentMarketplace
npx hardhat verify --network mainnet $AGENT_MARKETPLACE_ADDRESS --constructor-args scripts/deployment/args/agent-marketplace-args.js
pnpm hardhat verify --network mainnet $AGENT_MARKETPLACE_ADDRESS --constructor-args scripts/deployment/args/agent-marketplace-args.js
# Verify StakingContract
npx hardhat verify --network mainnet $STAKING_CONTRACT_ADDRESS --constructor-args scripts/deployment/args/staking-contract-args.js
pnpm hardhat verify --network mainnet $STAKING_CONTRACT_ADDRESS --constructor-args scripts/deployment/args/staking-contract-args.js
# Verify TreasuryManager
npx hardhat verify --network mainnet $TREASURY_MANAGER_ADDRESS --constructor-args scripts/deployment/args/treasury-manager-args.js
pnpm hardhat verify --network mainnet $TREASURY_MANAGER_ADDRESS --constructor-args scripts/deployment/args/treasury-manager-args.js
echo "✅ All contracts verified on Etherscan"

View File

@@ -51,20 +51,26 @@ jobs:
- name: Setup Node.js environment
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npm install
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Compile contracts
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npx hardhat compile
pnpm hardhat compile
echo "✅ Contracts compiled"
- name: Run contract tests
continue-on-error: true
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npx hardhat test || echo "⚠️ Some contract tests failed - continuing with deployment"
pnpm hardhat test || echo "⚠️ Some contract tests failed - continuing with deployment"
echo "✅ Contract tests completed"
- name: Deploy contracts to testnet
@@ -87,7 +93,7 @@ jobs:
export TESTNET_EXPLORER_URL=${{ secrets.TESTNET_EXPLORER_URL }}
# Verify deployed contracts
npx hardhat verify --network testnet DEPLOYED_CONTRACT_ADDRESS CONSTRUCTOR_ARGS
pnpm hardhat verify --network testnet DEPLOYED_CONTRACT_ADDRESS CONSTRUCTOR_ARGS
echo "✅ Contracts verified on block explorer"

View File

@@ -58,16 +58,21 @@ jobs:
exit 0
fi
echo "Node: $(node --version), npm: $(npm --version)"
echo "Node: $(node --version), pnpm: $(pnpm --version)"
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
# Install
npm install --legacy-peer-deps
pnpm install
# Compile
if [[ -f "hardhat.config.js" ]] || [[ -f "hardhat.config.ts" ]]; then
npx hardhat compile
pnpm hardhat compile
echo "✅ Compiled"
npx hardhat test
pnpm hardhat test
echo "✅ Tests passed"
elif [[ -f "foundry.toml" ]]; then
forge build
@@ -76,10 +81,10 @@ jobs:
echo "✅ Tests passed"
else
if node -e "const pkg=require('./package.json'); process.exit(pkg.scripts && pkg.scripts.compile ? 0 : 1)"; then
npm run compile
pnpm run compile
echo "✅ Compiled"
elif node -e "const pkg=require('./package.json'); process.exit(pkg.scripts && pkg.scripts.build ? 0 : 1)"; then
npm run build
pnpm run build
echo "✅ Compiled"
else
echo "❌ No compile or build script found"
@@ -87,7 +92,7 @@ jobs:
fi
if node -e "const pkg=require('./package.json'); process.exit(pkg.scripts && pkg.scripts.test ? 0 : 1)"; then
npm test
pnpm test
echo "✅ Tests passed"
else
echo "❌ No test script found"
@@ -189,10 +194,15 @@ jobs:
if [[ -d "$project" ]] && [[ -f "$project/package.json" ]]; then
echo "=== Linting $project ==="
cd "$project"
npm install --legacy-peer-deps
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
if node -e "const pkg=require('./package.json'); process.exit(pkg.scripts && pkg.scripts.lint ? 0 : 1)"; then
npm run lint
pnpm run lint
echo "✅ Lint passed"
else
echo "⚠️ No lint script for $project, skipping"
@@ -237,23 +247,28 @@ jobs:
echo "=== Deploying Contracts to Localhost ==="
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
# Install dependencies
npm install --legacy-peer-deps
pnpm install
# Compile contracts
npx hardhat compile
pnpm hardhat compile
# Start local node in background
npx hardhat node &
pnpm hardhat node &
NODE_PID=$!
sleep 10
# Deploy contracts
npx hardhat run scripts/deploy-automation.js --network localhost
pnpm hardhat run scripts/deploy-automation.js --network localhost
echo "✅ Contracts deployed successfully"
# Verify deployment
DEPLOYMENT_FILE="deployments-localhost.json" npx hardhat run scripts/verify-deployment.js --network localhost
DEPLOYMENT_FILE="deployments-localhost.json" pnpm hardhat run scripts/verify-deployment.js --network localhost
echo "✅ Deployment verified"
# Cleanup

View File

@@ -145,7 +145,12 @@ jobs:
run: |
cd "${{ env.WORKSPACE }}/repo/contracts"
npm install
# Install pnpm if not available
if ! command -v pnpm &> /dev/null; then
npm install -g pnpm
fi
pnpm install
echo "✅ Node.js environment ready"
- name: Run staking contract tests
@@ -153,8 +158,8 @@ jobs:
cd "${{ env.WORKSPACE }}/repo/contracts"
echo "🧪 Running staking contract tests..."
npx hardhat compile
npx hardhat test test/AgentStaking.test.js
pnpm hardhat compile
pnpm hardhat test test/AgentStaking.test.js
echo "✅ Contract tests completed"
- name: Cleanup

4
contracts/.npmrc Normal file
View File

@@ -0,0 +1,4 @@
auto-install-peers=false
strict-peer-dependencies=true
prefer-frozen-lockfile=true
shamefully-hoist=true

View File

@@ -152,8 +152,8 @@ docs/
## 🎯 **Next Steps**
### **✅ Ready for Production**
1. **Deploy to Testnet**: `npm run deploy-phase4`
2. **Run Verification**: `npm run verify-phase4`
1. **Deploy to Testnet**: `pnpm run deploy-phase4`
2. **Run Verification**: `pnpm run verify-phase4`
3. **Integration Testing**: Test with existing AITBC contracts
4. **Mainnet Deployment**: Production deployment

View File

@@ -198,16 +198,16 @@ The ContractRegistry enables:
### **Deployment Commands**
```bash
# Compile contracts
npm run compile
pnpm run compile
# Deploy Phase 4 modular contracts
npm run deploy-phase4
pnpm run deploy-phase4
# Run comprehensive tests
npm run test-phase4
pnpm run test-phase4
# Verify deployment
npm run verify-phase4
pnpm run verify-phase4
```
### **Configuration**

View File

@@ -2,7 +2,7 @@
"_format": "hh-sol-cache-2",
"files": {
"/opt/aitbc/contracts/contracts/AIPowerRental.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446277,
"contentHash": "d8c0ce86b1f2b089fa6f06084b7cb190",
"sourceName": "contracts/AIPowerRental.sol",
"solcConfig": {
@@ -303,7 +303,7 @@
]
},
"/opt/aitbc/contracts/contracts/PerformanceVerifier.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446313,
"contentHash": "4c06ef6a765d764a5561389584e9d4ef",
"sourceName": "contracts/PerformanceVerifier.sol",
"solcConfig": {
@@ -536,7 +536,7 @@
]
},
"/opt/aitbc/contracts/contracts/TreasuryManager.sol": {
"lastModificationDate": 1776798809550,
"lastModificationDate": 1778145446317,
"contentHash": "4b2fe1b18bb9d35d4302593ba04c9c9f",
"sourceName": "contracts/TreasuryManager.sol",
"solcConfig": {
@@ -580,7 +580,7 @@
]
},
"/opt/aitbc/contracts/contracts/ContractRegistry.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446305,
"contentHash": "fe9d06f15a808ea45ceee1baaafce6fa",
"sourceName": "contracts/ContractRegistry.sol",
"solcConfig": {
@@ -665,7 +665,7 @@
]
},
"/opt/aitbc/contracts/contracts/StakingPoolFactory.sol": {
"lastModificationDate": 1776798809550,
"lastModificationDate": 1778145446313,
"contentHash": "7679638d7265ded0348342ad3f040808",
"sourceName": "contracts/StakingPoolFactory.sol",
"solcConfig": {
@@ -709,7 +709,7 @@
]
},
"/opt/aitbc/contracts/contracts/RewardDistributor.sol": {
"lastModificationDate": 1776798809550,
"lastModificationDate": 1778145446313,
"contentHash": "53b2bbac86b3e883647a8e0ac5443afa",
"sourceName": "contracts/RewardDistributor.sol",
"solcConfig": {
@@ -753,7 +753,7 @@
]
},
"/opt/aitbc/contracts/contracts/PerformanceAggregator.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446313,
"contentHash": "aac6767f07379cb2fca471c04b780055",
"sourceName": "contracts/PerformanceAggregator.sol",
"solcConfig": {
@@ -795,7 +795,7 @@
]
},
"/opt/aitbc/contracts/contracts/DAOGovernanceEnhanced.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446309,
"contentHash": "389b30f1a2bddc7bab05aa470322cc13",
"sourceName": "contracts/DAOGovernanceEnhanced.sol",
"solcConfig": {
@@ -838,7 +838,7 @@
]
},
"/opt/aitbc/contracts/contracts/MemoryVerifier.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446313,
"contentHash": "0774eb50ca48ba109f10505731c47a71",
"sourceName": "contracts/MemoryVerifier.sol",
"solcConfig": {
@@ -877,7 +877,7 @@
]
},
"/opt/aitbc/contracts/contracts/AgentMemory.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446301,
"contentHash": "d65664faa2b98da3286309fbf9619a92",
"sourceName": "contracts/AgentMemory.sol",
"solcConfig": {
@@ -917,7 +917,7 @@
]
},
"/opt/aitbc/contracts/contracts/KnowledgeGraphMarket.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446313,
"contentHash": "ea02313df07f22808306946349dafcab",
"sourceName": "contracts/KnowledgeGraphMarket.sol",
"solcConfig": {
@@ -1001,7 +1001,7 @@
]
},
"/opt/aitbc/contracts/contracts/AITBCPaymentProcessor.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446293,
"contentHash": "5ec26ac0543a051dc1941c013ad73639",
"sourceName": "contracts/AITBCPaymentProcessor.sol",
"solcConfig": {
@@ -1043,7 +1043,7 @@
]
},
"/opt/aitbc/contracts/contracts/DisputeResolution.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446309,
"contentHash": "f4f92c013eb32e8083a38d42037a1586",
"sourceName": "contracts/DisputeResolution.sol",
"solcConfig": {
@@ -1086,7 +1086,7 @@
]
},
"/opt/aitbc/contracts/contracts/DynamicPricing.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446309,
"contentHash": "369efa756a98c8775c28ad327f0214c9",
"sourceName": "contracts/DynamicPricing.sol",
"solcConfig": {
@@ -1129,7 +1129,7 @@
]
},
"/opt/aitbc/contracts/contracts/DAOGovernance.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446309,
"contentHash": "eedc031861f30107b2eddd1aab3f22d0",
"sourceName": "contracts/DAOGovernance.sol",
"solcConfig": {
@@ -1170,7 +1170,7 @@
]
},
"/opt/aitbc/contracts/contracts/CrossChainReputation.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446305,
"contentHash": "66140705bb9ab2298187dac9d432683f",
"sourceName": "contracts/CrossChainReputation.sol",
"solcConfig": {
@@ -1208,7 +1208,7 @@
]
},
"/opt/aitbc/contracts/contracts/CrossChainBridge.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446305,
"contentHash": "4f2d2d2cfde1b1784b5bf00eb2a71228",
"sourceName": "contracts/CrossChainBridge.sol",
"solcConfig": {
@@ -1437,7 +1437,7 @@
]
},
"/opt/aitbc/contracts/contracts/AgentPortfolioManager.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446301,
"contentHash": "81870b762005afada2741c1940e91bcb",
"sourceName": "contracts/AgentPortfolioManager.sol",
"solcConfig": {
@@ -1523,7 +1523,7 @@
]
},
"/opt/aitbc/contracts/contracts/CrossChainAtomicSwap.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446305,
"contentHash": "a565b38a8b80295fc48923eebca31763",
"sourceName": "contracts/CrossChainAtomicSwap.sol",
"solcConfig": {
@@ -1734,7 +1734,7 @@
]
},
"/opt/aitbc/contracts/contracts/AgentWallet.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446305,
"contentHash": "95b1c5ed8ed5c2ea1228eaff07a71894",
"sourceName": "contracts/AgentWallet.sol",
"solcConfig": {
@@ -1775,7 +1775,7 @@
]
},
"/opt/aitbc/contracts/contracts/AgentServiceMarketplace.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446301,
"contentHash": "17dabc7a7ddcedf8b2443ce8e28f8c66",
"sourceName": "contracts/AgentServiceMarketplace.sol",
"solcConfig": {
@@ -1817,7 +1817,7 @@
]
},
"/opt/aitbc/contracts/contracts/AgentMarketplaceV2.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446301,
"contentHash": "0527d6127218f552ade59c56bc5673d0",
"sourceName": "contracts/AgentMarketplaceV2.sol",
"solcConfig": {
@@ -1859,7 +1859,7 @@
]
},
"/opt/aitbc/contracts/contracts/AgentCommunication.sol": {
"lastModificationDate": 1776798809546,
"lastModificationDate": 1778145446301,
"contentHash": "2570253be1f560aae48e69e15bf67288",
"sourceName": "contracts/AgentCommunication.sol",
"solcConfig": {
@@ -2006,6 +2006,640 @@
"artifacts": [
"IERC1271"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/security/Pausable.sol": {
"lastModificationDate": 1779481488709,
"contentHash": "25c8108f36fdd472bc78d4c4af240c11",
"sourceName": "@openzeppelin/contracts/security/Pausable.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"../utils/Context.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"Pausable"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/access/Ownable.sol": {
"lastModificationDate": 1779481488709,
"contentHash": "5a20b2cad87ddb61c7a3a6af21289e28",
"sourceName": "@openzeppelin/contracts/access/Ownable.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"../utils/Context.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"Ownable"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol": {
"lastModificationDate": 1779481488713,
"contentHash": "1535f8c0c68463f8c1b5239f7584e71f",
"sourceName": "@openzeppelin/contracts/security/ReentrancyGuard.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"ReentrancyGuard"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"lastModificationDate": 1779481488705,
"contentHash": "df36f7051335cd1e748b1b6463b7fdd3",
"sourceName": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"IERC20"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/Context.sol": {
"lastModificationDate": 1779481488697,
"contentHash": "f07feb4a44b1a4872370da5aa70e8e46",
"sourceName": "@openzeppelin/contracts/utils/Context.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"Context"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol": {
"lastModificationDate": 1779481488701,
"contentHash": "3ae5166c6827a9cf1a7a462d1632b464",
"sourceName": "@openzeppelin/contracts/token/ERC20/ERC20.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"./IERC20.sol",
"./extensions/IERC20Metadata.sol",
"../../utils/Context.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"ERC20"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"lastModificationDate": 1779481488705,
"contentHash": "909ab67fc5c25033fe6cd364f8c056f9",
"sourceName": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"../IERC20.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"IERC20Metadata"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
"lastModificationDate": 1779481488713,
"contentHash": "1b5d667d3740d866eca0352758e59827",
"sourceName": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"../IERC20.sol",
"../extensions/IERC20Permit.sol",
"../../../utils/Address.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"SafeERC20"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol": {
"lastModificationDate": 1779481488709,
"contentHash": "525fcdad8d171312933f47baf01d1ed8",
"sourceName": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"IERC20Permit"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/Address.sol": {
"lastModificationDate": 1779481488697,
"contentHash": "211ffd288c1588ba8c10eae668ca3c66",
"sourceName": "@openzeppelin/contracts/utils/Address.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.1"
],
"artifacts": [
"Address"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol": {
"lastModificationDate": 1779481488701,
"contentHash": "d822a8a9468649cab463f29f5decf5cc",
"sourceName": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"../Strings.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"ECDSA"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/cryptography/MerkleProof.sol": {
"lastModificationDate": 1779481488709,
"contentHash": "1ccd3348ad628f1330ce36eb6a30618d",
"sourceName": "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"MerkleProof"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/Strings.sol": {
"lastModificationDate": 1779481488713,
"contentHash": "48686fc32a22a3754b8e63321857dd2a",
"sourceName": "@openzeppelin/contracts/utils/Strings.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"./math/Math.sol",
"./math/SignedMath.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"Strings"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/math/Math.sol": {
"lastModificationDate": 1779481488709,
"contentHash": "fe63409d8a06818b926cf89e0ea88b1b",
"sourceName": "@openzeppelin/contracts/utils/math/Math.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"Math"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/math/SignedMath.sol": {
"lastModificationDate": 1779481488713,
"contentHash": "9488ebd4daacfee8ad04811600d7d061",
"sourceName": "@openzeppelin/contracts/utils/math/SignedMath.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"SignedMath"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol": {
"lastModificationDate": 1779481488713,
"contentHash": "53d16b3bec482493405bdc74852eb2cd",
"sourceName": "@openzeppelin/contracts/utils/cryptography/SignatureChecker.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"./ECDSA.sol",
"../../interfaces/IERC1271.sol"
],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"SignatureChecker"
]
},
"/opt/aitbc/contracts/node_modules/.pnpm/@openzeppelin+contracts@4.9.6/node_modules/@openzeppelin/contracts/interfaces/IERC1271.sol": {
"lastModificationDate": 1779481488705,
"contentHash": "8fe867b95c856b204f954a1910e28a1e",
"sourceName": "@openzeppelin/contracts/interfaces/IERC1271.sol",
"solcConfig": {
"version": "0.8.19",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers",
"metadata"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"IERC1271"
]
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ echo "=== AITBC Smart Contract Compilation ==="
# Check if solc is installed
if ! command -v solc &> /dev/null; then
echo "Error: solc (Solidity compiler) not found"
echo "Please install solc: npm install -g solc"
echo "Please install solc: pnpm add -g solc"
exit 1
fi

View File

@@ -2,8 +2,8 @@
# Deploy ZKReceiptVerifier to testnet
#
# Prerequisites:
# npm install -g hardhat @nomicfoundation/hardhat-toolbox
# cd contracts && npm init -y && npm install hardhat
# pnpm install -g hardhat @nomicfoundation/hardhat-toolbox
# cd contracts && pnpm install hardhat
#
# Usage:
# ./scripts/deploy-testnet.sh [--network <network>]
@@ -29,13 +29,13 @@ else
echo "Generating Groth16Verifier.sol from circuit..."
ZK_DIR="$CONTRACTS_DIR/../apps/zk-circuits"
if [[ -f "$ZK_DIR/circuit_final.zkey" ]]; then
npx snarkjs zkey export solidityverifier \
pnpm snarkjs zkey export solidityverifier \
"$ZK_DIR/circuit_final.zkey" \
"$CONTRACTS_DIR/Groth16Verifier.sol"
echo "Generated Groth16Verifier.sol"
else
echo "WARNING: circuit_final.zkey not found. Using stub verifier."
echo "To generate: cd apps/zk-circuits && npx snarkjs groth16 setup ..."
echo "To generate: cd apps/zk-circuits && pnpm snarkjs groth16 setup ..."
fi
fi
@@ -43,18 +43,18 @@ fi
echo ""
echo "--- Step 2: Compile Contracts ---"
cd "$CONTRACTS_DIR"
if command -v npx &>/dev/null && [[ -f "hardhat.config.js" ]]; then
npx hardhat compile
if command -v pnpm &>/dev/null && [[ -f "hardhat.config.js" ]]; then
pnpm hardhat compile
else
echo "Hardhat not configured. Compile manually:"
echo " cd contracts && npx hardhat compile"
echo " cd contracts && pnpm hardhat compile"
fi
# Step 3: Deploy
echo ""
echo "--- Step 3: Deploy to $NETWORK ---"
if command -v npx &>/dev/null && [[ -f "hardhat.config.js" ]]; then
npx hardhat run scripts/deploy.js --network "$NETWORK"
if command -v pnpm &>/dev/null && [[ -f "hardhat.config.js" ]]; then
pnpm hardhat run scripts/deploy.js --network "$NETWORK"
else
echo "Deploy script template:"
echo ""

View File

@@ -4,7 +4,7 @@
#
# Prerequisites:
# pip install slither-analyzer mythril
# npm install -g solc
# pnpm add -g solc
#
# Usage:
# ./scripts/security-analysis.sh [--slither-only | --mythril-only]

View File

@@ -74,7 +74,7 @@ Configure the following secrets in your CI/CD system:
### Local Setup
```bash
cd /opt/aitbc/contracts
npm install
pnpm install
```
---
@@ -101,13 +101,13 @@ export PRIVATE_KEY=<your-testnet-private-key>
export TESTNET_RPC_URL=<testnet-rpc-url>
# Compile contracts
npx hardhat compile
pnpm hardhat compile
# Run tests
npx hardhat test
pnpm hardhat test
# Deploy contracts
npx hardhat run scripts/deploy-testnet.js --network testnet
pnpm hardhat run scripts/deploy-testnet.js --network testnet
```
### Contract Addresses
@@ -152,16 +152,16 @@ export PRIVATE_KEY=<your-mainnet-private-key>
export MAINNET_RPC_URL=<mainnet-rpc-url>
# Compile contracts
npx hardhat compile
pnpm hardhat compile
# Run security scan
bash scripts/ci/security-scan.sh
# Run contract tests
npx hardhat test
pnpm hardhat test
# Deploy contracts
npx hardhat run scripts/deploy-mainnet.js --network mainnet
pnpm hardhat run scripts/deploy-mainnet.js --network mainnet
```
### Deployment Safety
@@ -184,13 +184,13 @@ Automated verification is performed during deployment using:
export ETHERSCAN_API_KEY=<your-etherscan-api-key>
# Verify PaymentProcessor
npx hardhat verify --network mainnet <PAYMENT_PROCESSOR_ADDRESS> --constructor-args scripts/deployment/args/payment-processor-args.js
pnpm hardhat verify --network mainnet <PAYMENT_PROCESSOR_ADDRESS> --constructor-args scripts/deployment/args/payment-processor-args.js
# Verify AgentMarketplace
npx hardhat verify --network mainnet <AGENT_MARKETPLACE_ADDRESS> --constructor-args scripts/deployment/args/agent-marketplace-args.js
pnpm hardhat verify --network mainnet <AGENT_MARKETPLACE_ADDRESS> --constructor-args scripts/deployment/args/agent-marketplace-args.js
# Verify StakingContract
npx hardhat verify --network mainnet <STAKING_CONTRACT_ADDRESS> --constructor-args scripts/deployment/args/staking-contract-args.js
pnpm hardhat verify --network mainnet <STAKING_CONTRACT_ADDRESS> --constructor-args scripts/deployment/args/staking-contract-args.js
```
### Testnet Verification
@@ -270,7 +270,7 @@ bash scripts/monitoring/verify-monitoring.sh <network>
curl -X POST $RPC_URL -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
# Check account balance
npx hardhat run scripts/check-balance.js --network <network>
pnpm hardhat run scripts/check-balance.js --network <network>
```
### Verification Fails
@@ -287,7 +287,7 @@ npx hardhat run scripts/check-balance.js --network <network>
curl https://api.etherscan.io/api?module=contract&action=getabiaddress&address=<CONTRACT_ADDRESS>&apikey=<API_KEY>
# Re-verify with correct arguments
npx hardhat verify --network <network> <ADDRESS> <CONSTRUCTOR_ARGS>
pnpm hardhat verify --network <network> <ADDRESS> <CONSTRUCTOR_ARGS>
```
### Monitoring Not Working

View File

@@ -114,7 +114,7 @@ touch dev/tests/test_new_feature.py
touch dev/scripts/fix_bug.py
# Right way to handle dependencies
npm install # Use in contracts/ directory for smart contracts development
pnpm install # Use in contracts/ directory for smart contracts development
source /opt/aitbc/venv/bin/activate # Use central Python virtual environment
```