dextools-io / community-requests

Send your request to the DexTools team
3 stars 1 forks source link

[FEATURE] Stableswap pairs on pancakeswap not visible #61

Open Sanher opened 5 months ago

Sanher commented 5 months ago

Discussed in https://github.com/dextools-io/community-requests/discussions/52

Originally posted by **Flamingobingo035** February 3, 2024 ### Steps No lps on pancakeswap under their stableswap section are visible in dext. Only v2 and v3 pools. Stableswap has been around for over a year now. Below you can find any stableswap pair to reference. Mcake is the best one to use as an example since all liquidity is in a stableswap pair ($9m) https://pancakeswap.finance/info/pairs?type=stableSwap ### Which device are you using - [ ] Desktop Windows - [ ] Desktop MacOS - [ ] Desktop Linux - [X] Mobile browser - [ ] App ### (if aplicable) In which browsers are you seeing the problem? _No response_ ### (if aplicable) What version of the browser are you using? _No response_ ### (if aplicable) What mobile OS device are you using? None ### (if aplicable) Which mobile devices are you using? _No response_ ### (if aplicable) Which version of the device OS are you running? _No response_ ### In which page do you see the problem? _No response_ ### Additional Info _No response_
Sanher commented 5 months ago

Linked to dextools-io/backend#451

alb2001 commented 2 months ago

StableSwap pool: https://bscscan.com/address/0xb1da7d2c257c5700612bde35c8d7187dc80d79f1 StableSwap factory: https://bscscan.com/address/0xdDFCDAacC836dd5A1AE2D375fFb153cE59DD09ff

Topic 0: 0xb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc98 Swap events are exactly the same as Curve swap native. same topic id 0. same log structure. Example here: Curve: https://etherscan.io/address/0xc89570207c5ba1b0e3cd372172ccaefb173db270#events StableSwap: https://bscscan.com/address/0xb1da7d2c257c5700612bde35c8d7187dc80d79f1#events

alb2001 commented 2 months ago

However... I can't find an event for pair creation. There is a function on PancakeStableSwapTwoPoolDeployer which creates the pool. but doesn't emit an event:

function createSwapPair(
        address _tokenA,
        address _tokenB,
        uint256 _A,
        uint256 _fee,
        uint256 _admin_fee,
        address _admin,
        address _LP
    ) external onlyOwner returns (address) {
        require(_tokenA != address(0) && _tokenB != address(0) && _tokenA != _tokenB, "Illegal token");
        (address t0, address t1) = sortTokens(_tokenA, _tokenB);
        address[N_COINS] memory coins = [t0, t1];
        // create swap contract
        bytes memory bytecode = type(PancakeStableSwapTwoPool).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(t0, t1, msg.sender, block.timestamp, block.chainid));
        address swapContract;
        assembly {
            swapContract := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
        PancakeStableSwapTwoPool(swapContract).initialize(coins, _A, _fee, _admin_fee, _admin, _LP);

        return swapContract;
    }
alb2001 commented 2 months ago

Looks like there are another 2 contracts involved, but its not displayed as the factory of the pool above. These other contracts have emitted an event to create the pair. https://bscscan.com/address/0x1179adfa22dd0e5050c1c00c9f8543a77f75a2c0 https://bscscan.com/address/0x25a55f9f2279a54951133d503490342b50e5cd15

here's the log https://bscscan.com/tx/0x2c3a03e9a69ac9b46cfd600ad6c7e0c5983a65b8f1dc9171d351916b79c9bf91#eventlog

topic0 are not in any of our exchange definitions. 0x4e4b290d6a2867680831ef72cd9296e15a5df4169e3d44b24cd3ce3ecd753327 0x48dc7a1b156fe3e70ed5ed0afcb307661905edf536f15bb5786e327ea1933532