Commit Graph

63 Commits

Author SHA1 Message Date
hailin 66781d47b3 chore: 提交 user-service package-lock.json
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:35:03 -08:00
hailin e20c321d12 refactor: 遥测与版本管理拆分为独立微服务 (telemetry-service + admin-service)
架构重构: 将遥测(Telemetry)和版本管理(App Version)从 user-service 拆分为两个独立微服务,
严格遵循 DDD + Clean Architecture 四层架构。

新增服务:
- telemetry-service (:3011) — 用户心跳检测、事件采集、DAU统计、Prometheus指标
  - domain: 3实体 + 3值对象(EventName/InstallId/TimeWindow) + 2领域事件
  - infrastructure: Redis(Sorted Set心跳) + Kafka(事件发布) + Prometheus(5指标)
  - 定时任务: 每分钟在线快照、每小时清理过期、凌晨DAU精确计算、滚动DAU更新
- admin-service (:3012) — APK/IPA版本管理、OTA更新、MinIO文件存储
  - domain: 1实体 + 4值对象(VersionCode/VersionName/FileSha256/DownloadUrl)
  - infrastructure: MinIO(文件上传/下载) + APK/IPA解析器
  - 移动端: 检查更新API(无认证) + 下载重定向(预签名URL)
  - 管理端: 版本CRUD + 上传解析 + 启禁用

user-service 清理:
- 删除24个已迁移文件(4实体+4服务+4基础设施+5控制器+6DTO+1gitkeep)
- 移除不再需要的依赖: @nestjs/schedule, minio, prom-client, kafkajs
- 精简 user.module.ts,仅保留用户核心功能(Profile/KYC/Wallet/Message/Admin)

基础设施更新:
- Kong: 遥测路由 → telemetry-service:3011, 版本路由 → admin-service:3012
- docker-compose: 新增2个服务容器 + MinIO app-releases bucket
- 07开发指南: 更新为独立服务架构描述

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:30:39 -08:00
hailin 4da8a373f2 refactor: 全项目清除MVP字样,统一为正式系统用语
## 变更范围:21个文件,覆盖全栈

### SRS需求文档 (4个文件,20处修改)

docs/券金融平台-软件需求规格.md (7处):
- "MVP策略" → "运营策略"/"合规策略"
- "MVP阶段GNX不上交易所" → "Phase 1阶段GNX不上交易所"
- "MVP同步" → "同步发布"
- "MVP阶段优先级" → "阶段优先级"
- "Phase 1(MVP)" → "Phase 1(基础平台)"
- "基础发行与交易(MVP,仅Utility Track)" → "基础发行与交易(仅Utility Track)"

docs/券金融平台-需求规格综合评估报告.md (4处):
- "MVP分期" → "阶段分期"
- "MVP回避策略" → "合规回避策略"
- "MVP仅Utility Track" → "Phase 1仅Utility Track"

docs/闲券交易平台-架构开发需求.md (4处):
- "MVP阶段只开放" → "当前阶段只开放"
- "Phase 1(MVP)" → "Phase 1(基础平台)"
- "基础平台(MVP,仅Utility Track)" → "基础平台(仅Utility Track)"

docs/闲券平台-软件开发需求.md (5处):
- "MVP阶段用户不接触" → "当前阶段用户不接触"
- "MVP策略" → "运营策略"
- "Phase 1(MVP)" → "Phase 1(基础平台)"
- "Phase 1 — MVP" → "Phase 1 — 基础平台"

### 后端服务代码 (7个文件,13处修改)

trading-service (Go):
- admin_trade_handler.go: 3处 "for MVP"/"In MVP" 注释清除
- admin_mm_handler.go: 2处 "In MVP"/"for MVP" 注释清除

chain-indexer (Go):
- admin_chain_handler.go: 1处 "for MVP" 注释清除

compliance-service (NestJS):
- admin-compliance.service.ts: 3处 "(mock for MVP)" 注释清除

issuer-service (NestJS):
- admin-issuer.service.ts: 1处 "For MVP" 注释清除
- admin-merchant.service.ts: 2处 "For MVP" 注释清除

notification-service (NestJS):
- event-consumer.service.ts: 1处 "In MVP" 注释清除

### 前端代码 (10个文件)

mobile (5个文件):
- i18n: en/zh_cn/zh_tw/ja 4语言 "MVP版本仅支持" → "当前仅支持"
- i18n key: proMode.mvpNote → proMode.trackNote
- pro_mode_page.dart: 更新key引用

genex-mobile (5个文件):
- 同mobile,4语言+1页面引用全部更新

### 验证结果
全项目grep (?i)\bMVP\b = 0 matches,彻底清除完毕

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:13:47 -08:00
hailin 0bf1df0f7a feat: 补全遥测/版本管理完整功能 + 清除全部开发指南中的MVP字样
## 功能补全 (12个新文件 + 6个修改)

DTO验证类 (6):
- batch-events.dto.ts — 批量事件上报验证(ArrayMaxSize 500, ValidateNested)
- heartbeat.dto.ts — 心跳上报验证(installId, appVersion)
- query-dau.dto.ts — DAU查询+事件查询验证(IsDateString, 分页)
- check-update.dto.ts — 检查更新验证(platform IsIn, version_code IsInt)
- create-version.dto.ts — 创建/更新版本验证(CreateVersionDto + UpdateVersionDto)
- upload-version.dto.ts — 上传版本验证(multipart/form-data字段)

基础设施 (3):
- package-parser.service.ts — APK解析(adbkit-apkreader) + IPA解析(unzipper+bplist-parser)
- telemetry-producer.service.ts — Kafka事件发布(telemetry.session.started + telemetry.heartbeat)
- telemetry-metrics.service.ts — Prometheus 5指标(online_users/dau/heartbeat_total/events_total/batch_duration)

控制器 (1):
- metrics.controller.ts — GET /metrics 端点(Prometheus格式)

功能增强:
- admin-version.controller.ts — 新增POST /parse解析预览端点 + upload自动解析填充元数据
- app-version.controller.ts — 新增GET /download/:id下载端点(302重定向MinIO)
- telemetry.service.ts — 集成Prometheus计数器+直方图 + Kafka事件发布
- telemetry-scheduler.service.ts — 快照/DAU时更新Prometheus指标
- user.module.ts — 注册MetricsController + TelemetryMetricsService + TelemetryProducerService + PackageParserService
- package.json — 新增prom-client依赖

## 开发指南MVP清除 (4个文件)

- 00-UI设计需求.md — "MVP阶段" → "当前阶段"
- 05-后端开发指南.md — "Phase 1 (MVP)" → "Phase 1 (基础平台)"
- 06-区块链开发指南.md — 清除所有MVP引用(合约注释/代币用途/Gas模型/预留接口)
- 07-遥测与版本管理开发指南.md — 清除MVP理由, 删除"可选"标记

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 18:09:10 -08:00
hailin 5a66b3071f feat: 新增用户遥测(Telemetry)与移动端OTA版本管理功能
## 遥测系统 (Telemetry)
- 心跳检测: 客户端60s上报心跳,Redis Sorted Set实时计算在线用户数(180s窗口)
- 事件采集: 批量上报客户端事件(会话/页面/操作),写入PostgreSQL telemetry_events表
- DAU统计: 基于app_session_start事件按userId/installId去重
  - 实时近似: Redis HyperLogLog (PFADD/PFCOUNT)
  - 精确计算: 每天凌晨1:00从事件表聚合,支持平台/地区维度
- 在线快照: 每分钟记录在线用户数快照,支持1m/5m/1h区间聚合查询
- 定时任务: @nestjs/schedule驱动 (每分钟快照/每小时清理/凌晨DAU/滚动DAU)

## 版本管理 (App Version / OTA Update)
- 版本CRUD: 管理员创建/编辑/删除/启禁用版本记录
- 文件上传: APK/IPA上传至MinIO(app-releases bucket),自动计算SHA256
- 强制更新: isForceUpdate标志,客户端据此决定是否阻断使用
- 检查更新API: GET /app/version/check?platform=android&current_version_code=200
- 预签名下载: MinIO presigned URL (24h有效)

## 新增文件清单 (18个新文件 + 3个修改)

数据库迁移 (4):
- 032_create_telemetry_events.sql — 事件日志表(append-only, BIGSERIAL)
- 033_create_daily_active_stats.sql — DAU日统计表(day PK, JSONB平台/地区)
- 034_create_online_snapshots.sql — 在线快照表(每分钟记录)
- 035_create_app_versions.sql — 应用版本表(platform CHECK, 唯一索引)

TypeORM实体 (4):
- telemetry-event.entity.ts — 遥测事件(userId, installId, eventName, properties)
- online-snapshot.entity.ts — 在线快照(ts, onlineCount, windowSeconds)
- daily-active-stats.entity.ts — DAU统计(day PK, dauByPlatform/Region JSONB)
- app-version.entity.ts — 应用版本(Platform enum, @VersionColumn乐观锁)

Redis基础设施 (1):
- presence-redis.service.ts — ZADD心跳 + ZCOUNT在线 + PFADD/PFCOUNT DAU

业务服务 (4):
- telemetry.service.ts — 批量事件入库 + 心跳记录 + 在线/DAU查询
- telemetry-scheduler.service.ts — 4个Cron定时任务
- app-version.service.ts — checkUpdate + CRUD + toggle + 重复检测
- file-storage.service.ts — MinIO上传(SHA256) + presigned下载URL

HTTP控制器 (4):
- telemetry.controller.ts — POST events(无需认证) + POST heartbeat + GET online
- admin-telemetry.controller.ts — GET /admin/telemetry/dau|events|realtime
- app-version.controller.ts — GET /app/version/check (移动端)
- admin-version.controller.ts — 完整CRUD + multipart上传 + toggle启禁用

修改文件 (3):
- user.module.ts — 注册4实体+4控制器+5服务+ScheduleModule
- package.json — 新增@nestjs/schedule, minio, @types/multer
- kong.yml — 新增4条Kong路由(telemetry, admin/telemetry, app/version, admin/versions)

文档 (1):
- docs/guides/07-遥测与版本管理开发指南.md — 完整开发指导(参考rwadurian适配)

注: admin遥测路径为/admin/telemetry,避免与issuer-service的/admin/analytics冲突

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:53:50 -08:00
hailin ad93bc728f feat: 完成全部后端微服务开发 (10服务/373文件/15586行代码)
## 架构概览
- 10个微服务: 7 NestJS + 3 Go/Gin
- DDD + Clean Architecture (Domain/Application/Infrastructure/Interface 四层)
- Kong API Gateway (8080) 统一入口
- PostgreSQL + Redis + Kafka(KRaft) + MinIO 基础设施

## 微服务清单
| 服务 | 技术 | 端口 | 职责 |
|------|------|------|------|
| auth-service | NestJS | 3010 | JWT双Token认证(15min+7d)、注册/登录/刷新/登出 |
| user-service | NestJS | 3001 | 用户Profile、KYC审核、钱包(充值/提现)、消息 |
| issuer-service | NestJS | 3002 | 发行方入驻、券CRUD/搜索/购买、定价引擎、信用评分 |
| trading-service | Go/Gin | 3003 | 撮合引擎(价格-时间优先)、订单簿、做市商API |
| clearing-service | NestJS | 3004 | 交易结算、退款、Breakage、ASC 606会计分录 |
| compliance-service | NestJS | 3005 | AML(5模式)、OFAC筛查、Travel Rule、SAR报告 |
| ai-service | NestJS | 3006 | ACL反腐败层→外部AI Agent集群(含本地降级) |
| translate-service | Go/Gin | 3007 | 区块链地址映射翻译 |
| notification-service | NestJS | 3008 | 推送/短信/邮件/站内通知、事件消费 |
| chain-indexer | Go/Gin | 3009 | 区块链索引器(Mock) |

## Admin API (18个管理模块)
覆盖admin-web全部18+页面:
Dashboard、用户管理、系统管理、用户分析、发行方管理、券管理、
券分析、商户核销、交易监控、做市商管理、财务管理、报表中心、
风控中心、合规审计、争议处理、保险理赔、AI Agent面板、通知管理

## 数据库
- 31个SQL迁移 (000-031) + 种子数据
- 乐观锁(@VersionColumn) + 悲观锁(SELECT FOR UPDATE) + Redis分布式锁
- Outbox Pattern保证消息可靠投递 + 24h幂等窗口

## 共享包
- @genex/common: Guards/Decorators/DTOs/Outbox/Health/Locking/AI-Client
- @genex/kafka-client: 生产者/消费者/Topic定义/KRaft集群支持

## 部署与测试
- docker-compose.yml: 全栈一键启动
- Swagger文档: 7个NestJS服务 /docs 端点
- E2E测试脚本: scripts/run-e2e.sh (Auth→Profile→Wallet→Trading→Admin)
- 迁移脚本: scripts/migrate.sh + scripts/test-setup.sh

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 17:09:12 -08:00
hailin c58b2df728 feat: 小程序功能移植,新增12页面+160 i18n keys,覆盖率提升至~70%
新增页面:search, purchase(重写), payment-success, my-coupon-detail,
transfer, ai-chat, orders(重写), messages, wallet(只读), settings, kyc
增强:detail页新增附近门店和相似好券模块
导航:首页搜索→search, 券卡→detail→purchase, 我的券→my-coupon-detail,
个人中心菜单→wallet/messages/ai-chat/settings/kyc

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 04:16:33 -08:00
hailin 3cdb6a5eb9 feat: 全部前端项目完成国际化(i18n),支持中/英/日三语言
- miniapp (Taro/React): 11个页面/组件,~300翻译键
- admin-app (Flutter): 19个页面,475翻译键 (zh_CN/en_US/ja_JP)
- admin-web (Next.js): 25个视图+布局,2000+翻译键
- mobile (Flutter): 33+页面/组件,686翻译键 (zh_CN/zh_TW/en/ja)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 03:45:37 -08:00
hailin 5bc1cbe4d8 feat: 完成全量国际化(i18n),支持简中/繁中/英文/日文四语言
## 概述
实现 Genex Mobile 全量国际化支持,覆盖全部 UI 字符串。
支持语言:简体中文(zh_CN)、繁体中文(zh_TW)、英文(en)、日文(ja)。
共计 720+ 翻译键值对,涉及 51 个文件。

## 新增文件
- lib/app/i18n/strings/zh_cn.dart — 简体中文翻译(基础语言)
- lib/app/i18n/strings/zh_tw.dart — 繁体中文翻译
- lib/app/i18n/strings/en.dart — 英文翻译
- lib/app/i18n/strings/ja.dart — 日文翻译
- lib/app/i18n/locale_manager.dart — 全局语言/货币状态管理器

## i18n 基础架构
- AppLocalizations: 基于 Map<String, String> 的翻译查找
- AppLocalizationsDelegate: Flutter 本地化委托集成
- context.t('key') 扩展方法:便捷取用翻译文本
- 回退链:缺失 key → zh_CN → key 本身
- LocaleManager: ValueNotifier<Locale?> 响应式语言切换
- 货币绑定:根据 locale 自动匹配货币符号(CNY/TWD/USD/JPY)

## 页面级国际化(46 个文件)
### 认证模块 (auth)
- welcome_page, login_page, register_page, forgot_password_page

### 券模块 (coupons)
- home_page, market_page, search_page, coupon_detail_page
- my_coupons_page, my_coupon_detail_page, wallet_coupons_page
- order_confirm_page, payment_page, payment_success_page
- redeem_qr_page, receive_coupon_sheet

### 交易模块 (trading)
- trading_page, trading_detail_page, sell_order_page, transfer_page

### 钱包模块 (wallet)
- wallet_page, deposit_page, withdraw_page, transaction_records_page

### 用户模块 (profile)
- profile_page, settings_page, kyc_page
- payment_management_page, pro_mode_page

### 消息模块 (message)
- message_page, message_detail_page

### 商户模块 (merchant)
- merchant_home_page, merchant_ai_assistant_page

### 发行方模块 (issuer)
- issuer_main_page

### AI 模块 (ai_agent)
- agent_chat_page, ai_fab

### 公共组件 (shared/widgets)
- coupon_card, price_tag, status_tag, empty_state
- ai_confirm_dialog, kyc_badge

### 应用层 (app)
- main.dart (本地化委托/Locale解析配置)
- main_shell.dart, app_localizations.dart, pubspec.yaml

## 技术处理
- Widget getter → method(BuildContext): 需要 context 的属性转为方法
- const 默认参数 → nullable: 无法在 const 中使用 context.t(),改为可空参数在 build() 中解析
- Mock 数据保留中文:示例/演示数据将来自 API,无需国际化
- 语言选择器原生显示:中文/English/日本語 等按各语言原生名称展示

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 00:16:00 -08:00
hailin b639e8c823 feat: 设置页面新增货币选择器和语言选择器
- 设置页面从StatelessWidget改为StatefulWidget
- 新增货币选择器bottom sheet,支持USD/CNY/EUR/GBP/JPY/HKD
- 新增语言选择器bottom sheet,支持简体中文/繁體中文/English/日本語
- 通知开关改为可交互状态
- 货币subtitle动态显示已选货币代码和符号

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 21:18:11 -08:00
hailin 003b571f94 refactor: 交易页面改为券+行业分类模式,移除交易对tabs
- market_page: 移除券/法币/数字货币/稳定币tabs,改为行业分类过滤(餐饮/购物/娱乐/出行/生活/运动)
- market_page: 新增排序栏(折扣率/价格/到期时间),二级市场改为券名+品牌+行业标签展示
- trading_detail_page: 移除SBUX/USDT交易对概念,改为券信息卡片+配置货币符号
- trading_detail_page: 新增券信息卡片(品牌/行业/信用评级/面值/到期),价格显示折扣率
- 计价货币由用户在"我的→设置"中配置,默认跟随语言

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 20:55:24 -08:00
hailin d9c953149b refactor: 重写转赠页面为混合方案
- 顶部两个并排入口卡片:扫码转赠 / 输入ID(邮箱/手机/接收ID)
- 最近转赠人列表:显示联系方式类型标签、脱敏联系方式、上次转赠时间
- 联系方式有效期机制:90天过期后灰显,点击提示重新验证
- 底部sheet选券流程:选方式 → 选券 → 确认转赠 → 成功
- 转赠记录摘要:显示最近转出/转入记录
- 移除旧的好友列表设计,改为地址式转赠(类似加密钱包)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 19:13:01 -08:00
hailin 8bbd56a86c refactor: 我的钱包 → 持仓,统一交易所语境
- 首页卡片: "我的钱包" → "持仓"
- 完整页面标题: "我的钱包" → "我的持仓"
- 图标: account_balance_wallet → inventory_2 (仓位/库存)
- 更新注释和 main.dart 描述

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 18:58:47 -08:00
hailin b9f36176ed fix: 修复 wallet_coupons_page 缺少 CouponStatus 导入和错误引用
- 添加 coupon_card.dart 导入以获取 CouponStatus 枚举
- AppTypography.display → AppTypography.displayLarge
- AppColors.couponFood → AppColors.couponDining

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 18:43:37 -08:00
hailin b1a0f29f06 refactor: 轻量化首页钱包卡片,新增完整钱包页面
- 首页钱包区域从重量级(stats+filter+coupon cards+actions)
  精简为轻量卡片(汇总信息+4个快捷入口),点击进入完整钱包页
- 新增 wallet_coupons_page.dart:融合"我的券"全部功能
  (汇总面板+4-Tab筛选+券列表+转赠/出售快捷操作+接收券)
- 分类网格从6项(3列)扩展为8项(4列x2行):
  限时抢购/新券首发/折扣排行/即将到期/比价/转让市场/热门交易/全部
- HomePage 从 StatefulWidget 简化为 StatelessWidget
- main.dart 新增 /wallet/coupons 路由

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 18:39:22 -08:00
hailin b63414542b feat: Create genex-mobile app with coupon lifecycle management redesign
基于 frontend/mobile 创建全新的 genex-mobile 应用,重新设计为券的生命周期管理平台。

## 底部导航重构 (5 tabs → 4 tabs)
- 首页 / 交易 / 消息 / 我的
- 移除独立的"我的券"Tab,功能合并到首页券钱包中
- "市场"重命名为"交易",图标改为行情图标

## 首页改造
### 券钱包(替代原Banner轮播区域)
- 紫色渐变卡片展示"我的钱包",含券数量统计(可使用/待核销/已过期)
- 水平滚动的券迷你卡片列表,支持Tab筛选(全部/可使用/待核销/已过期)
- 快捷操作栏:接收 / 转赠 / 出售 / 核销
- 接收功能:点击弹出底部Sheet,展示接收ID和接收二维码
  - 对方可通过扫码或输入ID转赠券到钱包
  - 接收ID支持一键复制

### 分类网格重新设计(从商品品类改为省钱机制)
- 原8个商品分类(餐饮/购物/娱乐/出行/生活/品牌/折扣/全部)
- 改为6个省钱导向分类:限时抢购 / 新券首发 / 折扣排行 / 即将到期 / 比价 / 全部分类
- 3列×2行布局,每个入口强调"怎么省"而非"卖什么"

### 其他区域保持不变
- AI智能推荐卡片
- 精选好券列表
- AI FAB浮动按钮

## 交易页(币安交易所风格)
### 一级市场(打新申购 / Launchpad风格)
- 券发行卡片:品牌信息 / 发行价 / 面值 / 折扣 / 发行量
- 销售进度条和百分比
- 状态标签:即将开始(含倒计时)/ 申购中 / 已结束

### 二级市场(交易所行情列表)
- 交易对分类Tab:券/法币 | 券/数字货币 | 券/稳定币 | 收藏
- 行情列表:交易对名称 / 最新价格 / 24h涨跌幅(红绿色块)
- 成交量和USD等价显示
- 支持的交易对示例:SBUX/USD, NIKE/BTC, AMZN/USDT 等

### 交易对详情页(K线 + 盘口 + 下单)
- 价格头部:当前价 / 24h涨跌 / OHLC数据(高/低/开盘/成交量)
- K线图(含模拟蜡烛图渲染 + 成交量柱状图)
- 时间周期选择器:1m / 5m / 15m / 1h / 4h / 1D / 1W
- 交易深度:买卖盘口(Bid/Ask)带深度条可视化
- 下单表单:买入/卖出切换 / 限价单/市价单 / 价格数量输入 / 比例快选(25%/50%/75%/100%)
- 当前委托和历史委托列表
- 底部买入/卖出快捷按钮

## 券详情页增强
- 新增"附近可用门店"区域(LBS定位功能入口)
- 展示附近门店列表:门店名 / 距离 / 营业状态

## 技术细节
- 保持原有设计系统:紫色主色调 #6C5CE7 / Material 3 / 亮色模式
- Flutter analyze 零错误通过
- 所有新增页面使用 mock 数据,便于后续接入真实API

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 17:57:16 -08:00
hailin 0ca11bddb1 chore: Ignore Claude Code config and Flutter auto-generated files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 07:28:02 -08:00
hailin 87d54be200 fix: Remove infinite minimumSize from ElevatedButton/OutlinedButton theme
The theme set minimumSize: Size(double.infinity, 52) which creates
an internal ConstrainedBox(w=Infinity) inside every button. This
crashes when any button is placed in unbounded width context (Row).
Changed to Size(0, 52) — GenexButton's LayoutBuilder handles width.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 07:15:20 -08:00
hailin 665e494b4a fix: Prevent GenexButton crash with unbounded width constraints
Use LayoutBuilder to detect whether parent provides bounded width.
When fullWidth=true in an unbounded context (e.g. Row without
Expanded), gracefully fall back to content-sized width instead of
forcing SizedBox(width: double.infinity) which triggers
"BoxConstraints forces an infinite width" assertion.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 07:08:09 -08:00
hailin 5abb614d03 feat: Wire all navigation callbacks across mobile and admin-app
Replace empty onPressed/onTap placeholder callbacks with actual
Navigator route calls so all pages are navigable during testing.

Mobile (16 pages):
- Auth flow: welcome → login/register → main shell, forgot password
- Home: search bar → /search, coupon cards → /coupon/detail, AI FAB → /ai-chat
- Market: coupon cards → /coupon/detail
- Coupon detail: buy → /order/confirm
- Order confirm: payment auth → /payment
- Payment: confirm → /payment/success (fixed route typo)
- Payment success: buttons → /main (clear stack)
- My coupons: cards → /coupon/mine/detail
- My coupon detail: transfer → /transfer, sell → /sell
- Search: result cards → /coupon/detail
- Profile: KYC → /kyc, payment → /payment/manage, wallet → /wallet,
  trading → /trading, pro mode → /pro-mode, settings → /settings,
  logout → / (clear stack)
- Settings: KYC → /kyc, logout → / (clear stack)
- Wallet: deposit → /wallet/deposit, withdraw → /wallet/withdraw,
  records → /wallet/records
- Messages: items → /message/detail

Admin-app (13 pages):
- Dashboard: AI insight → createCoupon, credit suggestion → credit
- Coupon list: coupon cards → couponDetail, FAB → createCoupon
- Create coupon: save draft → pop back
- Settings: store mgmt, employee mgmt → storeManagement,
  AI assistant → aiAgent, tier upgrade → credit, logout → login
- Financing analysis: AI recommendation → aiAgent
- Onboarding: complete → main shell
- Login: register link → onboarding
- Fix: pass BuildContext to _buildTierCard in settings_page.dart

Both apps verified building successfully (flutter build apk --debug).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 06:54:22 -08:00
hailin 5f3e660b05 feat: Add Flutter build configuration for admin-app and mobile
- Initialize Android/iOS platform code for both Flutter apps
  - admin-app: cn.gogenex.issuer (Genex发行方)
  - mobile: cn.gogenex.consumer (Genex消费者端)
- Configure Android build.gradle.kts with:
  - Release signing config (keystore + key.properties)
  - Debug build type with .debug applicationId suffix
  - Release build type with ProGuard minification
  - minSdk 21, targetSdk from Flutter
- Fix Flutter 3.38 API compatibility:
  - CardTheme → CardThemeData
  - TabBarTheme → TabBarThemeData
  - DialogTheme → DialogThemeData
- Implement missing ForgotPasswordPage for mobile
- Create cross-platform build scripts (build.sh + build.bat)
  - Supports: debug/release/clean/run modes
  - Supports: apk/appbundle/ios platforms
  - Unified build-output/ directory for APK artifacts
- All 4 builds verified: debug + release × 2 apps

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 06:22:13 -08:00
hailin d49200e876 feat: Wire all view components to Next.js App Router routes
- Create (admin) route group with AdminLayout wrapper
- Add page.tsx route files for all 25 view pages (dashboard, issuers,
  users, trading, risk, compliance, system, disputes, coupons, finance,
  chain, reports, merchant, agent, insurance, analytics sub-pages,
  compliance sub-pages)
- Update AdminLayout to use Next.js usePathname/useRouter for real
  URL-based navigation instead of internal state
- Add 'use client' directive to view components using useState hooks
- Fix 404 on /dashboard by creating proper App Router route structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 05:37:28 -08:00
hailin 9ce42ed5ac chore: Switch domain from admin.gogenex.com to admin.gogenex.cn
使用国内 .cn 域名用于 ICP 备案,支持国内 IP 直连加速。
国际域名 gogenex.com 保留在 Namecheap 不受影响。

变更:
- deploy.sh: 默认域名/邮箱改为 admin.gogenex.cn
- nginx 配置: 重命名为 admin.gogenex.cn.conf,替换所有域名引用
- DEPLOY.md: 更新所有域名引用

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 05:18:22 -08:00
hailin a2a42ebf23 docs: Add deployment guide for admin-web (DEPLOY.md)
完整的部署文档,涵盖:
- 环境要求与项目结构
- 3 步快速部署流程
- deploy.sh 全部命令参考 (Docker + Nginx + SSL)
- 自定义域名部署说明
- Docker 三阶段构建说明
- SSL 证书管理 (自动续期、手动续期、强制重申)
- Nginx HTTPS 配置特性说明
- 常见问题排查 (端口占用、构建失败、SSL 失败、日志查看)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 02:00:40 -08:00
hailin 51f4c60fe5 feat: Add Nginx + Let's Encrypt SSL support to admin-web deploy.sh
deploy.sh 新增 nginx 子命令,支持一键安装 Nginx 反向代理和
Let's Encrypt SSL 证书,参考 rwadurian api-gateway 的实现模式。

新增命令:
  - nginx install [domain] [email]: 完整安装流程 (5步)
    1. 自动安装 nginx + certbot 依赖
    2. 部署 HTTP 临时配置 (含 ACME 验证路径)
    3. certbot webroot 方式申请 SSL 证书
    4. 部署 HTTPS 完整配置 (从 nginx/ 目录读取)
    5. 配置证书自动续期钩子 (renew hook)
  - nginx ssl [domain] [email]: 仅申请/续期证书
  - nginx status: 查看 Nginx 服务和证书状态
  - nginx reload: 重载 Nginx 配置

新增文件:
  - nginx/admin.gogenex.com.conf: HTTPS 配置模板
    含 HTTP→HTTPS 重定向、TLS 1.2/1.3、HSTS、Gzip、
    安全头、Next.js 静态资源长缓存、反向代理到 :3000

默认域名: admin.gogenex.com
默认邮箱: admin@gogenex.com

使用方式:
  1. ./deploy.sh start              # 先启动 Docker 容器
  2. sudo ./deploy.sh nginx install # 安装 Nginx + SSL
  3. 访问 https://admin.gogenex.com

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:58:07 -08:00
hailin 29958602db fix: Move src/pages/ to src/views/ to avoid Next.js Pages Router conflict
Next.js treats `src/pages/` as the Pages Router and requires every file
to have a default export. Our page components use named exports
(e.g. `export const DashboardPage`) since they are UI view components,
not Next.js route handlers.

Rename to `src/views/` so Next.js only uses the App Router (`src/app/`).
The App Router page.tsx files will import from `@/views/` as needed.

24 files moved: src/pages/**/*.tsx → src/views/**/*.tsx

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:48:23 -08:00
hailin b2c81090f8 fix: Resolve TypeScript strict-mode error in IpoReadinessPage
The milestones array only had 'progress' and 'pending' status values,
causing TS to infer the status type as 'progress' | 'pending'. The
template code then compared m.status === 'done' which TS flagged as
unreachable. Fix by explicitly typing the array to include all three
possible status values: 'done' | 'progress' | 'pending'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:46:24 -08:00
hailin 79689c5f95 fix: Make Dockerfile tolerant of missing package-lock.json
The initial project has no node_modules or package-lock.json yet.
Use wildcard COPY for lock file and fallback to `npm install`
when lock file doesn't exist. Once lock file is generated and
committed, it will automatically use the faster `npm ci`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:39:14 -08:00
hailin 6b90d61199 chore: Add Next.js project config and app entry for admin-web
The previous deploy.sh commit included Dockerfile and docker-compose
but was missing the actual Next.js project files needed for `npm ci`
and `npm run build` to succeed. This adds the complete project skeleton.

## Project configuration files

### package.json
- Next.js 15.1.11, React 18, TypeScript 5.9
- Dependencies: @reduxjs/toolkit, @tanstack/react-query,
  @tanstack/react-table, axios, recharts, zustand, dayjs, clsx
- Scripts: dev, build, start, lint, format, type-check

### next.config.ts
- output: 'standalone' — required for Docker multi-stage build
- / redirects to /dashboard
- Remote image patterns enabled

### tsconfig.json
- Strict mode, bundler module resolution
- Path alias: @/* → ./src/*
- Incremental compilation enabled

### .gitignore / .dockerignore
- Standard Next.js ignores (node_modules, .next, out, coverage)
- Docker build excludes dev files, docs, git, IDE configs

## App Router entry files

### src/app/layout.tsx — Root layout
- HTML lang="zh-CN", imports globals.css + design-tokens.css
- Wraps children with Providers (placeholder for Redux/RQ/Auth)

### src/app/providers.tsx — Client-side providers wrapper
- Placeholder for Redux Provider, React Query, Theme, Auth

### src/app/page.tsx — Root page
- Redirects to /dashboard via next.config.ts

### src/app/globals.css — Global styles
- Imports design-tokens.css, box-sizing reset
- Custom scrollbar styling with design tokens
- Selection color using primary-container

### src/app/api/health/route.ts — Health check endpoint
- GET /api/health returns { status, service, timestamp }
- Used by Docker healthcheck and load balancers

### public/favicon.ico — Placeholder favicon

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:35:19 -08:00
hailin 8042160f83 . 2026-02-11 09:30:54 +00:00
hailin bae342f1bd chore: Add Docker deployment config for admin-web
Add complete deployment toolchain for the Genex Admin Web (React + Next.js),
mirroring the proven deployment pattern from the rwadurian project.

## Files added

### deploy.sh — One-click deployment script
- Commands: build / start / stop / restart / logs / status / clean
- Auto-detects `docker compose` vs `docker-compose`
- Port conflict detection with auto-stop of old service
- Health check verification after startup
- Supports PORT env override (default: 3000)

### Dockerfile — Multi-stage production build
- Stage 1 (deps): node:20-alpine, npm ci for deterministic installs
- Stage 2 (builder): Next.js production build with telemetry disabled
- Stage 3 (runner): Minimal runtime with standalone output
- Non-root user (nextjs:nodejs) for security
- curl installed for container health checks

### docker-compose.yml — Container orchestration
- Service: genex-admin-web on genex-network bridge
- Health check: GET /api/health every 30s, 3 retries
- Auto-restart: unless-stopped policy
- Timezone: Asia/Shanghai

### .env.development — Local dev environment
- API: http://localhost:8080/api

### .env.production — Production environment
- API: https://api.gogenex.com/api

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:22:22 -08:00
hailin e450bef7cd feat: Complete all 4 frontend UI prototypes covering guides 00-04
Add 116 UI prototype files across 4 frontend applications, achieving
~95% coverage of all functional requirements from development guides.

## mobile/ (Flutter Consumer + Merchant App) — 48 files
- Auth: welcome, login, register, forgot-password
- Coupons: home, market, search, detail, my-coupons, my-coupon-detail,
  order-confirm, payment, payment-success, redeem-qr
- Trading: trading, sell-order (AI pricing), transfer
- Wallet: wallet, deposit, withdraw, transaction-records
- Profile: profile, kyc (L0-L3), settings, payment-management, pro-mode
  (WalletConnect, chain address, tx hash, track selection)
- AI Agent: agent-chat, ai-fab (floating button with unread count)
- Merchant: merchant-home (scanner, confirm, success, history, dashboard),
  merchant-ai-assistant (redeem assist, traffic prediction, anomaly alerts)
- Message: message-list, message-detail
- Issuer: issuer-main-page
- Shared widgets: coupon-card, price-tag, credit-badge, kyc-badge,
  status-tag, empty-state, skeleton-loader, confirm-sheet, genex-button,
  ai-confirm-dialog (3-level risk confirmation)
- Theme: app-colors, app-typography, app-spacing, app-theme
- i18n: zh-CN, en-US, ja-JP

## admin-app/ (Flutter Issuer Console) — 27 files
- Auth: issuer-login
- Onboarding: 5-step enterprise onboarding with AI compliance check
- Dashboard: issuer-dashboard (stats, AI insight, credit/quota),
  user-portrait (age/geo/preference/repurchase/AI insight)
- Coupon management: list, create (template-based, AI pricing),
  detail (recall/delist), batch-operations (issue/recall/price-adjust)
- Redemption: scan-to-redeem with offline mode
- Finance: overview, reconciliation (auto-reconcile, export PDF/Excel),
  financing-analysis (cost-benefit, liquidity, risk indicators, AI strategy)
- Credit: credit-scoring (4-factor, tier progress, AI suggestions),
  quota-management (usage gauge, type breakdown, tier upgrade, increase requests)
- AI Agent: full conversation UI with quick actions
- Settings: account, notification, support, tier display
- Store management: hierarchy (HQ/regional/store), employee roles
- Shared: ai-suggestion-card
- Theme: app-colors, app-theme, app-typography, app-spacing
- i18n: zh-CN, en-US, ja-JP

## admin-web/ (React + Next.js Platform Admin) — 26 files
- Layout: AdminLayout with collapsible sidebar, 10 nav sections
- Dashboard: key metrics, transaction feed, system health
- Users: user management with KYC filtering, risk tags
- Issuers: issuer review with AI pre-screening, credit rating display
- Trading: real-time monitor, order book, abnormal detection
- Risk: risk dashboard, AI warnings, suspicious transactions, OFAC logs
- Compliance: SAR/CTR management, audit logs, AI report generation
- SEC Filing: S-1/10-K/10-Q/8-K tracker, filing timeline, auto-disclosure
- License management: FinCEN MSB, BitLicense, MTL (48 states), renewal alerts
- SOX compliance: ICFR/ITGC/access/change-mgmt controls, deficiency tracking
- Tax compliance: Federal + 4 states, 8 IRS forms, tax calendar
- IPO readiness: 28-item checklist (legal/financial/SOX/governance/insurance),
  blocker tracking, milestone timeline, category progress, key contacts
- Finance: fee revenue, settlement queue, breakage tracking
- Disputes: case management with SLA countdown, chain evidence
- Analytics: user (DAU/MAU, cohort retention, geographic), coupon (category,
  breakage, secondary market), market-maker (TVL, spread, health, risk alerts),
  consumer-protection (complaints, CSAT, fund utilization, non-compliant issuers)
- Insurance: consumer protection fund, claims, IPO checklist overview
- Chain monitor: smart contract status, blockchain metrics
- Reports: platform-wide report center
- AI Agent panel: session stats, top questions, module accuracy
- Merchant redemption: stats, store ranking, real-time feed
- Design tokens: CSS custom properties (colors, typography, spacing, shadows)
- i18n: zh-CN, en-US, ja-JP

## miniapp/ (Taro Mini Program + H5) — 15 files
- Pages: home, detail, purchase, orders, my-coupons, login, redeem, profile
- H5 pages: h5-share, h5-activity (countdown, featured coupons),
  h5-register (benefits, phone/SMS form, WeChat login)
- Components: coupon-card, ai-guide (recommendation bar + purchase bubble),
  share-card (brand header, QR code, coupon info)
- i18n: zh-CN, en-US, ja-JP

## Design System
- Primary: #6C5CE7 (innovation purple), Material 3 style
- Consistent design tokens across all platforms
- Zero blockchain terminology — "我的券" not "NFT", "订单号" not "TX Hash"
- Utility Track MVP only; Securities Track reserved as "coming soon"

## Not included (by design)
- Data/Domain layers (API, state management, business logic) — UI prototypes only
- Securities Track full UI — MVP focuses on Utility Track
- P2 "求购" (want-to-buy) feature — marked as optional

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-11 01:16:44 -08:00
hailin 03e5f5b3e3 v2.0: Supplement all guides to achieve 100% SRS coverage
Comprehensive additions across all 7 guide files (+2,439 lines):

- 05-Backend: fee calculation (Maker-Taker), Breakage processing,
  refund mechanism, market maker system, three-factor pricing engine,
  AI/ML models (LightGBM/LSTM/IsolationForest), AML detection rules,
  OFAC sync service, Travel Rule (TRISA), tax compliance (1099/FATCA),
  CCPA/GDPR data deletion, security incident response (P0-P3),
  disaster recovery (RPO/RTO), mapping table security (MPC+audit+anchor),
  multi-currency, fiat hot-standby, chain reconciliation, capacity
  planning, SDK development plan, dispute handling, customer service

- 06-Blockchain: GNX token economics, non-transferable coupon revert,
  differentiated KYC checks, validator-level OFAC/structuring/TravelRule
  interception, batch transfer, Treasury guarantee fund locking,
  contract upgrade rollback, multi-stablecoin (USDC+USDT), Oracle
  integration, asset securitization contract reserve

- 01-Flutter Mobile: Pro mode (seed phrase, social recovery, AA wallet),
  MetaMask integration, external wallet extraction, transfer history,
  balance/deposit/withdraw, order history, phone number change,
  offline redemption limits/conflicts, dispute/complaint, notifications

- 02-Flutter Admin: guarantee fund/frozen sales, reconciliation reports,
  secondary market analysis, financing effect analysis, refund window
  config, batch operations, coupon recall, multi-store hierarchy,
  dedicated customer service channel

- 03-Web Admin: user behavior analytics, coupon category analysis,
  1099 tax reports, FATCA, false advertising monitoring, SOX audit
  module, fee/revenue dashboard, settlement management, dispute
  arbitration, web merchant redemption console, market maker monitoring

- 00-UI Design: Utility/Securities Track UI isolation design

- 04-Mini Program: multi-language i18n (zh-CN/en-US/ja-JP),
  multi-currency display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 17:39:05 -08:00
hailin a0d2271cd5 Add comprehensive development guides for all platform components
- 00-UI设计需求 v1.1: AI Agent deep integration specs
- 01-Flutter移动端: Consumer + Merchant App (Riverpod + Clean Architecture)
- 02-Flutter管理后台: Issuer Console App (credit scoring, template-based issuance)
- 03-Web管理前端: Admin Dashboard (React + Next.js + Zustand + RTK)
- 04-小程序H5: Mini-program + H5 (Taro 3.x cross-platform)
- 05-后端: Backend services (NestJS + Go + DDD + Kong + PostgreSQL)
- 06-区块链: Genex Chain + 7-contract system (Cosmos SDK + cosmos/evm + Solidity)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 23:23:26 -08:00
hailin aa449d6bd3 Rewrite architecture and software dev docs based on SRS v4.1
Both documents completely rewritten to align with the v4.1 SRS:
- Architecture doc (v3.0): Genex Chain (Cosmos SDK + cosmos/evm),
  7-contract system, UX translation layer, three-tier asset control,
  GCFN global nodes, credit/pricing models, security IR, deployment
- Software dev doc (v2.0): Concise development requirements overview,
  all modules aligned with SRS including coupon type firewall, OFAC,
  Travel Rule, offline redemption, issuer configurable rules

Replaces deprecated Hyperledger Fabric / DPoA architecture with
Genex Chain / CometBFT throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 22:31:55 -08:00
hailin c822e4c14b v4.1: Reverse-supplement from architecture/dev docs
Add credit scoring formula with weights (3.5.1), three-factor
pricing model + AI-assisted pricing engine (3.3.4), issuer tier
incentive system (3.9), AI/ML tech stack selection (4.2), SDK
support plan with rate limits (3.10.1), GCFN global clearing
node architecture (5.2), capacity planning and matching latency
metrics (8.4-8.5).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 22:23:42 -08:00
hailin 99e3c65382 Add comprehensive SRS evaluation report (v3.3→v4.0)
Full evaluation covering: completeness, compliance, convenience,
social contribution, security, and technical integrity across
8 iterations with 30+ issues tracked to resolution.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:57:57 -08:00
hailin 967d7d62c9 v4.0: Final 4 refinements for complete coverage
- Merchant POS integration: scan/input/online redemption, offline capability, multi-store management (3.10.4)
- Issuer-configurable rules: transferability, resale limits, audience targeting, per-person limits, store restrictions (3.1.3)
- On-chain refund logic: atomic reverse swap, refund windows, non-refundable states, abuse prevention (3.4.2)
- KPI system expanded to 4 categories / 25 metrics: business, UX, security/compliance, infrastructure (8.1-8.4)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:26:20 -08:00
hailin 7a247c3a62 v3.9: Complete 6 remaining gaps for near-perfect coverage
- GNX token securities analysis with Howey Test (1.7)
- Smart contract upgrade strategy: Transparent Proxy + multisig + timelock (4.3.6)
- Security incident response plan: P0-P3 grading, emergency freeze, bug bounty (4.4.2)
- Privacy deletion rights vs blockchain immutability resolution (3.7.3)
- Critical third-party dependencies with backup options (4.7)
- Issuer B-end Web2 UX: template-based coupon creation, no blockchain knowledge needed (3.10.3)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:14:33 -08:00
hailin 9d0b499494 v3.8: Asset withdrawal, mapping security, terminology cleanup
- Three-tier asset control model: Standard / Withdraw to external wallet / Pro (3.4.1)
- Users can withdraw coupons to any EVM wallet, platform becomes irrelevant
- MPC-signed phone→address mapping table with hash anchoring on-chain (4.6.2)
- CARD Act vs Utility Track validity conflict noted with resolution path (3.7.1)
- Fix legacy terminology: 方案A/B → 标准模式/Pro模式

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 21:03:39 -08:00
hailin 1ca83e1bb1 v3.7: Web2 UX + Web3 infrastructure redesign
- Platform custody as default (3.4.1): MPC wallet auto-created on registration
- Phone/email registration first (3.6): no wallet concepts for users
- UX architecture layer (4.6): User Layer → Translation Layer → Infrastructure Layer
- Terminology mapping (9.2): all blockchain terms translated to user-friendly language
- MVP updated: phone registration, UX translation layer, phone-based P2P transfer

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 20:46:43 -08:00
hailin 15519b1670 v3.6: Coupon type firewall, P2P compliance routing, MVP Utility Track only
- Add section 1.6: Coupon Type Firewall (Utility/Securities dual-track)
  - Utility Track: resale price capped at face value (no profit = not security)
  - Securities Track: full SEC compliance (Reg D/A+/CF, Broker-Dealer)
  - Smart contract enforced: price cap, transfer count limit, type immutable
- Rewrite 4.3.4: P2P compliance routing architecture
  - <$3,000: free transfer, chain-level monitoring with structuring detection
  - >=$3,000: Compliance contract routing, Travel Rule enforced at validator level
  - Identity hash on-chain, plaintext off-chain (privacy preserved)
  - Redemption (consumption) not affected - platform still doesn't intervene
- Update MVP Phase 1: Utility Track only, avoid SEC securities compliance
- Update Phase 4: Securities Track after legal opinion + Broker-Dealer registration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 20:21:46 -08:00
hailin abcf1d9ab3 v3.5: Genex Chain architecture - Cosmos SDK + cosmos/evm, ref Cronos/dYdX v4
- Replace Kava reference with Cronos (architecture) + dYdX v4 (trading)
- Replace deprecated Ethermint with official cosmos/evm (Apache 2.0, 2025.3)
- Block time target: <=1s (Cronos validated), Block-STM parallel execution
- Off-chain orderbook + on-chain settlement (dYdX v4 pattern)
- Add Compliance and Governance smart contracts
- Platform subsidizes all gas fees in early stage
- Chain-level compliance: OFAC filtering, Travel Rule, emergency freeze

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 20:06:57 -08:00
hailin bbb52221bb v3.4: Complete 9 missing areas from comprehensive review
- OFAC sanctions screening (SDN list, real-time transaction screening)
- FATF Travel Rule (P2P transfers ≥$3000 via platform contract routing)
- Consumer protection laws (FTC Act, Dodd-Frank UDAAP, CARD Act)
- Gas fee strategy (Paymaster/ERC-4337, platform subsidizes user gas)
- Wallet loss recovery (MPC wallet, social recovery, AA wallet/ERC-4337)
- Market maker incentive mechanism (Maker-Taker model, liquidity mining)
- Disaster recovery & business continuity (RPO<1min, RTO<15min, multi-region)
- Blockchain selection criteria (gas cost, speed, EVM, regulatory friendliness)
- Commercial insurance requirements (D&O, E&O, Cyber, Fidelity Bond)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:55:37 -08:00
hailin 10cc21fed7 v3.3: SEC securities analysis, US regulatory compliance, Nasdaq IPO preparation
- Add section 1.5: Howey Test securities risk analysis, SEC Project Crypto taxonomy
- Update section 3.7: FinCEN/BSA, SEC registration, GENIUS Act, state MTLs, tax/privacy compliance
- Add chapter 6: Nasdaq IPO preparation (SOX, FASB, listing standards, post-IPO compliance)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 19:05:44 -08:00
hailin f22a5ffedf v3.2: Add AML, KYC tiers, dispute handling, business model, open platform
- KYC now mandatory with 4 tiers (L0-L3), no trading without KYC
- AML anti-money laundering: 4 identified laundering paths with countermeasures
- P2P transfer monitoring, related-party detection, transaction graph analysis
- Dispute resolution module: trade disputes, issuer default, coupon recall
- Platform business model: 5 revenue streams
- Open platform: API/SDK, developer sandbox
- Internationalization: multi-language, multi-currency
- Issuer management console
- MVP Phase 1 now includes KYC and AML from day one

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:54:10 -08:00
hailin 39234c2d10 Replace deposit model with credit-growth zero-deposit mechanism
- Zero deposit to onboard, start with low issuance quota
- Credit rating drives quota dynamically
- Deposit and sales freeze become optional (voluntary, boosts credit)
- Violation triggers: downgrade, quota cut, suspension, freeze

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:46:04 -08:00
hailin 7874000eed Add dual custody model: Plan B (default self-custody) + Plan A (managed)
- Default: users hold coupons in own wallet, platform only custodies fiat
- Plan A: enterprise signs service agreement for platform-managed custody
- Clear comparison table for both modes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:38:49 -08:00
hailin bff939b343 Add 3-tier guarantee mechanism, clarify fund custody model
- Three parallel guarantee modes: deposit, sales freeze, credit transparency
- Platform only custodies fiat; coupons stay in user wallets
- Renumber 3.1 subsections

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-09 18:37:14 -08:00
hailin d7699bae35 v3.1: Blockchain as infrastructure, not full decentralization
- Blockchain is infrastructure, platform provides centralized services on top
- Key innovation: smart contract settlement protects enterprise customer data
- Platform does NOT access consumer data during coupon redemption
- Clear separation: decentralized (issuance, P2P, settlement) vs centralized (review, rating, compliance)
- Fix secondary market: all holders can trade, not just consumers
- Fix KPI: instant on-chain confirmation

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 18:58:40 -08:00