// Flywheel configuration for gaming (set up via web app)
// Configuration at https://believe.app/projects:
// - Token: game_token_456
// - Daily Burn Limit: 100,000 tokens (high limit for active gaming)
// - Daily Airdrop Limit: 75,000 tokens
// - Proof Types: LEVEL_UP, TOURNAMENT_WIN, DAILY_LOGIN, ACHIEVEMENT_UNLOCK
// After web app setup:
const gamingApiKey = "your_gaming_api_key";
const gamingVaultAddress = "your_gaming_vault_address";
// Handle level progression
async function handleLevelUp(playerId, newLevel, experienceGained) {
  const burnAmount = newLevel * 100; // Progressive burn
  const rewardAmount = experienceGained * 2; // Experience-based reward
  const pipeline = {
    type: "LEVEL_UP",
    payload: JSON.stringify({
      playerId,
      previousLevel: newLevel - 1,
      newLevel,
      experienceGained,
      totalExperience: await getPlayerExperience(playerId),
      timestamp: new Date().toISOString(),
    }),
    actions: [
      { action: "BURN", amount: burnAmount },
      {
        action: "AIRDROP",
        toAddress: await getPlayerWallet(playerId),
        amount: rewardAmount,
      },
    ],
  };
  return await executePipeline(pipeline);
}
// Handle tournament victories
async function handleTournamentWin(tournamentId, winnerId, prize) {
  const burnAmount = prize * 0.1; // Burn 10% of prize value
  const rewardAmount = prize; // Full prize to winner
  const pipeline = {
    type: "TOURNAMENT_WIN",
    payload: JSON.stringify({
      tournamentId,
      winnerId,
      prize,
      participants: await getTournamentParticipants(tournamentId),
      tournamentType: await getTournamentType(tournamentId),
      timestamp: new Date().toISOString(),
    }),
    actions: [
      { action: "BURN", amount: burnAmount },
      {
        action: "AIRDROP",
        toAddress: await getPlayerWallet(winnerId),
        amount: rewardAmount,
      },
      { action: "MEMO", message: `Tournament champion: ${tournamentId}` },
    ],
  };
  return await executePipeline(pipeline);
}
// Daily engagement rewards
async function handleDailyLogin(playerId, streakCount) {
  const baseReward = 100;
  const streakBonus = Math.min(streakCount * 10, 500); // Cap at 500
  const rewardAmount = baseReward + streakBonus;
  // Only airdrop for daily logins, no burn
  const pipeline = {
    type: "DAILY_LOGIN",
    payload: JSON.stringify({
      playerId,
      streakCount,
      previousLoginDate: await getLastLoginDate(playerId),
      timestamp: new Date().toISOString(),
    }),
    actions: [
      {
        action: "AIRDROP",
        toAddress: await getPlayerWallet(playerId),
        amount: rewardAmount,
      },
    ],
  };
  return await executePipeline(pipeline);
}