Solidity (Foundry) + Next.js 15 for a real-estate-focused stack on 0G Chain (EVM): on-chain property registry, compliance-aware share tokens, AMM (OG/WETH ↔ shares), optional lending and prediction markets, native OG staking with cooldown, and a production-style web app (WalletConnect, chain switch, investor hub, admin panel).
Large artifacts live in 0G Storage off-chain; the chain stores hashes and commitments. Deeper product and compliance context: docs/domain-model.md, docs/compliance.md, docs/grants.md.
- Features
- Repository layout
- Prerequisites
- Quick start
- Architecture
- Smart contracts
- Deploying
- Web application
- Troubleshooting
- Grant / demo checklist
- Contributing & license
- Publishing to GitHub
| Area | What you get |
|---|---|
| Registry | PropertyRegistry — property IDs, hashed external refs, document root anchors |
| Compliance | ComplianceRegistry — per-wallet KYC status + system-contract allowlist (router, pairs, etc.) |
| Shares | PropertyShareFactory → RestrictedPropertyShareToken (transfer rules + KYC) |
| DeFi | WETH9, OgFactory / OgPair, OgRouter, optional SimpleLendingPool, BinaryPredictionMarket |
| Staking | OgStaking — native OG stake, notifyRewardAmount emissions, cooldown unstake |
| NFT (optional) | PropertyShareProof — soulbound-style certificates tied to holdings |
| Web | Properties, trade, pool, portfolio, /invest, /stake, /admin (role-gated), WalletConnect, wrong-chain banner |
./
├── src/ # Solidity contracts (Foundry)
├── test/ # Forge tests
├── script/ # Deploy scripts (DeployAll, SeedSevenProperties, SeedFourMoreProperties, …)
├── deployments/ # testnet.json (gitignored) — copy from testnet.example.json
├── docs/ # Domain model, compliance, grants, token standard
├── scripts/ # sync_web_env.py — JSON → web/.env.local lines
└── web/ # Next.js 15 app (see web/README.md)
- Foundry (
forge,cast) — getfoundry.sh - Node.js 20+ and npm (for the web app)
- A wallet with testnet OG — faucet.0g.ai
- Solc 0.8.24, EVM Cancun,
via_ir = true— see foundry.toml
forge build
forge testcd web
cp .env.local.example .env.local
# Fill addresses manually, or from repo root after saving deployments/testnet.json:
# python3 scripts/sync_web_env.py deployments/testnet.json > web/.env.local
npm install
npm run devOpen http://localhost:3000.
Optional: OPENAI_API_KEY in web/.env.local powers the AI assistant on /guide.
flowchart LR
subgraph web [Next.js]
UI[Pages_wagmi_viem]
end
subgraph chain [0G_EVM]
PR[PropertyRegistry]
CR[ComplianceRegistry]
SF[PropertyShareFactory]
RT[OgRouter_WETH_Pairs]
ST[OgStaking]
end
UI --> PR
UI --> CR
UI --> SF
UI --> RT
UI --> ST
- Browser talks to RPC via wagmi/viem; addresses come from
NEXT_PUBLIC_*env vars. - Restricted shares consult
ComplianceRegistryfor transfers and verified users. - Staking is separate from property share economics unless you integrate them later (docs/domain-model.md).
| Module | Contracts |
|---|---|
| Core | PropertyRegistry, PurchaseEscrow |
| Compliance | ComplianceRegistry |
| Tokenization | PropertyShareFactory → RestrictedPropertyShareToken (docs/token-standard.md) |
| DeFi | WETH9, OgFactory, OgPair, OgRouter, MockPriceOracle, SimpleLendingPool, BinaryPredictionMarket |
| Staking | OgStaking |
| NFT (optional) | PropertyShareProof |
Full stack (includes PropertyShareProof, OgStaking):
export PRIVATE_KEY=0x...
# Optional: export NFT_BASE_URI=https://your.app/api/nft/
# Optional: export STAKING_COOLDOWN_SECONDS=3600
forge script script/DeployAll.s.sol:DeployAllScript \
--rpc-url https://evmrpc-testnet.0g.ai \
--broadcastCopy logged addresses into deployments/testnet.json (start from deployments/testnet.example.json), then seed demo properties per deployments/README.md.
Explorer: chainscan-galileo.0g.ai
Detailed env vars, routes, and scripts: web/README.md.
Generate env from deployment JSON:
python3 scripts/sync_web_env.py deployments/testnet.json > web/.env.local| Script | Purpose |
|---|---|
npm run dev |
Development server |
npm run build |
Production build |
npm run lint |
ESLint |
-
Root cause (fixed in repo): Do not put
animate-page-in(or any animation that setsopacity: 0in keyframe0%) on the persistent<main>in the root layout. Client-side route changes can restart the CSS animation and briefly (or visibly) applyopacity: 0to the entire main column — it looks like “CSS disappeared.” The root layout uses a plain<main>without that animation; keep entrance motion on page-specific blocks (e.g. home hero) only. -
Clean Next.js cache if builds act strange:
rm -rf web/.next web/node_modules/.cache cd web && npm run build
-
porto/internalwebpack warnings — optional peer of@wagmi/connectors; web/next.config.ts aliases shims. Safe to ignore unless you add the Porto connector. -
Wrong chain — use the in-app Switch to 0G Galileo banner; ensure
NEXT_PUBLIC_OG_RPCmatches your network.
- Narrative: docs/grants.md
- Verify:
forge testandcd web && npm run build - Legal: docs/compliance.md + in-app
/legal
- Match existing Solidity and TypeScript style; keep changes focused.
- Run
forge testandcd web && npm run lintbefore opening a PR. - License: see the repository’s LICENSE file if present; otherwise confirm with maintainers.
The repo may not have git initialized yet. From the project root:
git init
git add .
git commit -m "Initial commit: Building Culture 0G real estate stack"Create a new empty repository on GitHub (no README/license if you want a clean history), then:
git branch -M main
git remote add origin https://github.com/YOUR_USER/YOUR_REPO.git
git push -u origin mainUse SSH if you prefer: git@github.com:YOUR_USER/YOUR_REPO.git.
Do not commit secrets: deployments/testnet.json with real keys, .env, or web/.env.local — they are listed in .gitignore.
| Doc | Topic |
|---|---|
| docs/standards/reoc-v1.md | REOC v1 — Real Estate On Chain (normative) |
| docs/domain-model.md | On-chain vs 0G Storage |
| docs/token-standard.md | og-RE-share implementation notes |
| docs/0g-network.md | 0G network notes |
| docs/compliance.md | Compliance posture |
| deployments/README.md | Deploy + seed workflow |