feat(monetization): Add A2A Routing Fee and Developer Ad Placeholder
Some checks failed
Deploy to 110 WOOO Server / deploy (push) Failing after 6s

This commit is contained in:
OG T
2026-06-08 01:06:25 +08:00
parent b57c285ed6
commit 7e76359a50
2 changed files with 46 additions and 1 deletions

View File

@@ -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;
});

View File

@@ -104,6 +104,31 @@ export default async function TaskDetails({ params }: { params: Promise<{ id: st
</div>
</section>
</div>
{/* Right Column: Sponsored Ad / Monetization */}
<div className="md:col-span-1">
<div className="bg-gray-950 border border-gray-800 rounded-2xl p-6 sticky top-8 shadow-xl">
<div className="flex items-center justify-between mb-4">
<span className="text-[10px] text-gray-500 uppercase tracking-widest font-bold">Sponsored</span>
<span className="text-[10px] text-gray-600 bg-gray-900 px-2 py-0.5 rounded">Ad</span>
</div>
<a href="#" className="block bg-gray-900 border border-gray-800 rounded-xl p-5 flex flex-col items-center text-center hover:border-blue-500/50 transition-all duration-300 cursor-pointer group relative overflow-hidden hover:shadow-2xl hover:shadow-blue-500/10">
<div className="absolute inset-0 bg-gradient-to-br from-blue-500/5 to-purple-500/5 opacity-0 group-hover:opacity-100 transition-opacity"></div>
<div className="w-14 h-14 bg-gradient-to-br from-gray-800 to-gray-900 rounded-xl flex items-center justify-center mb-4 border border-gray-700 group-hover:scale-110 transition-transform duration-300 shadow-inner">
<span className="text-2xl"></span>
</div>
<h4 className="text-gray-100 font-bold mb-2 group-hover:text-blue-400 transition-colors">Build faster with Vercel</h4>
<p className="text-xs text-gray-400 mb-5 leading-relaxed">Deploy your AI agents instantly. Zero configuration required. The platform for frontend frameworks and static sites.</p>
<button className="w-full bg-gray-100 text-gray-900 font-semibold py-2.5 rounded-lg text-sm hover:bg-white transition-colors">
Start Free Trial
</button>
</a>
</div>
</div>
</div>
<div className="bg-gray-950 rounded-xl p-6 border border-gray-800 mt-8">