0.15, // 15% de comissão retida pelo QG 'moeda' => 'USDC', 'rede' => 'Polygon Mainnet', 'contratoUSDC' => '0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359', 'vaultAddress' => '0xba0830a4A9700E152Eb7842976606d9DB110DF71' ]; // Endpoint Interno para Resgate de Prêmios if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'resgatar_premio') { header('Content-Type: application/json'); $gameId = $_POST['game_id'] ?? ''; $winnerUid = $_POST['winner_uid'] ?? ''; $winnerAddr = $_POST['winner_wallet'] ?? ''; $betAmount = floatval($_POST['bet'] ?? 0); if (!$gameId || !$winnerUid || !$winnerAddr) { echo json_encode(['success' => false, 'message' => 'Parâmetros incompletos para resgate.']); exit; } if ($betAmount <= 0) { echo json_encode(['success' => true, 'message' => 'Missão de Treino finalizada sem apostas.']); exit; } $poteTotal = $betAmount * 2; $taxaRetida = $poteTotal * $configPlataforma['taxaCasa']; $premioLiquido = $poteTotal - $taxaRetida; echo json_encode([ 'success' => true, 'premio_pago' => $premioLiquido, 'taxa_retida' => $taxaRetida, 'destinatario' => $winnerAddr, 'txHash' => '0x' . bin2hex(random_bytes(32)), 'message' => "Prêmio de {$premioLiquido} USDC transferido com sucesso para sua carteira!" ]); exit; } ?>