Documentation ¶
Index ¶
- Constants
- Variables
- func CalculatePoolAddress(tokenA, tokenB, factoryAddr common.Address, poolInitCodeStr string) (poolAddr common.Address, err error)
- func CalculatePoolAddressV2(token0, token1 string) (pairAddress common.Address, err error)
- func CalculatePoolAddressV3(tokenA, tokenB string, fee *big.Int) (poolAddress common.Address, err error)
- func EncodePath(path []common.Address, fees []int) (encoded []byte, err error)
- func MultiCall(client *ethclient.Client, methodName string, opts *bind.CallOpts, ...) (out []interface{}, err error)
- func SqrtPriceX96ToPrice(sqrtPriceX96 *big.Int, zeroForOne bool) (price decimal.Decimal)
- type Multicall2Call
- type Multicall2Result
Constants ¶
View Source
const ( FactoryAddrV3 = "0x1F98431c8aD98523631AE4a59f267346ea31F984" FactoryAddrV2 = "0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f" )
View Source
const ( MultiCallAddr = "0x5ba1e12693dc8f9c48aad8770482f4739beed696" MultiFragmentAbi = `` /* 1297-byte string literal not displayed */ )
View Source
const ( AddrSize = 20 FeeSize = 3 Offset = AddrSize + FeeSize DataSize = Offset + AddrSize )
Variables ¶
View Source
var (
Address, _ = abi.NewType("address", "", nil)
Uint24, _ = abi.NewType("uint24", "", nil)
PoolInitCodeV3, _ = hex.DecodeString("e34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54")
PoolInitCodeV2, _ = hex.DecodeString("96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f")
)
View Source
var (
X96 = decimal.NewFromInt(2).Pow(decimal.NewFromInt(96))
)
Functions ¶
func CalculatePoolAddress ¶ added in v0.4.0
func CalculatePoolAddress(tokenA, tokenB, factoryAddr common.Address, poolInitCodeStr string) (poolAddr common.Address, err error)
CalculatePoolAddress calculate uniswapV2 like pool address from token and pool address and pool init code
func CalculatePoolAddressV2 ¶
CalculatePoolAddressV2 calculate uniswapV2 pool address offline from pool tokens
func CalculatePoolAddressV3 ¶
func CalculatePoolAddressV3(tokenA, tokenB string, fee *big.Int) (poolAddress common.Address, err error)
CalculatePoolAddressV3 calculate uniswapV3 pool address offline from pool tokens and fee
func EncodePath ¶
EncodePath encode path to bytes
Types ¶
type Multicall2Call ¶
type Multicall2Result ¶
Click to show internal directories.
Click to hide internal directories.