Open Sanher opened 5 months ago
Linked to dextools-io/backend#451
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
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;
}
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
Discussed in https://github.com/dextools-io/community-requests/discussions/52