ERC-6909
Uniswap v4 uses ERC-6909 to further improve gas-efficiency on token claims and redemptions.
ERC-6909 is a minimal and gas-efficient standard for managing multiple ERC-20 tokens from a single contract. It provides a simplified alternative to the more complex ERC-1155 multi-token standard.
ERC-6909 vs ERC-1155
ERC-6909 offers several advantages over ERC-1155:
- Simplified interface: ERC-6909 removes unnecessary safe transfer callbacks and batching constraints presented in ERC-1155.
- Improved transfer delegation: ERC-6909 provides a more efficient system for transfer delegation.
- Gas efficiency: ERC-6909 reduces gas costs for deployment, transfers, and burning operations.
- Reduced code size: Implementing ERC-6909 results in smaller contract sizes compared to ERC-1155.
However, it's worth noting that ERC-6909 does introduce a totalSupply
variable, which leads to an additional disk write on mint and burn operations.
How it works
Instead of choosing to move tokens in/out of the PoolManager
, developers can opt-in and leave the ERC-20 tokens within the PoolManager
. In exchange, the PoolManager
can mint them an ERC-6909 token representing their claim. In subsequent interactions requiring paying tokens, users will not need to transfer ERC-20 tokens into the PoolManager
- users can simply burn some (or all) of their claim tokens they have
Doing real ERC-20 token transfers requires calls to external smart contracts - incurring gas overhead compared to internal accounting. Secondly, these external smart contracts have their own custom logic within their transfer
functions - for example USDC's blocked-address list - which is a further gas overhead. Thus, minting and burning ERC-6909 tokens are more gas-efficient because they don't require external function calls and have a constant-size gas overhead regardless of the underlying ERC-20 token.
This mechanism therefore helps further reduce gas costs. All these gas cost reductions overall make pools much more competitive based on the fees they charge.
Examples
High-frequency traders / MEV bots
These users are often conducting a lot of swaps in relatively short durations of time, while staying within the Uniswap Protocol. These power-users can trade using ERC-6909 tokens for improved gas-efficiency.
Liquidity management
ERC-6909 does not only benefit swappers. For power-users that may be opening and closing liquidity positions frequently, liquidity managers can opt-in and receive their capital as ERC-6909.