Content
@
0 reply
0 recast
0 reaction
Adam
@adamtj-xyz
one question for a point of clarity on uni pools token 0 <> token 1 these tokens are lexicographically sorted by their addresses. what is the reasoning behind sorting tokens in a pool like that? particularly in terms of the sc design choice there
1 reply
0 recast
0 reaction
Haardik
@haardikkk
simplify and say a pools are identified only by token pair to maintain state, you'll need to have two mappings 1. Token 0 => (Token 1 => PoolState) 2. Token 1 => (Token 0 => PoolState) to avoid this, a deterministic sorting algo is used to keep the state mapping uni-directional
1 reply
0 recast
0 reaction
Haardik
@haardikkk
this is also not new btw and has been done for many versions of uniswap See screenshot from Uniswap v2 codebase:
1 reply
0 recast
0 reaction