predeploy-contracts icon indicating copy to clipboard operation
predeploy-contracts copied to clipboard

Implement `getPair()` and `allPairs()` functions

Open gluneau opened this issue 3 years ago • 5 comments

A request to Implement getPair(address tokenA, address tokenB) and allPairs(uint) functions came from the Orion Team

gluneau avatar Jul 19 '22 17:07 gluneau

I think we have the getPair https://github.com/AcalaNetwork/predeploy-contracts/blob/ea5682f8c57355392f11ac328917a184c3bd4c96/contracts/dex/DEX.sol#L35-L39

zjb0807 avatar Jul 20 '22 23:07 zjb0807

https://docs.uniswap.org/protocol/V2/reference/smart-contracts/factory#getpair

gluneau avatar Jul 21 '22 02:07 gluneau

https://docs.uniswap.org/protocol/V2/reference/smart-contracts/factory#allpairs

gluneau avatar Jul 21 '22 02:07 gluneau

Also, I think allPairs() is not possible to do identically to uniswap because we don't have an index (0-n) mapped to pairs enabled

ferrell-code avatar Jul 25 '22 19:07 ferrell-code

We need a precompile to iterate enabled pairs and return them. However, not 100% sure why do we need such method?

xlc avatar Jul 25 '22 23:07 xlc