🦾Technical Design

Smart Contracts

  • DuelToken: ERC20 with mint (owner) and burn functions. Symbol: DUEL.

  • CryptoPriceDuelArena: Core logic.

    • Inheritance: Ownable, uses SafeERC20.

    • Integrations: UniswapV2Router, Chainlink PriceOracle, IERC20 ($DUEL, USDC).

    • Data Structures:

      • Duel Struct: Config (asset, times, price, etc.), Status (resolved, winner), Pots (totals, effective losing).

      • Mappings: Oracles, duels, per-user stakes.

    • Constants: MIN_STAKE = 1000.

    • Events: DuelCreated, Staked, DuelResolved, Payout.

Key Functions

  • createDuel: Validates inputs, fetches price, optional stake.

  • stakeOnDuel: Transfers tokens, updates pots (if active).

  • resolveDuel: Checks time, determines winner, applies fees.

  • claimWinnings: Verifies eligibility, calculates/transfers payout.

  • Admin: Update marketing wallet, emergency withdraw.

Security Measures

  • Oracle Integrity: Chainlink's decentralized feeds.

  • Transfer Safety: SafeERC20 prevents failures.

  • Access Control: OnlyOwner for sensitive ops.

  • Validations: Price >0, duration >0, percentage 1-100.

  • Audits: Planned for mainnet; code follows best practices.

Deployment on Ethereum; compatible with L2s for scalability.


Last updated