fix(contracts): fix constructor arguments in deploy script and remove inline assembly

This commit is contained in:
oib
2026-02-27 23:07:52 +01:00
parent 7b33f9e417
commit c6f1bcb62a

View File

@@ -28,10 +28,36 @@ async function main() {
};
try {
// Deploy core contracts
// Deploy prerequisites first
console.log("📦 Deploying AIToken (Mock)...");
const AIToken = await ethers.getContractFactory("AIToken");
const initialSupply = ethers.parseEther("1000000000"); // 1B tokens
const aiToken = await AIToken.deploy(initialSupply);
await aiToken.waitForDeployment();
const aitbcTokenAddr = await aiToken.getAddress();
deployedContracts.contracts.AIToken = aitbcTokenAddr;
console.log(`✅ AIToken deployed: ${aitbcTokenAddr}`);
console.log("📦 Deploying ZKReceiptVerifier...");
const ZKReceiptVerifier = await ethers.getContractFactory("ZKReceiptVerifier");
const zkVerifier = await ZKReceiptVerifier.deploy();
await zkVerifier.waitForDeployment();
const zkVerifierAddr = await zkVerifier.getAddress();
deployedContracts.contracts.ZKReceiptVerifier = zkVerifierAddr;
console.log(`✅ ZKReceiptVerifier deployed: ${zkVerifierAddr}`);
console.log("📦 Deploying Groth16Verifier...");
const Groth16Verifier = await ethers.getContractFactory("Groth16Verifier");
const groth16Verifier = await Groth16Verifier.deploy();
await groth16Verifier.waitForDeployment();
const groth16VerifierAddr = await groth16Verifier.getAddress();
deployedContracts.contracts.Groth16Verifier = groth16VerifierAddr;
console.log(`✅ Groth16Verifier deployed: ${groth16VerifierAddr}`);
// Deploy core contracts with correct arguments
console.log("📦 Deploying AgentWallet...");
const AgentWallet = await ethers.getContractFactory("AgentWallet");
const agentWallet = await AgentWallet.deploy();
const agentWallet = await AgentWallet.deploy(aitbcTokenAddr);
await agentWallet.waitForDeployment();
const agentWalletAddr = await agentWallet.getAddress();
deployedContracts.contracts.AgentWallet = agentWalletAddr;
@@ -39,23 +65,46 @@ async function main() {
console.log("📦 Deploying AIPowerRental...");
const AIPowerRental = await ethers.getContractFactory("AIPowerRental");
const aiPowerRental = await AIPowerRental.deploy();
const aiPowerRental = await AIPowerRental.deploy(
aitbcTokenAddr,
zkVerifierAddr,
groth16VerifierAddr
);
await aiPowerRental.waitForDeployment();
const aiPowerRentalAddr = await aiPowerRental.getAddress();
deployedContracts.contracts.AIPowerRental = aiPowerRentalAddr;
console.log(`✅ AIPowerRental deployed: ${aiPowerRentalAddr}`);
console.log("📦 Deploying AgentServiceMarketplace...");
const AgentServiceMarketplace = await ethers.getContractFactory("AgentServiceMarketplace");
const agentServiceMarketplace = await AgentServiceMarketplace.deploy();
await agentServiceMarketplace.waitForDeployment();
const agentServiceMarketplaceAddr = await agentServiceMarketplace.getAddress();
deployedContracts.contracts.AgentServiceMarketplace = agentServiceMarketplaceAddr;
console.log(`✅ AgentServiceMarketplace deployed: ${agentServiceMarketplaceAddr}`);
console.log("📦 Deploying PerformanceVerifier...");
const PerformanceVerifier = await ethers.getContractFactory("PerformanceVerifier");
const performanceVerifier = await PerformanceVerifier.deploy(
zkVerifierAddr,
groth16VerifierAddr,
aiPowerRentalAddr
);
await performanceVerifier.waitForDeployment();
const performanceVerifierAddr = await performanceVerifier.getAddress();
deployedContracts.contracts.PerformanceVerifier = performanceVerifierAddr;
console.log(`✅ PerformanceVerifier deployed: ${performanceVerifierAddr}`);
console.log("📦 Deploying AgentBounty...");
const AgentBounty = await ethers.getContractFactory("AgentBounty");
const agentBounty = await AgentBounty.deploy(
aitbcTokenAddr,
performanceVerifierAddr
);
await agentBounty.waitForDeployment();
const agentBountyAddr = await agentBounty.getAddress();
deployedContracts.contracts.AgentBounty = agentBountyAddr;
console.log(`✅ AgentBounty deployed: ${agentBountyAddr}`);
console.log("📦 Deploying DynamicPricing...");
const DynamicPricing = await ethers.getContractFactory("DynamicPricing");
const dynamicPricing = await DynamicPricing.deploy();
const dynamicPricing = await DynamicPricing.deploy(
aiPowerRentalAddr,
performanceVerifierAddr,
aitbcTokenAddr
);
await dynamicPricing.waitForDeployment();
const dynamicPricingAddr = await dynamicPricing.getAddress();
deployedContracts.contracts.DynamicPricing = dynamicPricingAddr;
@@ -63,7 +112,10 @@ async function main() {
console.log("📦 Deploying AgentStaking...");
const AgentStaking = await ethers.getContractFactory("AgentStaking");
const agentStaking = await AgentStaking.deploy();
const agentStaking = await AgentStaking.deploy(
aitbcTokenAddr,
performanceVerifierAddr
);
await agentStaking.waitForDeployment();
const agentStakingAddr = await agentStaking.getAddress();
deployedContracts.contracts.AgentStaking = agentStakingAddr;