Staging Database Status & Seed Instructions
Last Verified: January 2026Status: ✅ Already Seeded - Ready for Testing
Single-Fund Setup
The staging database uses a single fund for all users:| Fund | Code | UUID | Description |
|---|---|---|---|
| Zest Growth Fund | ZGF | 33333333-3333-3333-3333-333333333333 | Primary platform fund |
- ~3,857 migrated users (investor IDs:
INV-XXXXXX) - 7 test users (testinvestor, test, l2investor, etc.)
- Cycle 0: Seed cycle for test users (created by seed script)
- Cycles 1-4: Historical cycles for migrated users (created by migration)
- The seed script is migration-safe and only modifies test user data
- Migrated users are never deleted or modified by the seed script
- Test users can be reset anytime by re-running the seed script
- Running the seed multiple times is safe and idempotent
Understanding Cycle & Tranche Relationships
Before testing, understand how the seed data is structured:Key Concepts
| Term | Definition |
|---|---|
| Cycle | A time period (typically weekly/monthly) during which investments earn profit/loss |
| Tranche | An investment unit belonging to a user, linked to a fund |
| Cycle Status | PENDING → PROCESSING → PROFIT_DISTRIBUTED → COMPLETED |
| Tranche Status | PENDING (waiting) → ACTIVE (earning) → MATURED (unlocked) |
Seed Data Structure (ZGF Fund - Test Users)
The seed creates a completed historical cycle with active tranches for test users:Why This Setup?
- COMPLETED cycle - Simulates a fund that has already run one profit distribution
- ACTIVE tranches - Users see their investments earning; not locked in PENDING state
- available_profit set - Users can test withdrawing or reinvesting profits immediately
- current_cycle_id linked - Tranches are properly associated with the cycle
What Investors See in Portfolio
When you log in astestinvestor@zestamc.com, the portfolio page displays:
| Metric | Value | Source |
|---|---|---|
| Total Principal | $10,000 | tranches.principal |
| Available Profit | $500 | tranches.available_profit |
| Bonus Balance | $50 | wallet_balances.bonus_balance |
| Portfolio Value | $10,550 | principal + profit + bonus |
| Tranche Status | ACTIVE | Ready to earn in next cycle |
Current Staging Data
The staging database is already seeded with all test data. No action required to start testing.Test Users
| Role | User Type | Has Portfolio | |
|---|---|---|---|
admin@zestamc.com | SUPER_ADMIN, INVESTOR | INDIVIDUAL | No |
fundadmin@zestamc.com | FUND_ADMIN | INDIVIDUAL | No |
testinvestor@zestamc.com | INVESTOR | INDIVIDUAL | Yes ($10,000) |
test@zestamc.com | INVESTOR | INDIVIDUAL | Yes ($5,000) |
l2investor@zestamc.com | INVESTOR | INDIVIDUAL | Yes ($2,000) |
l3investor@zestamc.com | INVESTOR | INDIVIDUAL | Yes ($3,000) |
institution@zestamc.com | INVESTOR | INSTITUTION | Yes ($100,000) |
supportagent@zestamc.com | SUPPORT_AGENT | INDIVIDUAL | No |
- SUPER_ADMIN: Full access to all admin operations, system settings, cycle lifecycle (create, start, distribute). Cannot set PNL rate.
- FUND_ADMIN: Cycle management (view, set profit rates), fund manager oversight, trade approvals.
- SUPPORT_AGENT: Support Center only, read investor profiles for context.
- INVESTOR: Own data only (portfolio, deposits, withdrawals).
Referral Chain
Fund
| Name | Code | Cycle Type | UUID |
|---|---|---|---|
| Zest Growth Fund | ZGF | WEEKLY | 33333333-3333-3333-3333-333333333333 |
Note: Single fund for all users (migrated + test). Fixed UUID for consistency.
Cycle (Seed Cycle 0)
| Cycle # | Status | Start Date | End Date | Profit Rate | Total Distributed |
|---|---|---|---|---|---|
| 0 | COMPLETED | ~2 months ago | ~1 month ago | 1.7% | $4,500 |
Note: This is a “historical” cycle that simulates previous profit distribution. It allows tranches to have available_profit from the start.
Active Tranches
| Investor | Principal | Available Profit | Original Principal | Status |
|---|---|---|---|---|
| testinvestor | $10,000 | $500 | $10,000 | ACTIVE |
| test | $5,000 | $250 | $5,000 | ACTIVE |
| l2investor | $2,000 | $100 | $2,000 | ACTIVE |
| l3investor | $3,000 | $150 | $3,000 | ACTIVE |
| institution | $100,000 | $3,500 | $100,000 | ACTIVE |
| TOTAL | $120,000 | $4,500 | $120,000 |
Bonus Wallet Balances
| User | Bonus Balance |
|---|---|
| testinvestor | $50 |
| test | $25 |
| l2investor | $15 |
Wallet Addresses
| User | Network | Status | Purpose |
|---|---|---|---|
| testinvestor | TRC20 | ACTIVE | Verified withdrawal addr |
| testinvestor | ERC20 | PENDING_APPROVAL | For admin approval test |
| test | TRC20 | ACTIVE | Verified withdrawal addr |
| l2investor | TRC20 | ACTIVE | Verified withdrawal addr |
| l3investor | TRC20 | ACTIVE | Verified withdrawal addr |
| institution | TRC20 | ACTIVE | Verified withdrawal addr |
Pending Items (For Admin Testing)
| Type | User | Details |
|---|---|---|
| Pending Wallet | testinvestor | ERC20 wallet awaiting approval |
| Pending Deposit | test | $500 deposit awaiting approval |
KYC Status (For KYC Verification Testing)
| User | KYC Status | Purpose |
|---|---|---|
| testinvestor | NOT_STARTED | Test banner, blocked deposit/withdrawal |
| test | PENDING | Test “under review” status display |
| l2investor | REJECTED | Test rejected status and retry option |
| l3investor | APPROVED | Test verified user full access |
| institution | APPROVED | Normal operations |
| admin | APPROVED | Admin tests |
docs/testing/phase-9-kyc-verification-testing.md for full test journeys.
Support Tickets (For Support Chat Testing)
| Ticket Subject | User | Status | Assigned To | Category |
|---|---|---|---|---|
| Question about my pending deposit | testinvestor | OPEN | (unassigned) | DEPOSIT |
| KYC verification question - RESOLVED | test | CLOSED | supportagent | KYC |
| Withdrawal taking longer than expected | testinvestor | IN_PROGRESS | supportagent | WITHDRAWAL |
Direct Messages (For DM Testing)
| Sender | Recipient | Preview | Read |
|---|---|---|---|
| admin | test | Important: Please update your KYC documents… | Unread |
| admin | testinvestor | Your withdrawal of $200 has been processed… | Read |
| admin | test | Reminder: New investment opportunities… | Unread |
Login Credentials
All accounts use OTP-based login.| OTP Code | |
|---|---|
| All accounts | Check email |
Testing Scenarios
Scenario 1: Investor Checks Portfolio
- Login as
testinvestor@zestamc.com - Navigate to Portfolio page
- Expected values:
- Principal: $10,000
- Available Profit: $500
- Bonus Balance: $50
- Tranche Status: ACTIVE
Scenario 2: Admin Creates New Cycle
- Login as
admin@zestamc.com - Go to Admin > Cycles
- Create a new cycle (Cycle 1) for Zest Growth Fund
- Set dates (e.g., today + 7 days)
- Expected: Cycle shows in PENDING status with $120,000 total principal
Scenario 3: Admin Starts Cycle
- With a PENDING cycle created
- Click “Start Cycle”
- Enter OTP from email
- Expected:
- Cycle status → PROCESSING
- All ACTIVE tranches participate
- Any PENDING tranches would activate (none in seed)
Scenario 4: Investor Reinvests Profit
- Login as
testinvestor@zestamc.com - Navigate to Reinvestment
- Reinvest $250 from available profit
- Expected:
- New PENDING tranche created with $250
- Available profit reduced by $250
- Tranche will join next cycle when admin starts it
Scenario 5: Support Agent Claims Ticket
- Login as
supportagent@zestamc.com - Go to Support page
- Find the OPEN ticket “Question about my pending deposit”
- Click “Claim” or “Assign to Me”
- Expected:
- Ticket assigned to you
- Status changes to IN_PROGRESS
- System message appears in chat
Scenario 6: Super Admin Sends Direct Message
- Login as
admin@zestamc.com - Navigate to user management or Direct Messages
- Select
testinvestor@zestamc.comas recipient - Send a message
- Expected:
- Message sent successfully
- Message appears in testinvestor’s inbox when they login
Re-seeding (Developer Only)
To reset and re-seed the staging database, run the SQL seed file:- Only affects test users (testinvestor, test, l2investor, etc.)
- Migrated users (~3,857 with
INV-XXXXXXIDs) are never modified - Can be run multiple times safely
- Uses same fund (ZGF) as migration
seed-staging.sql) will:
- Clean test user data only (testinvestor, test, l2investor, etc.)
- Preserve migrated user data (investor_id LIKE ‘INV-%’)
- Ensure ZGF fund exists (uses fixed UUID: 33333333-…-333333333333)
- Create Cycle 0 (COMPLETED) for test user tranches
- Create ACTIVE tranches linked to Cycle 0
- Set up bonus balances for referral testing
- Create wallet addresses for test users (including 1 pending for admin testing)
- Create sample deposit requests (1 completed, 1 pending)
- Set up referral chain for test users
- Create support agent user with SUPPORT_AGENT role
- Create sample support tickets (OPEN, CLOSED, IN_PROGRESS)
- Create sample ticket messages and internal notes
- Create sample direct messages from admin
Quick Verification
Staging User IDs (Reference)
These are the actual UUIDs in the staging database:| UUID | Role(s) | |
|---|---|---|
admin@zestamc.com | 302c97f7-e782-4348-9d3d-37ffb79ab3ad | SUPER_ADMIN, INVESTOR |
fundadmin@zestamc.com | 70cb114e-cf88-495c-a1c2-95fc4369c494 | FUND_ADMIN |
testinvestor@zestamc.com | d46847bd-5477-4c75-8692-7cdcf49125fb | INVESTOR |
test@zestamc.com | 0d73af5b-1c20-4258-9494-1698ed3aa28e | INVESTOR |
l2investor@zestamc.com | 78f1fb65-b8d6-46e2-94da-9260ff7d50bc | INVESTOR |
l3investor@zestamc.com | e895f521-c2bf-40b8-89b7-87a386c83c6e | INVESTOR |
institution@zestamc.com | 33f8f3ed-6693-4d47-80cd-5daae6155640 | INVESTOR |
supportagent@zestamc.com | 984d40d9-2494-49c2-8974-3e4a2f5aae6b | SUPPORT_AGENT |
Fixed IDs for FK References
| Entity | UUID |
|---|---|
| Zest Growth Fund | 33333333-3333-3333-3333-333333333333 |
| Cycle 0 (Seed) | 11111111-1111-1111-1111-111111111111 |
| testinvestor tranche | aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa |
| test tranche | bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb |
| l2investor tranche | cccccccc-cccc-cccc-cccc-cccccccccccc |
| l3investor tranche | dddddddd-dddd-dddd-dddd-dddddddddddd |
| institution tranche | eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee |
| Support Ticket 1 (OPEN) | 11111111-aaaa-aaaa-aaaa-111111111111 |
| Support Ticket 2 (CLOSED) | 22222222-aaaa-aaaa-aaaa-222222222222 |
| Support Ticket 3 (IN_PROGRESS) | 33333333-aaaa-aaaa-aaaa-333333333333 |
Troubleshooting
Portfolio shows $0 or wrong values
- Verify tranches have
current_cycle_idset (links to cycle) - Check tranche
statusis ACTIVE (not PENDING) - Run verification query above to confirm data
Cannot login
- Verify you’re using the correct email (case-sensitive)
- Use OTP from email
- Check if the staging frontend is accessible at
https://zestamc.savibm.com
Missing data
The staging database should have all test data. If something is missing, contact the developer to re-seed.Connection issues
If you cannot connect to the staging API:- Check the API is running on Fly.io
- Verify Redis is accessible on Upstash
- Check Supabase project status
Related Documentation
- Cycles System Deep Dive - Full technical explanation
- Core Mechanics - Profit distribution details
- Reinvestment Architecture - How reinvestments create new tranches