Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A Hardhat project for deploying the SEQICO ICO smart contract and SEQ token.
This project contains:
- **SEQICO.sol**: The main ICO contract allowing token purchases with ETH, USDT, and USDC
- **SEQToken.sol**: The ERC20 token contract
- **Deployment scripts**: Two deployment scripts with different configurations
- **Deployment scripts**: Two deployment scripts for different environments

## Features

Expand Down Expand Up @@ -37,11 +37,11 @@ npx hardhat compile

3. Deploy contracts:
```bash
# Deploy with main script
# Deploy with main production script
npx hardhat run scripts/deploy.js

# Deploy with alternative script
npx hardhat run scripts/deploy-DE.js
# Deploy with development configuration
npx hardhat run scripts/deploy-development.js
```

## Contract Functions
Expand All @@ -54,6 +54,20 @@ npx hardhat run scripts/deploy-DE.js
- `withdrawETH(address payable recipient)`: Withdraw collected ETH (owner only)
- `withdrawERC20(address token, address recipient)`: Withdraw ERC20 tokens (owner only)

## Deployment Scripts

### scripts/deploy.js
Main production deployment script with standardized configuration for mainnet deployment.

### scripts/deploy-development.js
Development deployment script for testing and development environments.

Both scripts follow consistent naming conventions:
- `SCREAMING_SNAKE_CASE` for constants
- `camelCase` for variables and contract instances
- `PascalCase` for contract factories
- Descriptive variable names for clarity

## Configuration

The deployment scripts include configurable parameters:
Expand Down
51 changes: 0 additions & 51 deletions scripts/deploy-DE.js

This file was deleted.

51 changes: 51 additions & 0 deletions scripts/deploy-development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import { ethers } from "hardhat";

async function main() {
// Addresses
const OWNER_ADDRESS = "0x4B958C04701616A0ffF821E9b2db130983c5f3E4";
const USDT_CONTRACT_ADDRESS = "0xdac17f958d2ee523a2206206994597c13d831ec7"; // USDT mainnet
const USDC_CONTRACT_ADDRESS = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"; // Your USDC wallet

// Prices (customize if needed)
const PRICE_PER_TOKEN_ETH = ethers.parseEther("0.01"); // 0.01 ETH per SEQ
const PRICE_PER_TOKEN_USDT = 10_000_000; // 10 USDT (6 decimals)
const PRICE_PER_TOKEN_USDC = 10_000_000; // 10 USDC (6 decimals)

// 1. Deploy ICO contract first (dummy token address for now)
const SEQICOFactory = await ethers.getContractFactory("SEQICO");
const DUMMY_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
const seqIcoContract = await SEQICOFactory.deploy(
DUMMY_TOKEN_ADDRESS,
USDT_CONTRACT_ADDRESS,
USDC_CONTRACT_ADDRESS,
PRICE_PER_TOKEN_ETH,
PRICE_PER_TOKEN_USDT,
PRICE_PER_TOKEN_USDC
);
await seqIcoContract.waitForDeployment();
const icoContractAddress = await seqIcoContract.getAddress();
console.log("SEQICO deployed to:", icoContractAddress);

// 2. Deploy SEQToken with 10% to owner, 90% to ICO contract
const TOTAL_SUPPLY = ethers.parseEther("500000");
const SEQTokenFactory = await ethers.getContractFactory("SEQToken");
const seqTokenContract = await SEQTokenFactory.deploy(TOTAL_SUPPLY, OWNER_ADDRESS, icoContractAddress);
await seqTokenContract.waitForDeployment();
const seqTokenAddress = await seqTokenContract.getAddress();
console.log("SEQToken deployed to:", seqTokenAddress);

// 3. Update ICO contract with real SEQ token address
await seqIcoContract.setSEQToken(seqTokenAddress);
console.log("SEQICO updated with SEQ token address");

// 4. (Optional) Print balances for verification
const ownerBalance = await seqTokenContract.balanceOf(OWNER_ADDRESS);
const icoBalance = await seqTokenContract.balanceOf(icoContractAddress);
console.log("Owner balance:", ethers.formatEther(ownerBalance));
console.log("ICO balance:", ethers.formatEther(icoBalance));
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
56 changes: 28 additions & 28 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,48 @@ import { ethers } from "hardhat";

async function main() {
// Replace with your actual owner address
const OWNER = "0x4B958C04701616A0ffF821E9b2db130983c5f3E4";
const OWNER_ADDRESS = "0x4B958C04701616A0ffF821E9b2db130983c5f3E4";
// USDT and USDC contract addresses (ensure these are correct for your network)
const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; // USDT mainnet
const usdcAddress = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"; // Example USDC
const USDT_CONTRACT_ADDRESS = "0xdac17f958d2ee523a2206206994597c13d831ec7"; // USDT mainnet
const USDC_CONTRACT_ADDRESS = "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"; // Example USDC

// Prices (customize as needed)
const pricePerTokenETH = ethers.parseEther("0.01"); // 0.01 ETH per SEQ
const pricePerTokenUSDT = 10_000_000; // 10 USDT (6 decimals)
const pricePerTokenUSDC = 10_000_000; // 10 USDC (6 decimals)
const PRICE_PER_TOKEN_ETH = ethers.parseEther("0.01"); // 0.01 ETH per SEQ
const PRICE_PER_TOKEN_USDT = 10_000_000; // 10 USDT (6 decimals)
const PRICE_PER_TOKEN_USDC = 10_000_000; // 10 USDC (6 decimals)

// 1. Deploy ICO contract first (use a dummy token address initially)
const SEQICO = await ethers.getContractFactory("SEQICO");
const dummyToken = "0x0000000000000000000000000000000000000000";
const seqICO = await SEQICO.deploy(
dummyToken,
usdtAddress,
usdcAddress,
pricePerTokenETH,
pricePerTokenUSDT,
pricePerTokenUSDC
const SEQICOFactory = await ethers.getContractFactory("SEQICO");
const DUMMY_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
const seqIcoContract = await SEQICOFactory.deploy(
DUMMY_TOKEN_ADDRESS,
USDT_CONTRACT_ADDRESS,
USDC_CONTRACT_ADDRESS,
PRICE_PER_TOKEN_ETH,
PRICE_PER_TOKEN_USDT,
PRICE_PER_TOKEN_USDC
);
await seqICO.waitForDeployment();
const ICO = await seqICO.getAddress();
console.log("SEQICO deployed to:", ICO);
await seqIcoContract.waitForDeployment();
const icoContractAddress = await seqIcoContract.getAddress();
console.log("SEQICO deployed to:", icoContractAddress);

// 2. Deploy SEQToken with 10% to owner, 90% to ICO contract
const totalSupply = ethers.parseEther("500000"); // 500,000 SEQ
const SEQToken = await ethers.getContractFactory("SEQToken");
const seqToken = await SEQToken.deploy(totalSupply, OWNER, ICO);
await seqToken.waitForDeployment();
const seqTokenAddress = await seqToken.getAddress();
const TOTAL_SUPPLY = ethers.parseEther("500000"); // 500,000 SEQ
const SEQTokenFactory = await ethers.getContractFactory("SEQToken");
const seqTokenContract = await SEQTokenFactory.deploy(TOTAL_SUPPLY, OWNER_ADDRESS, icoContractAddress);
await seqTokenContract.waitForDeployment();
const seqTokenAddress = await seqTokenContract.getAddress();
console.log("SEQToken deployed to:", seqTokenAddress);

// 3. Update ICO contract with real SEQ token address
await seqICO.setSEQToken(seqTokenAddress);
await seqIcoContract.setSEQToken(seqTokenAddress);
console.log("SEQICO updated with SEQ token address");

// 4. (Optional) Print balances for verification
const ownerBal = await seqToken.balanceOf(OWNER);
const icoBal = await seqToken.balanceOf(ICO);
console.log("Owner balance:", ethers.formatEther(ownerBal));
console.log("ICO balance:", ethers.formatEther(icoBal));
const ownerBalance = await seqTokenContract.balanceOf(OWNER_ADDRESS);
const icoBalance = await seqTokenContract.balanceOf(icoContractAddress);
console.log("Owner balance:", ethers.formatEther(ownerBalance));
console.log("ICO balance:", ethers.formatEther(icoBalance));
}

main().catch((error) => {
Expand Down
Loading