0.1.1 • Published 2 years ago
@scom/scom-uniswap-v3-contract v0.1.1
Contract Addresses
https://docs.uniswap.org/contracts/v3/reference/deployments
Contract | Address |
---|---|
UniswapV3Factory | 0x1F98431c8aD98523631AE4a59f267346ea31F984 |
Multicall2 | 0x5BA1e12693Dc8F9c48aAD8770482f4739bEeD696 |
ProxyAdmin | 0xB753548F6E010e7e680BA186F9Ca1BdAB2E90cf2 |
TickLens | 0xbfd8137f7d1516D3ea5cA83523914859ec47F573 |
Quoter | 0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6 |
SwapRouter | 0xE592427A0AEce92De3Edee1F18E0157C05861564 |
NFTDescriptor | 0x42B24A95702b9986e82d421cC3568932790A48Ec |
NonfungibleTokenPositionDescriptor | 0x91ae842A5Ffd8d12023116943e72A606179294f3 |
NonfungiblePositionManager | 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 |
TransparentUpgradeableProxy | 0xEe6A57eC80ea46401049E92587E52f5Ec1c24785 |
V3Migrator | 0xA5644E29708357803b5A882D272c41cC0dF92B34 |
QuoterV2 | 0x61fFE014bA17989E743c5F6cB21bF9697530B21e |
SwapRouter02 | 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45 |
Permit2 | 0x000000000022d473030f116ddee9f6b43ac78ba3 |
Uniswap's own Deployer
0x6c9fc64a53c1b71fb3f9af64d1ae3a4931a5f4e9
Notes on calling uniswap router swap function:
- Prices are always based on token0 (token with smaller address); independent of in-token / out-token direction.
- sqrtPriceLimitX96 can be set to 0 to trade at the slot0 price
- sqrtPriceLimitX96 should be smaller then the slot0 price when swapping from token0 to token1 or highter then the slot0 price for token1 to token0 swaps.
- ETH input is automatically wrapped.
- To get native ETH output: 1. set router as the recipient in swap paramters, 2. use router.multicall() with router.unwrapWETH9() as the second call.
- For ETH input and router.exactOut(): use router.multicall() with router.refundETH() as the second call to get excess ETH back.
- For multi-hop exactOut, path are reversed (token-out is the first in the list and token-in is the last).
Notes on logarithm
- log1.0001(X) = log(X) / log(1.0001)
- log10(big_X) = log10(x*1eY) = Y + log10(x)