Wen-Chiao Su
2023/08/31
Factory contracts are a pattern that DEX protocols use to efficiently manage functionality, governance, and extensibility. They automate the deployment of liquidity pools, enabling quick and efficient pool creation. They also provide transparency into a platform’s liquidity by serving as a comprehensive ledger for deployed pools. For developers building in DeFi, understanding factory contracts is key to fully leveraging the capabilities of on-chain liquidity.
At the core of DEXes is the factory contract. These smart contracts allow for easy deployment of liquidity pools. The process is simple: invoke the factory contract with the right parameters to deploy a pool contract.
By doing so, users can freely create a pool for any token pair while the protocol controls the mechanics.
This functionality enables token creators to quickly create pools tailored to their tokens. For DeFi data analysts, factory contracts offer insights into the protocol's deployed pools.
DEX protocols use factories differently. Uniswap and QuickSwap have one factory per protocol version. Curve takes a different approach. For each pool version, Curve has two deployment methods.
This balances security with decentralization.
Curve's Ethereum mainnet deployment has four factory contracts:
Curve deployments on other chains may have different configurations.
To get a full list of Curve pools, we have to aggregate pools found in all four factories and eliminate duplicates¹. This provides comprehensive coverage while eliminating redundancy between Curve's controlled registries and permissionless factories.
Having the list of all pools in Curve paved the way for us to inquire about one account’s LP positions in Curve.
DEX factory contracts enable frictionless liquidity pool creation. Curve’s blended approach, which supports both centralized and decentralized pool creation, addresses conflicting ecosystem needs and enables developers to build faster.
As DeFi continues to grow, it is important to understand foundational design decisions that empower DeFi users and developers.
¹ We aren’t sure why duplicates occur, but they do! Our assumption is that sometimes a permissionless pool is recognized by the core team.
Credmark runs a financial modeling platform powered by reliable on-chain data. We curate and manages DeFi data making it available via API and the Snowflake Marketplace around the globe and across industries.
Our community of quants, developers, and modelers actively build models for the DeFi community by leveraging our data API and tools. Join the growing community and together we will advance the next-generation financial system.
Sign up for our newsletter for the latest product updates, partnerships, and more.