Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
118 changes: 118 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: OGC CI

on:
push:
branches: [ main, develop, ci-runner ]
pull_request:
branches: [ main, develop ]

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python 3.13
uses: actions/setup-python@v5
with:
python-version: '3.13'

- name: Install pipx and AlgoKit
run: |
python -m pip install --user pipx
python -m pipx ensurepath
pipx install algokit==2.9.0
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Verify AlgoKit installation
run: algokit --version

- name: Start LocalNet
run: |
algokit localnet start
sleep 10 # Give LocalNet time to fully start

- name: Install Poetry
run: |
python -m pip install poetry==1.8.3
poetry --version

- name: Find project directory
id: find-project
run: |
# Find directory with pyproject.toml
PROJECT_DIR=$(find . -name "pyproject.toml" -type f | head -1 | xargs dirname)
if [ -z "$PROJECT_DIR" ]; then
echo "No pyproject.toml found, trying common patterns..."
for pattern in "*contracts*/projects/*" "*contracts*" "contracts" "."; do
if find $pattern -name "*.py" -path "*/smart_contracts/*" 2>/dev/null | head -1; then
PROJECT_DIR=$(find $pattern -name "*.py" -path "*/smart_contracts/*" 2>/dev/null | head -1 | xargs dirname | xargs dirname)
break
fi
done
fi
echo "PROJECT_DIR=$PROJECT_DIR" >> $GITHUB_OUTPUT
echo "Found project directory: $PROJECT_DIR"

- name: Install dependencies
working-directory: ${{ steps.find-project.outputs.PROJECT_DIR }}
run: |
if [ -f "pyproject.toml" ]; then
poetry install --no-interaction --no-root
else
echo "No pyproject.toml found, installing with pip"
pip install beaker-pyteal pyteal py-algorand-sdk algokit-utils python-dotenv setuptools
fi

- name: Build contracts
working-directory: ${{ steps.find-project.outputs.PROJECT_DIR }}
run: |
# Find and build any vault/contract files
for contract in *vault*.py *contract*.py; do
if [ -f "$contract" ]; then
echo "Building $contract..."
if [ -f "pyproject.toml" ]; then
poetry run python "$contract"
else
python "$contract"
fi
fi
done
# List any artifacts created
find . -name "artifacts" -type d -exec ls -la {} \; 2>/dev/null || echo "No artifacts directory found"

- name: Run tests
working-directory: ${{ steps.find-project.outputs.PROJECT_DIR }}
run: |
# Find and run test files
for test in test_*.py *_test.py; do
if [ -f "$test" ]; then
echo "Running $test..."
if [ -f "pyproject.toml" ]; then
poetry run python "$test"
else
python "$test"
fi
fi
done

- name: Run demos
working-directory: ${{ steps.find-project.outputs.PROJECT_DIR }}
run: |
# Find and run demo files
for demo in *demo*.py demo_*.py; do
if [ -f "$demo" ]; then
echo "Running $demo..."
if [ -f "pyproject.toml" ]; then
poetry run python "$demo"
else
python "$demo"
fi
fi
done

- name: Stop LocalNet
if: always()
run: algokit localnet stop
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.13.7
127 changes: 127 additions & 0 deletions DEMO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# OGC Demo Commands

## 📍 Where to Run Commands

**All commands must be run from:**
```bash
/Users/eltonbaidoo/OGC/ogc-contracts/projects/ogc-contracts/
```

## 🚀 Quick Start

### 1. Navigate & Activate
```bash
cd ~/OGC/ogc-contracts/projects/ogc-contracts
source "$(poetry env info --path)/bin/activate"
python --version # Should show 3.13.x
```

### 2. Create OGC Token
```bash
python create_ogc_token.py
```
**Expected Output:**
```
🪙 Creating OGC Token...
✅ OGC Token Created!
Asset ID: 1033
Total Supply: 1,000,000,000 OGC
Creator: VYXZFE4BGH...
```

### 3. Verify Token
```bash
python verify_token.py
```
**Expected Output:**
```
🔍 Verifying OGC Token...
✅ OGC Token Found!
Asset ID: 1033
Name: OGC Token
Unit: OGC
Total: 1,000,000,000
```

### 4. Demo ALGO Vault
```bash
python ogc_demo.py
```
**Expected Output:**
```
🚀 OGC - Out The Groupchat Demo
🎯 Goal: 2.0 ALGO
✅ Fund Created: APP_ID 1036
💰 Total: 1.5 ALGO
⏳ Need 0.5 more ALGO
```

### 5. Run Tests
```bash
python test_vault.py
```
**Expected Output:**
```
🧪 Testing OGC Vault Basic Flow
✅ Deployed: APP_ID 1037
✅ Contribution test passed: 0.5 ALGO
🏁 Tests PASSED
```

## 🎯 One-Liner Commands

### Full Demo Sequence
```bash
cd ~/OGC/ogc-contracts/projects/ogc-contracts && source "$(poetry env info --path)/bin/activate" && python create_ogc_token.py && python verify_token.py && python ogc_demo.py
```

### Quick Token Demo
```bash
python create_ogc_token.py && python verify_token.py
```

### Quick Vault Demo
```bash
python ogc_demo.py && python test_vault.py
```

## 🛠️ Makefile Commands

```bash
make demo # Run ogc_demo.py
make test # Run test_vault.py
make build # Build working_vault.py
make ci # Run full pipeline
```

## 📊 What Each Command Does

| Command | Purpose | Output |
|---------|---------|---------|
| `create_ogc_token.py` | Mints OGC token on LocalNet | Asset ID number |
| `verify_token.py` | Confirms token exists | Token details |
| `ogc_demo.py` | Shows group funding scenario | ALGO vault demo |
| `test_vault.py` | Tests contract functions | Test results |
| `working_vault.py` | Builds smart contract | Artifacts created |

## 🎤 For Hackathon Presentation

**Run in this order:**
1. `python create_ogc_token.py` - "We minted OGC token"
2. `python verify_token.py` - "Token verified on Algorand"
3. `python ogc_demo.py` - "Group funding demo"
4. `python test_vault.py` - "All tests pass"

## 🔧 Troubleshooting

**If commands fail:**
```bash
# Check you're in right directory
pwd # Should show: /Users/eltonbaidoo/OGC/ogc-contracts/projects/ogc-contracts

# Check environment is active
which python # Should show venv path

# Reactivate if needed
source "$(poetry env info --path)/bin/activate"
```
123 changes: 123 additions & 0 deletions SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# OGC Development Setup

## 🚀 Fresh AlgoKit Setup

If you just installed AlgoKit and want to start:

### 1. Install AlgoKit
```bash
# Install AlgoKit
pipx install algokit

# Verify installation
algokit --version
algokit doctor # Check system health
```

### 2. Start LocalNet
```bash
# Start Algorand LocalNet
algokit localnet start

# Check status
algokit localnet status
```

### 3. Navigate to Project
```bash
cd ~/OGC/ogc-contracts/projects/ogc-contracts
```
any directory name is fine but it should have the \<name\>/projects/\<name\>

### 4. Activate Environment
```bash
# Activate Poetry virtualenv
source "$(poetry env info --path)/bin/activate"

# Verify Python version
python --version # Should be 3.13.x
```

### 5. Install Dependencies
```bash
# Install with Poetry
poetry install

# Or manually with pip
pip install beaker-pyteal pyteal py-algorand-sdk algokit-utils
```

### 6. Build & Test (Have to write it or pull it)
```bash
# Build contracts
python working_vault.py

# Run tests
python test_vault.py

# Run demo
python ogc_demo.py
```

### 7. Stop When Done
```bash
# Stop LocalNet
algokit localnet stop
```

## 🔄 Quick Reset Script

If you need to reset your environment:

```bash
# One-liner to get back into dev mode
cd ~/OGC/ogc-contracts/projects/ogc-contracts && source "$(poetry env info --path)/bin/activate" && python --version
```

Or use the Makefile:
```bash
make dev # Activates environment and drops into shell
```

## 🛠️ Development Commands

```bash
make install # Install dependencies
make build # Build contracts
make test # Run tests
make demo # Run demo
make ci # Full CI pipeline
```

## 🔍 Troubleshooting

**LocalNet not starting?**
```bash
algokit localnet reset # Reset LocalNet
algokit doctor # Check system health
```

**Python version issues?**
```bash
poetry env info # Check Poetry environment
poetry shell # Alternative to source activation
```

**Dependencies not found?**
```bash
poetry install --no-cache # Reinstall dependencies
```

## 📁 Project Structure

```
OGC/
├── SETUP.md # This file
├── .github/workflows/ci.yml # CI configuration
└── ogc-contracts/projects/ogc-contracts/
├── pyproject.toml # Dependencies
├── Makefile # Build commands
├── working_vault.py # Main contract
├── test_vault.py # Tests
└── ogc_demo.py # Demo
```
Loading
Loading