For the complete documentation index, see llms.txt. This page is also available as Markdown.

System Architecture Overview

Evently — The Pulse of Truth. Built on MegaETH.


Stack

Layer
Technology

Smart contracts

Solidity 0.8.20, Hardhat, MegaETH Chain ID 4326

Auth & wallets

Privy (email, social, embedded wallets, smart accounts)

Account abstraction

ERC-4337 (Privy Kernel smart wallets + Pimlico bundler/paymaster)

Session keys

MetaMask Delegation Toolkit pattern (EIP-712 delegations)

Real-time

MegaETH WebSocket (eth_subscribe, eth_sendRawTransactionSync)

Frontend

Next.js 14, Tailwind CSS, wagmi, viem, Supabase

Base token

USDM (0xFAfDdbb3FC7688494971a79cc65DCa3EF82079E7)


Architecture Diagram

┌───────────────────────────────────────────────────────┐
│                    USER                                │
│         (browser — no wallet extension needed)         │
└──────────────────────┬────────────────────────────────┘
                       │ email / Google / Twitter / Discord

┌──────────────────────────────────────────────────────┐
│               PRIVY AUTH LAYER                        │
│  Email OTP · Google · Twitter · Discord · GitHub      │
│                                                       │
│  Auto-creates:  Embedded Wallet (EOA)                 │
│  Wraps in:      Kernel Smart Account (ERC-4337)        │
└──────────────────────┬───────────────────────────────┘

       ┌───────────────┼───────────────┐
       │               │               │
       ▼               ▼               ▼
 READ PATH       WRITE PATH      SESSION PATH
(multicall)     (gasless tx)    (no popup/trade)
       │               │               │
       ▼               ▼               ▼
 HTTP+Multicall3  UserOperation   Session Key Tx
 2s TTL cache      via Bundler    (pre-delegated)
       │               │               │
       └───────┬───────┘───────────────┘

      ┌──────────────────┐
      │    PAYMASTER     │
      │   (Pimlico)      │
      │  sponsors gas    │
      │  rate-limited    │
      └────────┬─────────┘

      ┌───────────────────────────────────┐
      │     EventlyMarkets.sol          │
      │     MegaETH Chain ID 4326         │
      │                                   │
      │  placeOrder / sellToAMM           │
      │  createMarket / resolveMarket      │
      │  claimRewards / cancelOrder       │
      └──────────────────┬────────────────┘
                         │ events

      ┌────────────────────────────────────┐
      │   MegaETH WebSocket               │
      │   wss://mainnet.megaeth.com/ws     │
      │                                   │
      │   mini-blocks ~10 ms              │
      │   eth_sendRawTransactionSync      │
      │   watchContractEvent              │
      └──────────────────┬────────────────┘


      ┌────────────────────────────────────┐
      │   FRONTEND REALTIME ENGINE        │
      │   Instant confirmation (~10 ms)   │
      │   Live odds · Live order book     │
      │   No page refresh                 │
      └────────────────────────────────────┘

Gas Sponsorship Flow

Sponsored functions: placeOrder, sellToAMM, createMarket, resolveMarket, claimRewards, approve (USDM)


Session Key Flow


Security Controls

Control
Value

Paymaster contract whitelist

EventlyMarkets + USDM only

Sponsored selectors

6 core functions only

Rate limit

20 user ops / min / wallet

Spend cap

1 ETH equivalent / hour / wallet

Spam threshold

15 ops in 10 s → blocked

RPC failover

2 endpoints, health-checked


Smart Contract Audit Result

EventlyMarkets.solno changes required for ERC-4337 compatibility.

  • No tx.origin

  • No extcodesize / EOA checks

  • msg.sender used generically

  • Compatible with smart account callers

Last updated

Was this helpful?