Hey I'm working on a project forking uniswap v2 for fun practice and noticed this line in the source —
(address token0, address token1) = tokenA < tokenB
? (tokenA, tokenB)
: (tokenB, tokenA);
Obv it orders them in a consistent way, but I'm not really sure what is being evaluated when you run a comparison on two addresses. Any insights?
Feb 19, 2022, 12:15 AM
It's just a numerical comparison of the addresses... Each is 20 bytes and so can be compared as numbers
Feb 19, 2022, 12:58 AM
haha that makes sense, assumed something sneaky was going on instead. Thanks!
Feb 19, 2022, 1:01 AM
np
Feb 19, 2022, 1:16 AM