1+ import { ethers } from "hardhat" ;
2+
3+ async function main ( ) {
4+ // Configuration - update these addresses with your deployed contracts
5+ const SEQICO_ADDRESS = "YOUR_DEPLOYED_SEQICO_ADDRESS_HERE" ; // <-- Replace with your deployed SEQICO address
6+ if (
7+ ! SEQICO_ADDRESS ||
8+ SEQICO_ADDRESS === "YOUR_DEPLOYED_SEQICO_ADDRESS_HERE" ||
9+ SEQICO_ADDRESS === "0x..." ||
10+ ! / ^ 0 x [ a - f A - F 0 - 9 ] { 40 } $ / . test ( SEQICO_ADDRESS )
11+ ) {
12+ throw new Error ( "❌ Please set SEQICO_ADDRESS to your deployed SEQICO contract address before running this script." ) ;
13+ }
14+
15+ // New prices to set (must be >= $3 minimum)
16+ const newPriceETH = ethers . parseEther ( "0.015" ) ; // 0.015 ETH per token
17+ const newPriceUSDT = 5_000_000 ; // $5 USDT (6 decimals)
18+ const newPriceUSDC = 4_500_000 ; // $4.5 USDC (6 decimals)
19+
20+ console . log ( "Setting new prices for SEQICO contract..." ) ;
21+ console . log ( "Contract address:" , SEQICO_ADDRESS ) ;
22+
23+ // Get the contract instance
24+ const SEQICO = await ethers . getContractFactory ( "SEQICO" ) ;
25+ const seqICO = SEQICO . attach ( SEQICO_ADDRESS ) ;
26+
27+ // Verify minimum price constants
28+ const minPriceETH = await seqICO . MIN_PRICE_ETH ( ) ;
29+ const minPriceUSD = await seqICO . MIN_PRICE_USD_STABLECOINS ( ) ;
30+
31+ console . log ( "Minimum price ETH:" , ethers . formatEther ( minPriceETH ) , "ETH" ) ;
32+ console . log ( "Minimum price USD stablecoins:" , minPriceUSD . toString ( ) , "(representing $3)" ) ;
33+
34+ // Check current prices
35+ console . log ( "\nCurrent prices:" ) ;
36+ console . log ( "ETH:" , ethers . formatEther ( await seqICO . pricePerTokenETH ( ) ) , "ETH per token" ) ;
37+ console . log ( "USDT:" , ( await seqICO . pricePerTokenUSDT ( ) ) . toString ( ) , "(6 decimals)" ) ;
38+ console . log ( "USDC:" , ( await seqICO . pricePerTokenUSDC ( ) ) . toString ( ) , "(6 decimals)" ) ;
39+
40+ // Validate new prices meet minimum requirements
41+ if ( newPriceETH < minPriceETH ) {
42+ console . error ( "Error: New ETH price is below minimum!" ) ;
43+ return ;
44+ }
45+ if ( newPriceUSDT < minPriceUSD ) {
46+ console . error ( "Error: New USDT price is below $3 minimum!" ) ;
47+ return ;
48+ }
49+ if ( newPriceUSDC < minPriceUSD ) {
50+ console . error ( "Error: New USDC price is below $3 minimum!" ) ;
51+ return ;
52+ }
53+
54+ try {
55+ // Set new ETH price
56+ console . log ( "\nSetting new ETH price..." ) ;
57+ const tx1 = await seqICO . setPriceETH ( newPriceETH ) ;
58+ await tx1 . wait ( ) ;
59+ console . log ( "✅ ETH price updated to:" , ethers . formatEther ( newPriceETH ) , "ETH per token" ) ;
60+
61+ // Set new USDT price
62+ console . log ( "Setting new USDT price..." ) ;
63+ const tx2 = await seqICO . setPriceUSDT ( newPriceUSDT ) ;
64+ await tx2 . wait ( ) ;
65+ console . log ( "✅ USDT price updated to:" , newPriceUSDT . toString ( ) , "($" + ( newPriceUSDT / 1_000_000 ) . toFixed ( 2 ) + ")" ) ;
66+
67+ // Set new USDC price
68+ console . log ( "Setting new USDC price..." ) ;
69+ const tx3 = await seqICO . setPriceUSDC ( newPriceUSDC ) ;
70+ await tx3 . wait ( ) ;
71+ console . log ( "✅ USDC price updated to:" , newPriceUSDC . toString ( ) , "($" + ( newPriceUSDC / 1_000_000 ) . toFixed ( 2 ) + ")" ) ;
72+
73+ console . log ( "\n🎉 All prices updated successfully!" ) ;
74+
75+ // Verify the updates
76+ console . log ( "\nUpdated prices:" ) ;
77+ console . log ( "ETH:" , ethers . formatEther ( await seqICO . pricePerTokenETH ( ) ) , "ETH per token" ) ;
78+ console . log ( "USDT:" , ( await seqICO . pricePerTokenUSDT ( ) ) . toString ( ) , "(6 decimals)" ) ;
79+ console . log ( "USDC:" , ( await seqICO . pricePerTokenUSDC ( ) ) . toString ( ) , "(6 decimals)" ) ;
80+
81+ } catch ( error ) {
82+ console . error ( "Error setting prices:" , error . message ) ;
83+ if ( error . message . includes ( "price below $3 minimum" ) ) {
84+ console . error ( "Make sure all prices meet the $3 minimum requirement!" ) ;
85+ }
86+ if ( error . message . includes ( "OwnableUnauthorizedAccount" ) ) {
87+ console . error ( "Only the contract owner can set prices!" ) ;
88+ }
89+ }
90+ }
91+
92+ main ( ) . catch ( ( error ) => {
93+ console . error ( error ) ;
94+ process . exitCode = 1 ;
95+ } ) ;
0 commit comments