Campaign Contract

The FoomD2E smart contract is the on-chain backbone of OnlyDancers. It handles the full lifecycle of a dance contest campaign: creation, tier setup, winner payout, and fund withdrawal.

How It Works

1

Create Campaign

Creator calls createCampaign() and deposits USDC. The contract:

  • Locks the campaign's tier structure and winner counts

  • Stores the creator's address and deposit amount

  • Makes the campaign immutable—no tier changes allowed once created

  • Begins accepting dancer submissions

2

Tier Rewards Are Immutable

Reward tiers are defined at campaign creation and cannot be changed. The contract stores:

  • Explicit tier amounts for top positions (1st Place: $5,000, 2nd Place: $3,000, etc.)

  • Fixed winner counts for each tier (1st Place: 1 winner, 4th-10th: 7 winners, etc.)

  • A calculated equal share for remaining positions based on pool size

This immutability ensures dancers know exactly what they're competing for when they enter.

3

Send Rewards

After judging, a relayer calls sendRewards() with winner addresses and their positions. The contract:

  • Pays out USDC position by position according to the tier structure

  • Validates that each position is assigned the correct reward amount

  • Prevents accidental or malicious duplicate payouts

4

Double-Payment Protection

Each winner position can only be paid once. If a relayer attempts to pay the same position twice:

  • The contract rejects the second payout

  • Funds remain locked in the contract

  • Admin can manually review and investigate

5

Withdrawal

Creator calls withdraw() to reclaim:

  • Unclaimed prize pool dust (remaining USDC after all payouts)

  • Unclaimed rewards from winners who never claimed their prize

This ensures no value is locked in the contract indefinitely.

Commission Structure

circle-check

Every USDC token deposited by creators and earned from dancer entry fees flows directly into the prize pool. The smart contract does not deduct any fees or percentages—100% of funds are available for payouts.

Security

The FoomD2E contract implements multiple security measures:

UUPS Upgradeable Admin can upgrade the contract logic without losing state, enabling bug fixes and feature additions.

Role-Based Access Control

  • Admin: Deploys campaigns, approves relayers, withdraws unclaimed funds

  • Relayer: Posts winner lists after judging, triggers payouts

Token Whitelisting Only approved tokens (USDC on Ethereum mainnet) can be used for campaigns. This prevents accidental use of incorrect token contracts.

circle-exclamation

Contract Deployment

  • Network: Ethereum Mainnet

  • Token: USDC (0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48)

  • Pattern: UUPS Proxy for upgradeable logic