Skip to content
Draft
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
27 changes: 25 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
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the misleading price documentation. The issue was that line 16 claimed "$3 minimum price floor" but the smart contract actually validates ETH at 3 ether (not $3), while USDT/USDC use $3 equivalent values. Updated the documentation to accurately describe the validation requirements without the misleading "$3" claim for all currencies.

Commit: fd7aa93

- 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 @@ -50,18 +54,37 @@ npx hardhat run scripts/deploy-DE.js
- `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

The SEQICO contract enforces minimum price requirements for SEQ tokens across all supported payment methods:

- **ETH**: Minimum 3 ether (3,000,000,000,000,000,000 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)

This validation is applied in:
- Contract deployment (constructor)
- All price setter functions (`setPricePerTokenETH`, `setPricePerTokenUSDT`, `setPricePerTokenUSDC`)

Any attempt to set a price below these minimums will result in a transaction revert with the message: **"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
21 changes: 20 additions & 1 deletion contracts/SEQICO.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ contract SEQICO is Ownable {
uint256 _pricePerTokenETH,
uint256 _pricePerTokenUSDT,
uint256 _pricePerTokenUSDC
) {
) Ownable(msg.sender) {
require(_pricePerTokenETH >= 3 ether, "Price must be greater than or equal to $3");
require(_pricePerTokenUSDT >= 3 * 10**6, "Price must be greater than or equal to $3");
require(_pricePerTokenUSDC >= 3 * 10**6, "Price must be greater than or equal to $3");

seqToken = IERC20(_seqToken);
usdt = IERC20(_usdt);
usdc = IERC20(_usdc);
Expand All @@ -35,6 +39,21 @@ contract SEQICO is Ownable {
seqToken = IERC20(_seqToken);
}

function setPricePerTokenETH(uint256 _pricePerTokenETH) external onlyOwner {
require(_pricePerTokenETH >= 3 ether, "Price must be greater than or equal to $3");
pricePerTokenETH = _pricePerTokenETH;
}

function setPricePerTokenUSDT(uint256 _pricePerTokenUSDT) external onlyOwner {
require(_pricePerTokenUSDT >= 3 * 10**6, "Price must be greater than or equal to $3");
pricePerTokenUSDT = _pricePerTokenUSDT;
}

function setPricePerTokenUSDC(uint256 _pricePerTokenUSDC) external onlyOwner {
require(_pricePerTokenUSDC >= 3 * 10**6, "Price must be greater than or equal to $3");
pricePerTokenUSDC = _pricePerTokenUSDC;
}

function buyWithETH(uint256 tokenAmount) external payable {
require(tokenAmount > 0, "Amount must be greater than 0");
uint256 requiredETH = pricePerTokenETH * tokenAmount;
Expand Down
5 changes: 1 addition & 4 deletions contracts/SEQToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@ contract SEQToken is ERC20, Ownable {
uint256 totalSupply,
address owner,
address icoContract
) ERC20("SEQ Token", "SEQ") {
) ERC20("SEQ Token", "SEQ") Ownable(owner) {
// Mint 10% to owner, 90% to ICO contract
uint256 ownerAmount = (totalSupply * 10) / 100;
uint256 icoAmount = totalSupply - ownerAmount;

_mint(owner, ownerAmount);
_mint(icoContract, icoAmount);

// Transfer ownership to the specified owner
_transferOwnership(owner);
}
}
3 changes: 3 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import "@nomicfoundation/hardhat-ethers";
import "@nomicfoundation/hardhat-chai-matchers";

/** @type import('hardhat/config').HardhatUserConfig */
export default {
solidity: "0.8.24"
Expand Down
Loading