func pairAddr() {
factory := "0xca143ce32fe78f1f7019d7d551a6402fc5350c73"
initCode := "00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5"
wbnb := "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
usdt := "0x55d398326f99059fF775485246999027B3197955"
pair := "0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE"
cr := common.HexToAddress(factory)
ihash := common.Hex2Bytes(initCode)
bn_bnb, _ := big.NewInt(0).SetString(wbnb, 0)
bn_usdt, _ := big.NewInt(0).SetString(usdt, 0)
var salt common.Hash
if bn_bnb.Cmp(bn_usdt) >= 0 {
salt = crypto.Keccak256Hash(
common.HexToAddress(usdt).Bytes(),
common.HexToAddress(wbnb).Bytes(),
)
} else {
salt = crypto.Keccak256Hash(
common.HexToAddress(wbnb).Bytes(),
common.HexToAddress(usdt).Bytes(),
)
}
contractAddr := crypto.CreateAddress2(cr, salt, ihash)
fmt.Println(contractAddr, pair)
}