Commit Graph

9 Commits

Author SHA1 Message Date
pezkuwichain 9bb71c436b fix: update escrow address to Treasury_3
- Update PLATFORM_ESCROW_ADDRESS in p2p-fiat.ts
- Update PLATFORM_WALLET in verify-deposit edge function
- Use controlled wallet for P2P deposits/withdrawals
2026-02-03 16:50:56 +03:00
pezkuwichain 7636d46c7d feat(p2p): OKX-level security upgrade with Edge Functions
- Add process-withdraw Edge Function for blockchain withdrawals
- Update verify-deposit Edge Function with @pezkuwi/api
- Add withdrawal limits (daily/monthly) and fee system
- Add hot wallet configuration with production address
- Add admin roles for dispute resolution
- Add COMBINED SQL migration with full P2P system
- Encrypt payment details with AES-256-GCM
- Prevent TX hash reuse with UNIQUE constraint
2026-01-29 03:12:02 +03:00
pezkuwichain 7e2c2840d3 chore: Fix linting errors and update shared libs for mobile build 2026-01-19 03:35:33 +03:00
pezkuwichain 1295c36241 Rebrand: polkadot → pezkuwi build fixes
- Fixed TypeScript type assertion issues
- Updated imports from api-augment/substrate to api-augment/bizinikiwi
- Fixed imgConvert.mjs header and imports
- Added @ts-expect-error for runtime-converted types
- Fixed all @polkadot copyright headers to @pezkuwi
2026-01-07 02:32:54 +03:00
pezkuwichain fe2cd390f6 feat(p2p): add Kurdish diaspora payment methods (130+ total)
- Add 61 new payment methods for diaspora countries:
  - Germany (EUR): Sparkasse, Commerzbank, DKB, etc.
  - Sweden (SEK): Swish, Nordea, SEB, Swedbank
  - UK (GBP): Faster Payments, Barclays, HSBC, Monzo
  - France (EUR): Crédit Agricole, Lydia, BNP Paribas
  - Netherlands (EUR): iDEAL, ABN AMRO, Bunq, Tikkie
  - Belgium (EUR): Bancontact, KBC
  - Austria (EUR): Erste Bank, Raiffeisen
  - Switzerland (CHF): TWINT, UBS, PostFinance
  - Norway (NOK): Vipps, DNB, SpareBank 1
  - Denmark (DKK): MobilePay, Danske Bank
  - Australia (AUD): PayID, Commonwealth Bank
  - Canada (CAD): Interac e-Transfer, TD Bank

- Expand FiatCurrency type: SEK, GBP, CHF, NOK, DKK, AUD, CAD
- Update CreateAd, BlockTrade, ExpressMode components
- Add regional labels (Bakur, Başûr, Rojhilat, EU diaspora)
2025-12-12 03:48:57 +03:00
pezkuwichain 14f5e84d15 feat(p2p): implement OKX-style internal ledger escrow system
Phase 5 implementation - Internal Ledger Escrow (OKX Model):
- No blockchain transactions during P2P trades
- Blockchain tx only at deposit/withdraw
- Fast and fee-free P2P trading

Database:
- Add user_internal_balances table
- Add p2p_deposit_withdraw_requests table
- Add p2p_balance_transactions table
- Add lock_escrow_internal(), release_escrow_internal() functions
- Add process_deposit(), request_withdraw() functions

UI Components:
- Add InternalBalanceCard showing available/locked balances
- Add DepositModal for crypto deposits to P2P balance
- Add WithdrawModal for withdrawals from P2P balance
- Integrate balance card into P2PDashboard

Backend:
- Add process-withdrawal Edge Function
- Add verify-deposit Edge Function

Updated p2p-fiat.ts:
- createFiatOffer() uses internal balance lock
- confirmPaymentReceived() uses internal balance transfer
- Add internal balance management functions
2025-12-12 00:41:11 +03:00
pezkuwichain dcbfa4789a feat(p2p): add atomic escrow system with race condition protection
- Add p2p_platform_escrow table for tracking locked funds
- Implement accept_p2p_offer() with FOR UPDATE lock to prevent race conditions
- Add complete_p2p_trade() and cancel_p2p_trade() atomic functions
- Configure platform escrow wallet: 5DFwqK698vL4gXHEcanaewnAqhxJ2rjhAogpSTHw3iwGDwd3
- Update AdList to show user's own offers with Your Ad badge
- Remove unused getActiveOffers import (ESLint fix)
2025-12-11 20:45:14 +03:00
pezkuwichain 7330b2e7a6 feat(p2p): add Phase 3 dispute system components
- Add DisputeModal.tsx with reason selection, evidence upload, terms acceptance
- Add P2PDispute.tsx page with evidence gallery, status timeline, real-time updates
- Integrate dispute button in P2PTrade.tsx
- Add /p2p/dispute/:disputeId route to App.tsx
- Add P2P test suite with MockStore pattern (32 tests passing)
- Update P2P-BUILDING-PLAN.md with Phase 3 progress (70% complete)
- Fix lint errors in test files and components
2025-12-11 09:10:04 +03:00
pezkuwichain da1092a06f feat: Phase 3 - P2P Fiat Trading System (Production-Ready)
Backend Infrastructure:
- Add p2p-fiat.ts (20KB) - Enterprise-grade P2P trading library
- Implement blockchain escrow integration (lock/release)
- Add encrypted payment details storage
- Integrate reputation system (trust levels, badges)
- Create 65 payment methods across 5 currencies (TRY/IQD/IRR/EUR/USD)

Database Schema (Supabase):
- p2p_fiat_offers (sell offers with escrow tracking)
- p2p_fiat_trades (active trades with deadlines)
- p2p_fiat_disputes (moderator resolution)
- p2p_reputation (user trust scores, trade stats)
- payment_methods (65 methods: banks, mobile payments, cash)
- platform_escrow_balance (hot wallet tracking)
- p2p_audit_log (full audit trail)

RPC Functions:
- increment/decrement_escrow_balance (atomic operations)
- update_p2p_reputation (auto reputation updates)
- cancel_expired_trades (timeout automation)
- get_payment_method_details (secure access control)

Frontend Components:
- P2PPlatform page (/p2p route)
- P2PDashboard (Buy/Sell/My Ads tabs)
- CreateAd (dynamic payment method fields, validation)
- AdList (reputation badges, real-time data)
- TradeModal (amount validation, deadline display)

Features:
- Multi-currency support (TRY, IQD, IRR, EUR, USD)
- Payment method presets per country
- Blockchain escrow (trustless trades)
- Reputation system (verified merchants, fast traders)
- Auto-timeout (expired trades/offers)
- Field validation (IBAN patterns, regex)
- Min/max order limits
- Payment deadline enforcement

Security:
- RLS policies (row-level security)
- Encrypted payment details
- Multisig escrow (production)
- Audit logging
- Rate limiting ready

Status: Backend complete, UI functional, VPS deployment pending
Next: Trade execution flow, dispute resolution UI, moderator dashboard
2025-11-17 06:43:35 +03:00