Uniswap / v2-core

🦄 🦄 Core smart contracts of Uniswap V2
https://uniswap.org/docs
GNU General Public License v3.0
2.93k stars 3.15k forks source link

Sorting tokens in fixture does not work #99

Open sz-piotr opened 4 years ago

sz-piotr commented 4 years ago

https://github.com/Uniswap/uniswap-v2-core/blob/4dd59067c76dea4a0e8e4bfdda41877a6b16dedc/test/shared/fixtures.ts#L40

Because ethers returns a string from this method call, .address always results in undefined, thus the order of tokens is never changed.

moodysalem commented 4 years ago

Good catch! I guess token0 and token1 must always be the same for the fixture, so we never had failing tests out of it.

Devilla commented 3 years ago

Good catch! I guess token0 and token1 must always be the same for the fixture, so we never had failing tests out of it.

Sir, how can token0 and token1 be same for pairFixture ?

moodysalem commented 3 years ago

I mean same addresses across test runs (but token0 != token1), since we use the same mnemonic for every test run

Devilla commented 3 years ago

Okay so it'll fail for different pair address and pass for same pair address right?

ghost commented 8 months ago

I think the best fix would be to lowercase the addresses of the token and just compare like how it is done from the factory contract as well.