Skip to content

Commit

Permalink
Update Uniswap functionality (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
agentMAK authored Jan 6, 2022
1 parent fda22b7 commit f80579c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions index-rebalances/utils/paramDetermination/uniswapV3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ const {
const UNI_V3_QUOTER = "0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6";
const UNI_V3_FACTORY = "0x1F98431c8aD98523631AE4a59f267346ea31F984";

export async function getUniswapV3Quote(deployHelper: DeployHelper, token: Address, targetPriceImpact: BigNumber): Promise<ExchangeQuote> {
export async function getUniswapV3Quote(deployHelper: DeployHelper, token: Address, targetPriceImpact: BigNumber, feeAmount: number = FeeAmount.MEDIUM): Promise<ExchangeQuote> {
const factoryInstance = await deployHelper.external.getUniswapV3FactoryInstance(UNI_V3_FACTORY);
const poolAddress = await factoryInstance.getPool(token, ETH_ADDRESS, FeeAmount.MEDIUM);
const poolAddress = await factoryInstance.getPool(token, ETH_ADDRESS, feeAmount);
if (poolAddress == ADDRESS_ZERO) {
return {
exchange: exchanges.UNISWAP_V3,
Expand Down Expand Up @@ -62,10 +62,10 @@ export async function getUniswapV3Quote(deployHelper: DeployHelper, token: Addre
size: (await quoterInstance.callStatic.quoteExactInputSingle(
ETH_ADDRESS,
token,
FeeAmount.MEDIUM,
feeAmount,
ether(10000),
sqrtPriceLimit
)).toString(),
data: hexZeroPad(hexlify(FeeAmount.MEDIUM), 3),
data: hexZeroPad(hexlify(feeAmount), 3),
} as ExchangeQuote;
}

0 comments on commit f80579c

Please sign in to comment.