Introduction

FiveFiveSwap is an implementation of a decentralized exchange (DEX) similar to Uniswap V2, but with a twist: it supports trading pairs between ERC1155 and ERC20 tokens. The codebase consists of Factory, Pair, and Router contracts for creating and interacting with token pairs.

Relationship between Factory, Pair, and Router

Understanding the Core Trio

Diving deeper into the FiveFiveSwap architecture, it's essential to understand the dynamic interplay between the Factory, Pair, and Router.

  1. Factory: Picture the Factory as the foundational pillar of FiveFiveSwap. The Factory is responsible for creating new pairs. So, if there's a novel token combination on your mind, the Factory facilitates its inception.

  2. Pair: These are your liquidity pools. Every unique combination of two ERC1155 and ERC20 tokens introduced by the Factory spawns a Pair. Within each Pair, you've got your reserves of the two tokens, and their price is determined based on the ratio between them. These are your battlegrounds where the swapping action happens.

  3. Router: Think of the Router as the sophisticated algorithm ensuring your trades follow the optimal pathway. It is designed to make work with Factory and Pair easier, so if you are looking to integrate protocol - look no further.

Together, these three components constitute the backbone of FiveFiveSwap, each playing a pivotal role in ensuring your trading experience is top-notch.

Last updated