Spaces:
Runtime error
Runtime error
| const { ethers } = require("hardhat"); | |
| async function main() { | |
| console.log("Deploying AgroExchange contract..."); | |
| const [deployer] = await ethers.getSigners(); | |
| console.log("Deploying with account:", deployer.address); | |
| const balance = await ethers.provider.getBalance(deployer.address); | |
| console.log("Account balance:", ethers.formatEther(balance), "ETH"); | |
| // Deploy contract | |
| const AgroExchange = await ethers.getContractFactory("AgroExchange"); | |
| const agroExchange = await AgroExchange.deploy(); | |
| await agroExchange.waitForDeployment(); | |
| const address = await agroExchange.getAddress(); | |
| console.log("AgroExchange deployed to:", address); | |
| // Log deployment info | |
| console.log("\n=== Deployment Summary ==="); | |
| console.log("Contract Address:", address); | |
| console.log("Owner:", deployer.address); | |
| console.log("Network:", network.name); // eslint-disable-line no-undef | |
| console.log("Gas Used:", (await agroExchange.deploymentTransaction().wait()).gasUsed.toString()); | |
| // Verify contract settings | |
| const platformFee = await agroExchange.platformFeePercent(); | |
| console.log("Platform Fee:", platformFee.toString(), "basis points (", Number(platformFee) / 100, "%)"); | |
| return address; | |
| } | |
| main() | |
| .then(() => process.exit(0)) | |
| .catch((error) => { | |
| console.error(error); | |
| process.exit(1); | |
| }); | |