Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
133 changes: 133 additions & 0 deletions .github/workflows/deploy-verify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
name: πŸš€ Deploy & Verify Dream Contracts

on:
push:
branches: [ main, develop ]
paths:
- 'contracts/**'
- 'agents/**'
- '.github/workflows/**'
pull_request:
branches: [ main ]
paths:
- 'contracts/**'
- 'agents/**'
workflow_dispatch:
inputs:
deploy_to_skale:
description: 'Deploy to SKALE Network'
required: true
default: 'true'
type: boolean

env:
SKALE_RPC: ${{ secrets.SKALE_RPC }}
DEPLOYER_KEY: ${{ secrets.DEPLOYER_KEY }}
SKALE_CHAIN_ID: ${{ secrets.SKALE_CHAIN_ID }}

jobs:
deploy-verify:
runs-on: ubuntu-latest
name: 🌌 IEM Syndicate Deployment

steps:
- name: πŸ“₯ Checkout Repository
uses: actions/checkout@v4

- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'

- name: πŸ“¦ Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: πŸ” Verify Environment
run: |
echo "🌐 SKALE RPC: ${{ env.SKALE_RPC != '' && 'configured' || 'missing' }}"
echo "πŸ”‘ Deployer Key: ${{ env.DEPLOYER_KEY != '' && 'configured' || 'missing' }}"
echo "⛓️ Chain ID: ${{ env.SKALE_CHAIN_ID != '' && 'configured' || 'missing' }}"
python -c "import web3, solcx; print('βœ… Core dependencies available')"

- name: πŸ—οΈ Deploy IEM Dreams Contract
if: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_to_skale == 'true' }} || ${{ github.ref == 'refs/heads/main' }}
run: |
echo "πŸš€ Deploying to SKALE Network..."
python agents/iem_syndicate.py deploy

- name: πŸ”Ž Audit Contract
if: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_to_skale == 'true' }} || ${{ github.ref == 'refs/heads/main' }}
Copy link

Copilot AI Aug 30, 2025

Choose a reason for hiding this comment

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

The same complex conditional expression is repeated multiple times. Consider extracting this to a reusable condition or using job-level conditionals to avoid duplication.

Copilot uses AI. Check for mistakes.
run: |
echo "πŸ” Running security audit..."
python agents/iem_syndicate.py audit

- name: πŸ“‘ Update Oracle State
if: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_to_skale == 'true' }} || ${{ github.ref == 'refs/heads/main' }}
run: |
echo "πŸ“‘ Syncing oracle state..."
python agents/iem_syndicate.py oracle

- name: πŸ’Ύ Archive Deployment Artifacts
if: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_to_skale == 'true' }} || ${{ github.ref == 'refs/heads/main' }}
uses: actions/upload-artifact@v3
with:
name: dream-deployment-${{ github.sha }}
path: |
iem_memory.json
contracts/
retention-days: 30

- name: πŸŽ‰ Deployment Summary
if: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_to_skale == 'true' }} || ${{ github.ref == 'refs/heads/main' }}
run: |
echo "🌌 Dream-Mind-Lucid deployment completed!"
echo "πŸ“‹ Check iem_memory.json for contract details"
if [ -f iem_memory.json ]; then
echo "πŸ“ Contract Address: $(cat iem_memory.json | python -c 'import sys,json; data=json.load(sys.stdin); print(data.get("lastDeployed", {}).get("address", "Not found"))')"
fi
echo "πŸš€ Ready for The Oneiro-Sphere! Target year: 2089"

# Test job for PRs and non-main branches
test-contracts:
runs-on: ubuntu-latest
name: πŸ§ͺ Test Dream Contracts
if: ${{ github.ref != 'refs/heads/main' }}

steps:
- name: πŸ“₯ Checkout Repository
uses: actions/checkout@v4

- name: 🐍 Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'

- name: πŸ“¦ Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: πŸ” Syntax Check
run: |
echo "πŸ” Checking Solidity syntax..."
python -c "
from solcx import compile_standard, install_solc
install_solc('0.8.20')
with open('contracts/IEMDreams.sol') as f:
source = f.read()
compiled = compile_standard({
'language': 'Solidity',
'sources': {'contracts/IEMDreams.sol': {'content': source}},
'settings': {'outputSelection': {'*': {'*': ['abi', 'evm.bytecode']}}}
}, solc_version='0.8.20')
print('βœ… Contract compiles successfully')
"

- name: πŸ”Ž Run Mock Audit
run: |
echo "πŸ” Running contract audit (test mode)..."
python agents/iem_syndicate.py audit
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
.venv/
.env
pip-log.txt
pip-delete-this-directory.txt

# Solidity
artifacts/
cache/
node_modules/

# Project specific
iem_memory.json
*.log

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# OS
.DS_Store
Thumbs.db
54 changes: 44 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,50 @@ In the future (2089), this will become **The Oneiro-Sphere**β€”a giant dream net
- `.github/workflows/deploy-verify.yml`: Auto-magic that builds stuff on GitHub when you save.

## 🚧 How to Build It (For Big Kids or Grown-Ups)
1. **Get Tools**:
- Install Git (git-scm.com) and Python (python.org).
- In your command window, type: `pip install web3 py-solc-x`.
2. **Set Up Secrets**:
- Go to GitHub Settings > Secrets > Actions.
- Add:
- `SKALE_RPC`: `https://mainnet.skalenodes.com/v1/elated-tan-skat`
- `DEPLOYER_KEY`: Your wallet secret key (keep it super secret!).
- `SKALE_CHAIN_ID`: `2046399126`.
3. **Run the Robots**:

### πŸ“‹ Prerequisites
- Install Git (git-scm.com) and Python (python.org)
- GitHub account with repository access

### πŸ”§ Local Development Setup
1. **Clone the repository**:
```bash
git clone https://github.com/imfromfuture3000-Android/Dream-mind-lucid.git
cd Dream-mind-lucid
```

2. **Install Python dependencies**:
```bash
pip install -r requirements.txt
```

3. **Set up environment variables** (for local testing):
```bash
export SKALE_RPC="https://mainnet.skalenodes.com/v1/elated-tan-skat"
export DEPLOYER_KEY="your-wallet-secret-key" # Keep this super secret!
export SKALE_CHAIN_ID="2046399126"
```

### πŸš€ GitHub Actions Automated Deployment

The repository now includes automated GitHub Actions workflows! Here's how to set them up:

1. **Set Up GitHub Secrets** (Repository Settings > Secrets > Actions):
- `SKALE_RPC`: `https://mainnet.skalenodes.com/v1/elated-tan-skat`
- `DEPLOYER_KEY`: Your wallet secret key (keep it super secret!)
- `SKALE_CHAIN_ID`: `2046399126`

2. **Automatic Deployment**:
- Push to `main` branch β†’ Automatically deploys to SKALE
- Create Pull Request β†’ Runs tests and validation
- Manual deployment available via "Actions" tab

3. **Manual Deployment**:
- Go to "Actions" tab in GitHub
- Select "πŸš€ Deploy & Verify Dream Contracts"
- Click "Run workflow" β†’ Enable "Deploy to SKALE Network"

### πŸ› οΈ Local Development Commands
- Go to the folder: `cd Desktop/dream-mind-lucid` (or where you saved it).
- Deploy: `python agents/iem_syndicate.py deploy` (set `DEPLOYER_KEY` with `export DEPLOYER_KEY='your-secret-key'`).
- Watch dreams: `python agents/iem_looter.py`.
Expand Down
120 changes: 120 additions & 0 deletions agents/iem_looter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
#!/usr/bin/env python3
"""
IEM Looter β€” Dream Event Listener
---------------------------------
Listens for DreamRecorded events and saves them to iem_memory.json
Part of the IEM-Ξ© Syndicate crew for the Dream-Mind-Lucid ecosystem
"""

import os
import json
import time
from web3 import Web3

# ====== CONFIG ======
RPC = os.getenv("SKALE_RPC", "https://mainnet.skalenodes.com/v1/elated-tan-skat")
CHAIN_ID = int(os.getenv("SKALE_CHAIN_ID", "2046399126")) # Europa Hub

w3 = Web3(Web3.HTTPProvider(RPC))

MEMORY_FILE = "iem_memory.json"

# ====== UTILS ======
def load_memory():
if os.path.exists(MEMORY_FILE):
with open(MEMORY_FILE, 'r') as f:
return json.load(f)
return {"lastDeployed": {}, "dreams": []}

def save_memory(mem):
with open(MEMORY_FILE, 'w') as f:
json.dump(mem, f, indent=2)

def log_dream(dreamer, dream, tx_hash, block_number):
"""Log a dream to the memory file"""
mem = load_memory()

dream_entry = {
"dreamer": dreamer,
"dream": dream,
"tx_hash": tx_hash,
"block_number": block_number,
"timestamp": int(time.time())
}

if "dreams" not in mem:
mem["dreams"] = []

mem["dreams"].append(dream_entry)
save_memory(mem)

print(f"πŸ’Ύ Dream saved: {dreamer[:10]}... -> '{dream[:50]}{'...' if len(dream) > 50 else ''}'")

def listen_for_dreams():
"""Main function to listen for DreamRecorded events"""
mem = load_memory()

if "lastDeployed" not in mem or "address" not in mem["lastDeployed"]:
print("❌ No deployed contract found in iem_memory.json")
print("πŸ’‘ Run 'python agents/iem_syndicate.py deploy' first")
return

contract_address = mem["lastDeployed"]["address"]
contract_abi = mem["lastDeployed"]["abi"]

print(f"🎯 Connecting to SKALE Network: {RPC}")
print(f"πŸ“ Contract Address: {contract_address}")

if not w3.is_connected():
print("❌ Failed to connect to SKALE network")
return

print("βœ… Connected to SKALE network")

# Create contract instance
contract = w3.eth.contract(address=contract_address, abi=contract_abi)

# Create event filter for DreamRecorded events
try:
event_filter = contract.events.DreamRecorded.create_filter(fromBlock="latest")
print("πŸ‘‚ Listening for dreams... (Press Ctrl+C to stop)")
print("=" * 60)

while True:
try:
# Check for new events
for event in event_filter.get_new_entries():
dreamer = event.args.dreamer
dream = event.args.dream
tx_hash = event.transactionHash.hex()
block_number = event.blockNumber

print(f"πŸ’­ Dream spotted!")
print(f" πŸ‘€ Dreamer: {dreamer}")
print(f" πŸŒ™ Dream: {dream}")
print(f" πŸ”— TX: {tx_hash}")
print(f" πŸ“¦ Block: {block_number}")
print("-" * 40)

# Save to memory
log_dream(dreamer, dream, tx_hash, block_number)

time.sleep(2) # Check every 2 seconds

except KeyboardInterrupt:
print("\nπŸ›‘ Dream listening stopped by user")
break
except Exception as e:
print(f"⚠️ Error while listening: {e}")
time.sleep(5) # Wait longer on error

except Exception as e:
print(f"❌ Failed to create event filter: {e}")
print("πŸ’‘ Make sure the contract is deployed and the ABI is correct")

if __name__ == "__main__":
print("🌌 IEM Looter - Dream Event Listener")
print("Part of the Dream-Mind-Lucid ecosystem")
print("=" * 50)

listen_for_dreams()
21 changes: 19 additions & 2 deletions agents/iem_syndicate.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@

import os, json, hashlib, argparse, time
from web3 import Web3
import ipfshttpclient # Copilot: Install with `pip install ipfshttpclient`

try:
import ipfshttpclient # Optional: Install with `pip install ipfshttpclient`
IPFS_AVAILABLE = True
except ImportError:
IPFS_AVAILABLE = False
print("πŸ’‘ IPFS client not available. Install with: pip install ipfshttpclient")

# ====== CONFIG ======
RPC = os.getenv("SKALE_RPC", "https://mainnet.skalenodes.com/v1/elated-tan-skat")
Expand Down Expand Up @@ -101,7 +107,18 @@ def update_state():

# ====== ONEIROSPHERE (FUTURE) ======
def interface_dream(): # Copilot: Implement when OneiroSphere.sol is ready
pass # Placeholder for IPFS upload and contract call
"""Future implementation for IPFS dream storage and OneiroSphere contract interaction"""
if not IPFS_AVAILABLE:
print("⚠️ IPFS client not available. Install with: pip install ipfshttpclient")
print("🌌 OneiroSphere functionality will be available in the future!")
return

print("πŸš€ OneiroSphere interface coming in 2089...")
print("🌌 Quantum dream network not yet implemented")
# Future implementation will include:
# - IPFS dream upload
# - OneiroSphere.sol contract interaction
# - Quantum consciousness bridging

# ====== MAIN ======
if __name__ == "__main__":
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Dream-Mind-Lucid Python Dependencies
# SKALE blockchain interaction and smart contract deployment

web3
py-solc-x
Loading