File size: 1,348 Bytes
4495887
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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);
  });