-
Notifications
You must be signed in to change notification settings - Fork 2
π Add GitHub Actions workflow infrastructure for automated SKALE deployment #4
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
Closed
Closed
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5dfd02b
Initial plan
Copilot 81f6c04
Add GitHub Actions workflow infrastructure for automated deployment
Copilot 2a8aca2
Complete GitHub Actions workflow setup with documentation
Copilot 28a914d
.github/workflows/deploy-verify.yml
imfromfuture3000-Android 1611860
agents/iem_looter.py
imfromfuture3000-Android File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' }} | ||
|
||
| 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' }} | ||
imfromfuture3000-Android marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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' }} | ||
imfromfuture3000-Android marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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' }} | ||
imfromfuture3000-Android marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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"))')" | ||
imfromfuture3000-Android marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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": []} | ||
imfromfuture3000-Android marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| 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() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.