| import json |
| import os |
| from web3 import Web3 |
| from config import AppConfig |
|
|
| |
| |
| w3 = Web3(Web3.HTTPProvider(AppConfig.PURECHAIN_RPC_URL)) |
| account = w3.eth.account.from_key(AppConfig.PRIVATE_KEY) |
|
|
| print(f"🔌 Connected to: {AppConfig.PURECHAIN_RPC_URL}") |
| print(f"👤 Deploying as: {account.address}") |
|
|
| |
| print("⚙️ Dynamically compiling contract...") |
| from src.dynamic_compiler import get_contract_interface |
| abi, bytecode = get_contract_interface() |
|
|
| |
| |
| Contract = w3.eth.contract(abi=abi, bytecode=bytecode) |
|
|
| |
| |
| print("🛠 Building Legacy Transaction...") |
| tx = Contract.constructor().build_transaction({ |
| 'from': account.address, |
| 'nonce': w3.eth.get_transaction_count(account.address), |
| 'gas': 6000000, |
| 'gasPrice': 0, |
| 'chainId': 900520900520 |
| }) |
|
|
| |
| print("✍️ Signing...") |
| signed_tx = w3.eth.account.sign_transaction(tx, AppConfig.PRIVATE_KEY) |
|
|
| print("🚀 Sending to Pure Chain...") |
| tx_hash = w3.eth.send_raw_transaction(signed_tx.raw_transaction) |
| print(f"✅ Transaction Sent! Hash: {w3.to_hex(tx_hash)}") |
|
|
| |
| print("⏳ Waiting for confirmation...") |
| tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash) |
|
|
| print("-" * 30) |
| print(f"🎉 CONTRACT DEPLOYED AT: {tx_receipt.contractAddress}") |
| print("-" * 30) |
| print("👉 Copy this address and put it in your config.py!") |