Created
June 24, 2021 19:54
-
-
Save kassandraoftroy/633a13f8ae747404be4da9a68feb5e32 to your computer and use it in GitHub Desktop.
swapThreshold
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ethers } from "ethers"; | |
const op = async () => { | |
const pool = new ethers.Contract( | |
ADDRESS, | |
["function slot0() external returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked"], | |
PROVIDER | |
); | |
const { sqrtPriceX96 } = await pool.slot0(); | |
const threshold = sqrtPriceX96.add(sqrtPriceX96.div(ethers.BigNumber.from("2"))); | |
console.log(threshold.toString()); | |
} | |
(async () => { | |
await op(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment