diff --git a/apps/web/src/app/api/mcp/[tool]/route.ts b/apps/web/src/app/api/mcp/[tool]/route.ts index 16cae0e..3f70ccc 100644 --- a/apps/web/src/app/api/mcp/[tool]/route.ts +++ b/apps/web/src/app/api/mcp/[tool]/route.ts @@ -716,13 +716,17 @@ export async function POST(request: NextRequest, props: { params: Promise<{ tool throw new Error("Sub-task reward cannot exceed parent task reward"); } + // 5% Platform Routing Fee for A2A Subcontracting + const platformFee = Math.floor(parsed.reward_amount * 0.05); + const subTaskReward = parsed.reward_amount - platformFee; + const newTask = await tx.task.create({ data: { title: `[Sub-Task] ${parsed.title}`, description: parsed.description, status: TaskStatus.OPEN, difficulty: "HELLO_WORLD", - reward_amount: parsed.reward_amount, + reward_amount: subTaskReward, reward_currency: claim.held_currency, required_stack: ["A2A", "Agent Sub-Task"], scope_clarity_score: 1.0, @@ -743,6 +747,22 @@ export async function POST(request: NextRequest, props: { params: Promise<{ tool afterState: { status: TaskStatus.OPEN, parent: claim.task_id } }); + if (platformFee > 0) { + await logAuditEvent(tx, { + actorType: "SYSTEM", + actorId: "PLATFORM", + action: "PLATFORM_FEE_COLLECTED", + entityType: "TASK", + entityId: newTask.id, + message: `A2A Routing Fee Collected: ${platformFee} ${claim.held_currency}`, + metadata: { + fee_amount: platformFee, + currency: claim.held_currency, + original_reward: parsed.reward_amount + } + }); + } + return newTask; }); diff --git a/apps/web/src/app/tasks/[id]/page.tsx b/apps/web/src/app/tasks/[id]/page.tsx index c0afe46..f0ee9a7 100644 --- a/apps/web/src/app/tasks/[id]/page.tsx +++ b/apps/web/src/app/tasks/[id]/page.tsx @@ -104,6 +104,31 @@ export default async function TaskDetails({ params }: { params: Promise<{ id: st + + {/* Right Column: Sponsored Ad / Monetization */} +