- Add trading system activate/deactivate endpoints to trading-service
- Add trading management page to mining-admin-web with:
- Trading system status display and control
- Market overview (price, green points, circulation pool)
- Burn progress visualization
- Burn records list with filtering
- Add trading-service proxy configuration to next.config.js
- Add trading menu item to sidebar navigation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Modify AssetService to fetch mining account balance from mining-service
- Sum mining balance + trading balance for total share display
- Add miningShareBalance and tradingShareBalance fields to AssetDisplay
- Update frontend entity and model to support new fields
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add SharePool and CirculationPool initialization in BurnService.initialize()
- Initialize SharePool with 5760 green points (fixes price showing as 0)
- Remove misleading "= 5,760 积分值" display from trading page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
auth-service puts accountSequence in payload.sub, not payload.accountSequence.
This mismatch caused 401 errors when accessing trading endpoints.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Both services were missing JWT_SECRET environment variable, causing
401 Unauthorized errors when validating JWT tokens from auth-service.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
All mining services need to read shared environment variables
(JWT_SECRET, DATABASE_URL, etc.) from backend/services/.env
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Both services need to read JWT_SECRET from the shared .env file
in the parent directory (backend/services/.env).
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove existence check, directly upsert pool accounts to ensure
consistent state on every seed run.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Split the share pool into two accounts:
- SHARE_POOL_A: 100亿 for burning
- SHARE_POOL_B: 200万 for mining distribution
Total: 100.02亿
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The service uses 'api/v2' as global prefix, not 'api/v1'.
Request flow: /api/v2/mining-admin/auth/login -> strip path -> /auth/login -> upstream /api/v2/auth/login
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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>
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>
Change prefix from 'api/v2' to 'api/v2/trading' to match Kong gateway
configuration with strip_path: false.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add CDC consumer to listen for UserWalletCreated events from mining-wallet-service
- Create trading accounts when user contribution wallets are created (lazy creation)
- Add WalletSystemAccountCreated handler for province/city system accounts
- Add seed script for core system accounts (HQ, operation, cost, pool)
- Keep auth.user.registered listener for V2 new user registration
This ensures trading accounts are created in sync with wallet accounts,
supporting both V2 new users and V1 migrated users.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Effective contribution should equal theoretical total (totalTrees * 22617)
since it includes all parts: personal 70% + operation 12% + province 1% +
city 2% + level 7.5% + bonus 7.5% = 100%.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Backend: Add status filter to getPlantingLedger and getPlantingSummary
- Frontend: Change Row to Wrap for info items to prevent width overflow
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add totalTrees field from syncedAdoption aggregate
- Rename fields: networkLevelPending, networkBonusPending
- Stats card: show level pending and bonus pending separately
- Add new stats card for total trees count
- Price overview: 2-row layout showing all contribution metrics
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add networkPendingContribution and networkBonusPendingContribution to API
- Display combined pending contribution (teamLevel + teamBonus) in stats card
- Replace 'total contribution' with 'pending contribution' in price overview
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, totalContribution was incorrectly set to effectiveContribution.
Now correctly calculated as: personal + teamLevel + teamBonus
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add networkTotalContribution field to dashboard API response
- Display total hashrate alongside effective hashrate in stats cards
- Update price overview to show both effective and total contribution
- Change grid from 3 to 4 columns in price overview
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Previously, adoptions were synced with hardcoded contributionPerTree=1,
resulting in contribution values like 0.7 instead of the expected 15831.9.
Now the handler fetches the actual contribution rate from ContributionRateService
based on the adoption date, storing values like:
- Personal (70%): 22617 × 70% = 15831.9
- Team Level (0.5%): 22617 × 0.5% = 113.085
- Team Bonus (2.5%): 22617 × 2.5% = 565.425
Note: Historical data may need migration to apply the correct multiplier.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Kong routes /api/v2/auth/* to auth-service without stripping the path,
so controllers need 'auth/' prefix to match frontend requests:
- SmsController: 'sms' -> 'auth/sms'
- PasswordController: 'password' -> 'auth/password'
- UserController: 'user' -> 'auth/user'
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Changed `record.finalContribution` to `record.amount` for getting final contribution value
- Added optional chaining to prevent undefined errors
- Added default values for safety
The ContributionRecordAggregate uses `amount` property, not `finalContribution`.
This was causing "Cannot read properties of undefined (reading 'value')" errors.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add trading burn system with black hole, share pool, and price calculation
- Implement per-minute auto burn and sell burn with multiplier
- Add Kafka event publishing via outbox pattern (order, trade, burn events)
- Add user.registered consumer to auto-create trading accounts
- Implement Redis + DB dual idempotency for event processing
- Add price, burn, and asset API controllers
- Add migrations for burn tables and processed events
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Publish UserWalletCreated when a new wallet is created
- Publish UserWalletUpdated when wallet balance changes
- Events sent to cdc.mining-wallet.outbox topic for mining-admin-service
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add handler for CONTRIBUTION_CREDITED events from mining-wallet-service
to sync user wallet data to synced_user_wallets table.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Return usdtAvailable, usdtFrozen, pendingUsdt, settleableUsdt,
settledTotalUsdt, expiredTotalUsdt instead of old field names
- Query SyncedUserWallet table for GREEN_POINTS wallet data
- Use miningAccount.availableBalance for pendingUsdt
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add @Public() decorator to MiningController to allow mining-admin-service
to fetch mining records without authentication.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed event handler to:
- Listen to 'cdc.contribution.outbox' topic (CDC/Debezium format)
- Handle 'ContributionAccountUpdated' events instead of 'ContributionCalculated'
- Use effectiveContribution for mining power calculation
This fixes the issue where mining accounts had zero totalContribution
because they weren't receiving contribution sync events.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update getUserMiningRecords to call mining-service API instead of
returning empty records. This enables the admin dashboard to display
actual user mining records.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
NestJS matches routes in definition order. The :category/:key route was
matching mining/status before the specific mining routes. Moved mining
routes before the parameter routes to fix routing.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add debug logging to trace mining service calls
- Return error object instead of null when data is missing
- Include error message in response for debugging
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add GET and POST /configs/transfer-enabled endpoints to control
the transfer switch. Routes are placed before :category/:key to
avoid being matched as path parameters.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- 添加ts-node/typescript到生产环境以支持seed执行
- 启动脚本中添加prisma db seed执行
- 复制tsconfig.json到生产环境
参考mining-wallet-service的Dockerfile配置
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>