Skip to content

Commit f9be56d

Browse files
authored
Merge pull request #50 from sonnyquinn24/copilot/fix-ceb86a71-f65e-447a-af9c-ff556e1855dd
2 parents b6a918a + a5156ef commit f9be56d

File tree

5 files changed

+3221
-964
lines changed

5 files changed

+3221
-964
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
node-version: '18'
1919

2020
- name: Install dependencies
21-
run: npm ci
21+
run: npm ci || npm ci --legacy-peer-deps
2222

2323
- name: Run tests
2424
run: npm test

README.md

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@ This project contains:
1313

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

2125
### SEQToken Contract
2226
- Standard ERC20 token
@@ -44,24 +48,52 @@ npx hardhat run scripts/deploy.js
4448
npx hardhat run scripts/deploy-DE.js
4549
```
4650

51+
## Dependencies
52+
53+
This project uses Hardhat v3 with the following key dependencies:
54+
- `@nomicfoundation/hardhat-toolbox-mocha-ethers` - Hardhat toolbox for v3+
55+
- `@nomicfoundation/hardhat-ethers@^4.0.0` - Ethers integration
56+
- `@nomicfoundation/hardhat-ethers-chai-matchers@^3.0.0` - Chai matchers for testing
57+
- `chai@^5.1.2` - Testing framework
58+
59+
### Dependency Updates (January 2025)
60+
61+
The project has been updated to resolve dependency conflicts with the new Hardhat architecture:
62+
- Migrated from `@nomicfoundation/hardhat-chai-matchers@2.1.0` to `@nomicfoundation/hardhat-ethers-chai-matchers@3.0.0`
63+
- Updated to use `@nomicfoundation/hardhat-toolbox-mocha-ethers@3.0.0` compatible with Hardhat v3
64+
- Updated Chai to v5.1.2 for compatibility
65+
4766
## Contract Functions
4867

4968
### SEQICO Contract
5069
- `buyWithETH(uint256 tokenAmount)`: Purchase tokens with ETH
5170
- `buyWithUSDT(uint256 tokenAmount)`: Purchase tokens with USDT
5271
- `buyWithUSDC(uint256 tokenAmount)`: Purchase tokens with USDC
72+
- `setPricePerTokenETH(uint256 _pricePerTokenETH)`: Set ETH price per token (owner only, ≥ 3 ETH)
73+
- `setPricePerTokenUSDT(uint256 _pricePerTokenUSDT)`: Set USDT price per token (owner only, ≥ 3,000,000)
74+
- `setPricePerTokenUSDC(uint256 _pricePerTokenUSDC)`: Set USDC price per token (owner only, ≥ 3,000,000)
5375
- `setSEQToken(address _seqToken)`: Update SEQ token address (owner only)
5476
- `withdrawETH(address payable recipient)`: Withdraw collected ETH (owner only)
5577
- `withdrawERC20(address token, address recipient)`: Withdraw ERC20 tokens (owner only)
5678

79+
## Price Validation Policy
80+
81+
All pricing functions enforce a minimum $3 equivalent:
82+
- ETH prices must be ≥ 3 ether (3000000000000000000 wei)
83+
- USDT/USDC prices must be ≥ 3,000,000 units (equivalent to $3 with 6 decimal places)
84+
85+
Attempts to set prices below these thresholds will revert with: `"Price must be greater than or equal to $3"`
86+
5787
## Configuration
5888

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

95+
**Note**: When deploying, ensure all price parameters meet the minimum validation requirements, or the deployment will fail.
96+
6597
## License
6698

6799
MIT

hardhat.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "@nomicfoundation/hardhat-ethers";
1+
import "@nomicfoundation/hardhat-toolbox-mocha-ethers";
22

33
/** @type import('hardhat/config').HardhatUserConfig */
44
const config = {

0 commit comments

Comments
 (0)