Skip to main content

Position Quoter

info

Steer Position Quoter is in beta, changes may occur.

Description

The Steer Position Quoter provides rebalance calculations for multi-position apps with 99% accuracy. The Uniswap custom quoter works great for single-position apps, but the Steer position quoter is necessary for multiple positions with individual weightings. This algorithm is built for proper liquidity ratios, not for slippage during rebalancing.

How to Install

Node Package Manager

    npm install --save @steerprotocol/uniswap-position-quoter

Yarn

    yarn add @steerprotocol/uniswap-position-quoter

How to Use

import {CustomRouter, Position} from '@steerprotocol/uniswap-position-quoter'
import {utils} from 'ethers'
const QUOTER_ADDRESS = '0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6'
const POOL_ADDRESS = '0x0000000000000000000000000000000000000000'
const TOKEN0_ADDRESS = '0x0000000000000000000000000000000000000000'
const TOKEN1_ADDRESS = '0x0000000000000000000000000000000000000000'
const POOL_FEE = '3000'

const quoterContract = new Contract(
QUOTER_ADDRESS,
new Interface(QuoterV2Artifact.abi)
);

const PositionQuoter = new CustomRouter(quoterContract)

const positions = [
{
lowerTick: 62342,
upperTick: -62342,
weight: 1,
},
{
lowerTick: 32342,
upperTick: -32342,
weight: 3,
},
]

// Returns single swap amount to have proper liquidity for position re-balancing
const swapResult = await PositionQuoter.getSwapAmount(
POOL_ADDRESS,
positions,
utils.parseEther('100'),
utils.parseEther('100'),
TOKEN0_ADDRESS,
TOKEN1_ADDRESS,
POOL_FEE,
0,
)