Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
node-version: '18'

- name: Install dependencies
run: npm ci
run: npm ci || npm ci --legacy-peer-deps

- name: Run tests
run: npm test
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,14 @@ This project contains:

### SEQICO Contract
- Buy SEQ tokens with ETH, USDT, or USDC
- Configurable pricing for each payment method
- Configurable pricing for each payment method with **minimum price validation**
- Owner-only functions for token management and fund withdrawal
- Automatic ETH refunds for overpayments
- Event logging for all purchases
- **Price validation**: Minimum price requirements enforced:
- ETH: minimum 3 ether (3 × 10¹⁸ wei)
- USDT: minimum 3,000,000 units (equivalent to $3 with 6 decimals)
- USDC: minimum 3,000,000 units (equivalent to $3 with 6 decimals)

### SEQToken Contract
- Standard ERC20 token
Expand Down Expand Up @@ -44,24 +48,52 @@ npx hardhat run scripts/deploy.js
npx hardhat run scripts/deploy-DE.js
```

## Dependencies

This project uses Hardhat v3 with the following key dependencies:
- `@nomicfoundation/hardhat-toolbox-mocha-ethers` - Hardhat toolbox for v3+
- `@nomicfoundation/hardhat-ethers@^4.0.0` - Ethers integration
- `@nomicfoundation/hardhat-ethers-chai-matchers@^3.0.0` - Chai matchers for testing
- `chai@^5.1.2` - Testing framework

### Dependency Updates (January 2025)

The project has been updated to resolve dependency conflicts with the new Hardhat architecture:
- Migrated from `@nomicfoundation/hardhat-chai-matchers@2.1.0` to `@nomicfoundation/hardhat-ethers-chai-matchers@3.0.0`
- Updated to use `@nomicfoundation/hardhat-toolbox-mocha-ethers@3.0.0` compatible with Hardhat v3
- Updated Chai to v5.1.2 for compatibility

## Contract Functions

### SEQICO Contract
- `buyWithETH(uint256 tokenAmount)`: Purchase tokens with ETH
- `buyWithUSDT(uint256 tokenAmount)`: Purchase tokens with USDT
- `buyWithUSDC(uint256 tokenAmount)`: Purchase tokens with USDC
- `setPricePerTokenETH(uint256 _pricePerTokenETH)`: Set ETH price per token (owner only, ≥ 3 ETH)
- `setPricePerTokenUSDT(uint256 _pricePerTokenUSDT)`: Set USDT price per token (owner only, ≥ 3,000,000)
- `setPricePerTokenUSDC(uint256 _pricePerTokenUSDC)`: Set USDC price per token (owner only, ≥ 3,000,000)
- `setSEQToken(address _seqToken)`: Update SEQ token address (owner only)
- `withdrawETH(address payable recipient)`: Withdraw collected ETH (owner only)
- `withdrawERC20(address token, address recipient)`: Withdraw ERC20 tokens (owner only)

## Price Validation Policy

All pricing functions enforce a minimum $3 equivalent:
- ETH prices must be ≥ 3 ether (3000000000000000000 wei)
- USDT/USDC prices must be ≥ 3,000,000 units (equivalent to $3 with 6 decimal places)

Attempts to set prices below these thresholds will revert with: `"Price must be greater than or equal to $3"`

## Configuration

The deployment scripts include configurable parameters:
- Owner address
- USDT/USDC contract addresses
- Token pricing for ETH, USDT, and USDC
- Token pricing for ETH, USDT, and USDC (must meet minimum validation requirements)
- Total supply (500,000 SEQ tokens)

**Note**: When deploying, ensure all price parameters meet the minimum validation requirements, or the deployment will fail.

## License

MIT
2 changes: 1 addition & 1 deletion hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-toolbox-mocha-ethers";

/** @type import('hardhat/config').HardhatUserConfig */
const config = {
Expand Down
Loading
Loading