-
Notifications
You must be signed in to change notification settings - Fork 2
Add dynamic price configuration system with environment variable support to SEQICO smart contract #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
…loyment scripts Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements comprehensive price-setting functionality for the SEQICO ICO smart contract with enforced $3 minimum pricing validation across all payment methods (ETH, USDT, USDC).
Key changes include:
- Added dynamic price setter functions (
setPriceETH
,setPriceUSDT
,setPriceUSDC
) with owner-only access control - Implemented $3 minimum price validation with specific thresholds for each payment method
- Created comprehensive test suite covering price setting, validation, and integration scenarios
Reviewed Changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
contracts/SEQICO.sol | Added price setter functions, minimum price constants, and constructor validation |
contracts/MockERC20.sol | Added mock ERC20 contract for testing with configurable decimals |
test/SEQICO.test.js | Complete test suite covering price setting functions, validation, and edge cases |
scripts/deploy.js | Enhanced deployment with price validation and helpful output |
scripts/deploy-DE.js | Enhanced deployment script with same validation features |
scripts/set-prices.js | New utility script for post-deployment price management |
package.json | Updated with test scripts and additional dependencies |
hardhat.config.js | Converted to ES module format and simplified configuration |
demo.sh | Added demonstration script explaining the new functionality |
README.md | Updated documentation with price floor policy and usage examples |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
…ices validation Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
…figuration Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
// Prices (customize if needed - must meet $3 minimum requirement) | ||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot implement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented environment variable support for USDC pricing. Now supports PRICE_USDC environment variable with fallback to dynamic generation. Commit 847e05c
// Prices (customize as needed - must meet $3 minimum requirement) | ||
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot implement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented environment variable-based USDC price configuration. Now supports PRICE_USDC environment variable with fallback to default $10. Commit 847e05c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All errors
…tion Co-authored-by: sonnyquinn24 <227287527+sonnyquinn24@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
This PR implements dynamic price-setting functionality for the SEQICO ICO smart contract with enforced $3 minimum pricing and flexible configuration options.
What's Added
Smart Contract Enhancements
setPriceETH()
,setPriceUSDT()
, andsetPriceUSDC()
functions with owner-only access controlPriceUpdated
event for transparency on all price changesDynamic Price Configuration System
PRICE_ETH
,PRICE_USDT
, andPRICE_USDC
environment variablesdeploy-DE.js
includesgeneratePrice()
function with configurable variance (±20% default)hardhat.config.js
withpriceConfig
section for default and minimum price settingsTesting Suite
Deployment & Tooling
set-prices.js
utility script for post-deployment price managementDocumentation
Example Usage
Configuration Options
Environment Variables
PRICE_ETH
: ETH price in ether (e.g., "0.01")PRICE_USDT
: USDT price with 6 decimals (e.g., 5000000 for $5.00)PRICE_USDC
: USDC price with 6 decimals (e.g., 4000000 for $4.00)Dynamic Generation
The
deploy-DE.js
script generates random prices around base values with configurable variance while ensuring $3 minimum compliance.Security Features
The implementation provides flexible price configuration while maintaining the contract's existing functionality and follows established patterns for access control and validation.
This pull request was created as a result of the following prompt from Copilot chat.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.