Documentation
Technical Deep Dive

Protocol Architecture

Understanding the components that power Bayex's gasless, high-frequency trading experience.

Smart Accounts (Safe)

User wallets on Bayex are not EOAs (Externally Owned Accounts). Instead, we deploy a Safe (formerly Gnosis Safe) for every user. This Smart Account acts as a proxy, allowing for:

  • Gasless Transactions (Sponsored)
  • Batched Operations (Wrap + Swap)
  • Session Keys (Future Scope)

The Relayer

Bayex utilizes a centralized (but strictly non-custodial) relayer service to submit transactions on behalf of users.

User Signature (EIP-712) -> Relayer API -> Blockchain -> Execution

This ensures users never need MATIC (Polygon gas token) to interact with the protocol.

CT Wrapper Contract

The core innovation. Polymarket uses the Conditional Tokens Framework (ERC-1155). To make these compatible with Uniswap V4 (which works best with ERC-20s), we use a Wrapper.

Wrap

User sends ERC-1155 -> Wrapper locks it -> Mints ERC-20 (CTERC20)

Unwrap

User burns ERC-20 -> Wrapper unlocks ERC-1155 -> Sends to User

Uniswap V4 Pool Manager

We use the singleton PoolManager contract to host all our prediction market pools.

  • Hooks: (Currently minimal) Future capability to add dynamic fees or KYC logic.
  • Flash Accounting: efficient multi-hop swaps or complex portfolio rebalancing in a single transaction.