diff --git a/README.md b/README.md index bdbadd7..0aaaaed 100644 --- a/README.md +++ b/README.md @@ -415,3 +415,17 @@ Domain’e özel imza/finality doğrulamaları üst katmanda ayrıca zorunlu tut Audit evidence template: `docs/AUDIT_EVIDENCE_BUNDLE.md`. + +--- + +# AOXCON ↔ AOXCHAIN Uyum Katmanı + +Bu depoya, AOXCON ve AOXCHAIN entegrasyonu için çoklu klasör yapısı eklendi: + +- `cli/` → Etkileşimli terminal menüsü (`python3 cli/aoxchain_cli.py`) +- `frontend/` → Hızlı başlangıç frontpage (`frontend/index.html`) +- `examples/contracts/` → Çoklu Move sözleşme örnekleri +- `scripts/bootstrap.sh` → Build + test otomasyon akışı +- `sdk/ts/` → TypeScript istemci SDK başlangıç alanı + +Bu yapı, Move tabanlı geliştirme akışını daha modüler ve genişletilebilir hale getirmek için hazırlanmıştır. diff --git a/cli/README.md b/cli/README.md new file mode 100644 index 0000000..ce726fd --- /dev/null +++ b/cli/README.md @@ -0,0 +1,16 @@ +# AOXChain CLI + +Bu klasördeki `aoxchain_cli.py`, AOXCON Move deposu için etkileşimli bir komut satırı arayüzü sağlar. + +## Kullanım + +```bash +python3 cli/aoxchain_cli.py +``` + +## Özellikler + +- `sui move test` ve `sui move build` komutlarını menüden çalıştırma +- AOXCON ↔ AOXCHAIN uyumluluk klasörlerini JSON olarak görüntüleme +- Örnek Move sözleşmelerini listeleme +- Frontend giriş sayfası yolunu gösterme diff --git a/cli/aoxchain_cli.py b/cli/aoxchain_cli.py new file mode 100755 index 0000000..a2ac0f5 --- /dev/null +++ b/cli/aoxchain_cli.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python3 +"""AOXChain uyumlu etkileşimli yerel CLI yardımcı aracı.""" + +from __future__ import annotations + +import json +import shlex +import subprocess +from dataclasses import dataclass +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] + + +@dataclass +class MenuAction: + key: str + label: str + command: list[str] | None = None + + +def run_command(command: list[str]) -> None: + print(f"\n$ {' '.join(shlex.quote(part) for part in command)}") + completed = subprocess.run(command, cwd=ROOT, check=False, text=True, capture_output=True) + if completed.stdout: + print(completed.stdout.strip()) + if completed.stderr: + print(completed.stderr.strip()) + if completed.returncode != 0: + print(f"\nKomut başarısız oldu (kod={completed.returncode}).") + + +def show_repo_layout() -> None: + manifest = { + "move_package": str(ROOT / "Move.toml"), + "contracts": str(ROOT / "sources"), + "contract_examples": str(ROOT / "examples" / "contracts"), + "frontend": str(ROOT / "frontend"), + "scripts": str(ROOT / "scripts"), + "typescript_sdk": str(ROOT / "sdk" / "ts"), + } + print(json.dumps(manifest, indent=2, ensure_ascii=False)) + + +def interactive_menu() -> None: + actions = [ + MenuAction("1", "Move testlerini çalıştır", ["sui", "move", "test"]), + MenuAction("2", "Move paketini derle", ["sui", "move", "build"]), + MenuAction("3", "Repo uyumluluk klasörlerini göster"), + MenuAction("4", "Örnek sözleşme listesini göster", ["bash", "-lc", "find examples/contracts -maxdepth 1 -name '*.move' | sort"]), + MenuAction("5", "Frontend index yolunu göster"), + MenuAction("q", "Çıkış"), + ] + + while True: + print("\n=== AOXCON ↔ AOXCHAIN Move Toolkit CLI ===") + for action in actions: + print(f"[{action.key}] {action.label}") + + choice = input("Seçiminiz: ").strip().lower() + if choice == "q": + print("Çıkılıyor.") + return + + selected = next((action for action in actions if action.key == choice), None) + if selected is None: + print("Geçersiz seçim, tekrar deneyin.") + continue + + if choice == "3": + show_repo_layout() + continue + + if choice == "5": + print(ROOT / "frontend" / "index.html") + continue + + if selected.command is not None: + run_command(selected.command) + + +if __name__ == "__main__": + interactive_menu() diff --git a/examples/contracts/governance_example.move b/examples/contracts/governance_example.move new file mode 100644 index 0000000..57980fb --- /dev/null +++ b/examples/contracts/governance_example.move @@ -0,0 +1,19 @@ +module examples::governance_example { + struct Proposal has copy, drop { + id: u64, + yes: u64, + no: u64, + } + + public fun create(id: u64): Proposal { + Proposal { id, yes: 0, no: 0 } + } + + public fun vote_yes(p: &mut Proposal) { + p.yes = p.yes + 1; + } + + public fun vote_no(p: &mut Proposal) { + p.no = p.no + 1; + } +} diff --git a/examples/contracts/nft_rental_example.move b/examples/contracts/nft_rental_example.move new file mode 100644 index 0000000..2be04b4 --- /dev/null +++ b/examples/contracts/nft_rental_example.move @@ -0,0 +1,11 @@ +module examples::nft_rental_example { + struct RentalAgreement has copy, drop { + renter: address, + lessor: address, + expires_at_ms: u64, + } + + public fun new(renter: address, lessor: address, expires_at_ms: u64): RentalAgreement { + RentalAgreement { renter, lessor, expires_at_ms } + } +} diff --git a/examples/contracts/oracle_guard_example.move b/examples/contracts/oracle_guard_example.move new file mode 100644 index 0000000..a1b1699 --- /dev/null +++ b/examples/contracts/oracle_guard_example.move @@ -0,0 +1,15 @@ +module examples::oracle_guard_example { + const MAX_DEVIATION_BPS: u64 = 300; + + public fun within_bounds(reference_price: u64, observed_price: u64): bool { + if (reference_price == 0) { + return false + }; + let diff = if (observed_price > reference_price) { + observed_price - reference_price + } else { + reference_price - observed_price + }; + (diff * 10_000) / reference_price <= MAX_DEVIATION_BPS + } +} diff --git a/examples/contracts/payment_channel_example.move b/examples/contracts/payment_channel_example.move new file mode 100644 index 0000000..6ddbe32 --- /dev/null +++ b/examples/contracts/payment_channel_example.move @@ -0,0 +1,23 @@ +module examples::payment_channel_example { + use sui::object::{Self, UID}; + use sui::tx_context::{Self, TxContext}; + + public struct Channel has key, store { + id: UID, + payer: address, + payee: address, + amount: u64, + open: bool, + } + + public entry fun open_channel(payee: address, amount: u64, ctx: &mut TxContext) { + let channel = Channel { + id: object::new(ctx), + payer: tx_context::sender(ctx), + payee, + amount, + open: true, + }; + sui::transfer::transfer(channel, tx_context::sender(ctx)); + } +} diff --git a/frontend/index.html b/frontend/index.html new file mode 100644 index 0000000..555ec0a --- /dev/null +++ b/frontend/index.html @@ -0,0 +1,47 @@ + + + + + + AOXC Move Frontpage + + + +
+

AOXCON Move Library Frontpage

+

AOXCON ve AOXCHAIN ile uyumlu Move ekosistemi başlangıç ekranı.

+
+
+
+

Hızlı Başlat

+

CLI menüsünü açmak için:

+
python3 cli/aoxchain_cli.py
+
+
+

Sözleşme Örnekleri

+

`examples/contracts` içinde çoklu örnek paketler bulunur.

+ +
Henüz yüklenmedi.
+
+
+ + + diff --git a/scripts/bootstrap.sh b/scripts/bootstrap.sh new file mode 100755 index 0000000..901631f --- /dev/null +++ b/scripts/bootstrap.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +set -euo pipefail + +echo "[AOXC] Move bağımlılıkları doğrulanıyor..." +sui --version + +echo "[AOXC] Paket derlemesi başlatılıyor..." +sui move build + +echo "[AOXC] Testler başlatılıyor..." +sui move test + +echo "[AOXC] Tamamlandı." diff --git a/sdk/ts/README.md b/sdk/ts/README.md new file mode 100644 index 0000000..3dffbe7 --- /dev/null +++ b/sdk/ts/README.md @@ -0,0 +1,9 @@ +# AOXC TypeScript SDK Placeholder + +Bu dizin AOXCHAIN istemcileriyle uyumlu olacak TypeScript yardımcı fonksiyonları için ayrılmıştır. + +Planlanan modüller: + +- `client.ts`: RPC bağlantı katmanı +- `contracts.ts`: Move fonksiyon çağrı yardımcıları +- `wallet.ts`: imzalama/transaction hazırlama yardımcıları