Commit Graph

6 Commits

Author SHA1 Message Date
hailin a5f6b23a95 feat(pool-account): 池账户充值弹窗新增中心化充值 tab
与做市商管理一致,充值弹窗包含"中心化充值"和"区块链充值"两个 tab。
中心化充值直接调整池账户余额(ADJUSTMENT 类型分类账),无需区块链交易。

变更:
- wallet-service: pool-account.service 新增 centralizedDeposit 方法
- wallet-service: pool-account.controller 新增 POST /centralized-deposit
- admin-service: pool-account.controller 新增 POST /:walletName/centralized-deposit 代理
- frontend: configs.api + use-configs hook + configs page 充值弹窗 Tabs UI

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 02:26:31 -08:00
hailin 4f5b18be48 feat(pool-account): 实现池账户区块链充值检测和提现功能
为100亿销毁池和200万挖矿池实现完整的区块链充值/提现流程:
- 充值:独立扫描器检测 fUSDT 转入 → Kafka 事件 → wallet-service 入账
- 提现:前端 → admin-service 代理 → blockchain-service MPC签名转账 → wallet-service 记账

mining-blockchain-service:
- 新增 PoolAccountDeposit/PoolAccountBlockCheckpoint Prisma 模型
- 新增 PoolAccountDepositDetectionService(每5秒扫描 fUSDT 充值,每30秒更新确认数)
- 扩展 MPC 签名客户端支持 burnPool/miningPool 2-of-3 门限钱包
- 扩展 ERC20TransferService 支持池账户 fUSDT 转账
- 新增 API: POST /transfer/pool-account, GET /pool-accounts/:poolType/wallet-info
- 新增 Kafka topic 映射: pool_account.deposit.confirmed → pool_account.deposits

mining-wallet-service:
- TransactionType 枚举新增 BLOCKCHAIN_DEPOSIT/BLOCKCHAIN_WITHDRAW
- Seed: SHARE_POOL_A/B 初始余额改为0(完全靠链上充值)
- PoolAccountService 新增 blockchainDeposit()/blockchainWithdraw() 方法
- 新增 PoolAccountDepositConsumer 监听 Kafka 充值确认事件(Redis+DB 双重幂等)
- 新增 POST /pool-accounts/blockchain-withdraw 内部 API

mining-admin-service:
- 新增 PoolAccountController 代理到 wallet-service + blockchain-service
- GET /admin/pool-accounts/:walletName/balance(并行查询链下余额+链上钱包信息)
- POST /admin/pool-accounts/:walletName/blockchain-withdraw(先链上转账再记账)
- 新增配置: MINING_WALLET_SERVICE_URL, MINING_BLOCKCHAIN_SERVICE_URL, 池钱包用户名

frontend (mining-admin-web):
- 池账户 API 从 tradingClient (→trading-service) 改为 apiClient (→admin-service)
- 移除未使用的 tradingClient 和 axios 依赖

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 01:34:06 -08:00
hailin 109986ba49 fix(mining-wallet-service): move share-pool-balance route before :type param route
NestJS routes are matched in order, so the parameterized :type route
was capturing 'share-pool-balance' before it could reach the public
endpoint, causing 401 errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 06:22:30 -08:00
hailin 40869ef00f feat: split share pool into A (100亿) and B (200万) accounts
Backend changes:
- mining-wallet-service: Split SHARE_POOL into SHARE_POOL_A (100亿, for burning)
  and SHARE_POOL_B (200万, for mining distribution)
- Add /pool-accounts/share-pool-balance API endpoint to get total balance
- Update pool initialization logic and seed data
- Fix Kong routing for mining-wallet-service (strip_path: true)
- Fix Kong routing for trading-service (strip_path: true)

Constant updates (100.02亿 = 10,002,000,000):
- mining-service: TOTAL_SHARES
- trading-service: TOTAL_SHARES, trading config defaults
- trading-service seed: initial green points = 5760

Frontend changes:
- Add sharePoolBalanceProvider to fetch pool balance from mining-wallet-service
- Update contribution page to display real-time share pool balance (A + B)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-15 05:55:52 -08:00
hailin 77b682c8a8 feat(mining-wallet): make initialize endpoints public for internal network calls
Changed system-accounts/initialize and pool-accounts/initialize endpoints from
@AdminOnly to @Public to allow deploy scripts to call them without authentication.
These endpoints are only accessible from internal network.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-13 23:22:17 -08:00
hailin ca55a81263 feat(mining-wallet-service): 添加独立钱包管理微服务
- 新增 mining-wallet-service 完整实现,100% 与 1.0 系统隔离
- 支持系统账户:总部、运营、省公司、市公司、手续费、热钱包、冷钱包
- 支持池账户:份额池、黑洞池、流通池
- 支持用户钱包:算力钱包、代币存储钱包、绿积分钱包
- 实现用户-区域映射(独立于 1.0)
- 集成 KAVA 区块链:提现、充值、DEX Swap
- 所有交易记录包含交易对手信息(counterparty)
- 使用 Outbox 模式确保事件可靠发布

feat(mining-admin-service): 添加 mining-wallet-service CDC 同步

- 新增 13 个 Synced 同步表接收钱包服务数据
- 新增 wallet-sync.handlers.ts 处理钱包服务事件
- 更新 cdc-sync.service.ts 注册钱包服务事件处理器

chore(mining-service, trading-service): 为池账户添加 counterparty 跟踪字段

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-10 22:21:08 -08:00