Import TICK_MIN from util and fix lint errors. (#187)

Co-authored-by: prathamesh0 <prathamesh.musale0@gmail.com>
This commit is contained in:
Ashwin Phatak 2021-08-05 18:33:47 +05:30 committed by GitHub
parent df85f961db
commit b6fe8a8c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 11 deletions

View File

@ -11,6 +11,7 @@ import {
deployTokens,
deployUniswapV3Callee,
TESTERC20_ABI,
TICK_MIN,
createPool,
initializePool,
getMinTick,
@ -38,8 +39,6 @@ import {
const NETWORK_RPC_URL = 'http://localhost:8545';
const TICK_MIN = -887272;
describe('uni-info-watcher', () => {
let factory: Contract;
let pool: Contract;
@ -239,7 +238,7 @@ describe('uni-info-watcher', () => {
data = await request(endpoint, queryFactory);
oldFactory = data.factories[0];
data = await request(endpoint, queryToken, { id: token0.address });
oldToken0 = data.token;
@ -311,7 +310,7 @@ describe('uni-info-watcher', () => {
first: 1,
orderBy: 'timestamp',
orderDirection: 'desc',
pool: pool.address,
pool: pool.address
};
data = await request(endpoint, queryMints, variables);
expect(data.mints).to.not.be.empty;

View File

@ -8,6 +8,7 @@ import {
deployTokens,
deployUniswapV3Callee,
TESTERC20_ABI,
TICK_MIN,
getMinTick,
getMaxTick,
approveToken
@ -58,9 +59,6 @@ import {
const NETWORK_RPC_URL = 'http://localhost:8545';
const TICK_MIN = -887272;
const TICK_MAX = 887272;
describe('uni-watcher', () => {
let factory: Contract;
let pool: Contract;

View File

@ -11,10 +11,16 @@ import {
export { abi as TESTERC20_ABI } from '../artifacts/test/contracts/TestERC20.sol/TestERC20.json';
const TICK_MIN = -887272;
const TICK_MAX = 887272;
export const getMinTick = (tickSpacing: number) => Math.ceil(TICK_MIN / tickSpacing) * tickSpacing;
export const getMaxTick = (tickSpacing: number) => Math.floor(TICK_MAX / tickSpacing) * tickSpacing;
export const TICK_MIN = -887272;
export const TICK_MAX = 887272;
export const getMinTick = (tickSpacing: number): number => {
return Math.ceil(TICK_MIN / tickSpacing) * tickSpacing;
};
export const getMaxTick = (tickSpacing: number): number => {
return Math.floor(TICK_MAX / tickSpacing) * tickSpacing;
};
export const deployTokens = async (signer: Signer): Promise<{token0Address: string, token1Address: string}> => {
const Token = new ethers.ContractFactory(TESTERC20_ABI, TESTERC20_BYTECODE, signer);