mirror of
https://github.com/pezkuwichain/pwap.git
synced 2026-04-22 07:57:55 +00:00
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
This commit is contained in:
@@ -32,6 +32,7 @@ import { useWallet } from '@/contexts/WalletContext';
|
||||
import { supabase } from '@/lib/supabase';
|
||||
import { PolkadotWalletButton } from './PolkadotWalletButton';
|
||||
import { DEXDashboard } from './dex/DEXDashboard';
|
||||
import { P2PDashboard } from './p2p/P2PDashboard';
|
||||
import EducationPlatform from '../pages/EducationPlatform';
|
||||
|
||||
const AppLayout: React.FC = () => {
|
||||
@@ -49,6 +50,7 @@ const AppLayout: React.FC = () => {
|
||||
const [showMultiSig, setShowMultiSig] = useState(false);
|
||||
const [showDEX, setShowDEX] = useState(false);
|
||||
const [showEducation, setShowEducation] = useState(false);
|
||||
const [showP2P, setShowP2P] = useState(false);
|
||||
const { t } = useTranslation();
|
||||
const { isConnected } = useWebSocket();
|
||||
const { account } = useWallet();
|
||||
@@ -183,6 +185,16 @@ const AppLayout: React.FC = () => {
|
||||
<Droplet className="w-4 h-4" />
|
||||
DEX Pools
|
||||
</button>
|
||||
<button
|
||||
onClick={() => {
|
||||
setShowP2P(true);
|
||||
navigate('/p2p');
|
||||
}}
|
||||
className="w-full text-left px-4 py-2 text-gray-300 hover:bg-gray-800 hover:text-white flex items-center gap-2"
|
||||
>
|
||||
<Users className="w-4 h-4" />
|
||||
P2P
|
||||
</button>
|
||||
<button
|
||||
onClick={() => setShowStaking(true)}
|
||||
className="w-full text-left px-4 py-2 text-gray-300 hover:bg-gray-800 hover:text-white flex items-center gap-2"
|
||||
@@ -386,6 +398,10 @@ const AppLayout: React.FC = () => {
|
||||
<div className="pt-20 min-h-screen bg-gray-950">
|
||||
<EducationPlatform />
|
||||
</div>
|
||||
) : showP2P ? (
|
||||
<div className="pt-20 min-h-screen bg-gray-950">
|
||||
<P2PDashboard />
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<HeroSection />
|
||||
@@ -410,7 +426,7 @@ const AppLayout: React.FC = () => {
|
||||
)}
|
||||
|
||||
|
||||
{(showDEX || showProposalWizard || showDelegation || showForum || showModeration || showTreasury || showStaking || showMultiSig || showEducation) && (
|
||||
{(showDEX || showProposalWizard || showDelegation || showForum || showModeration || showTreasury || showStaking || showMultiSig || showEducation || showP2P) && (
|
||||
<div className="fixed bottom-8 right-8 z-50">
|
||||
<button
|
||||
onClick={() => {
|
||||
@@ -423,7 +439,7 @@ const AppLayout: React.FC = () => {
|
||||
setShowStaking(false);
|
||||
setShowMultiSig(false);
|
||||
setShowEducation(false);
|
||||
setShowEducation(false);
|
||||
setShowP2P(false);
|
||||
}}
|
||||
className="bg-green-600 hover:bg-green-700 text-white px-6 py-3 rounded-full shadow-lg flex items-center gap-2 transition-all"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user