UniswapV3Broker
UniswapV3Broker
#
Trading contract used to arb uniswapV3 pairs to a desired "true" price. Intended use is to arb UMA perpetual synthetics that trade off peg. This implementation can ber used in conjunction with a DSProxy contract to atomically swap and move a uniswap market.
#
FunctionsswapToPrice(bool tradingAsEOA, address uniswapPool, address uniswapRouter, uint160 sqrtRatioTargetX96, address recipient, uint256 deadline) → uint256 (external)
Swaps an amount of either pool tokens such that the trade results in the uniswap pair's price equaling a desired price.
The desired price is represented as sqrtRatioTargetX96. This is the Price^(1/2) * 96^2. The caller must approve this contract to spend whichever token is intended to be swapped.
#
Parameters:- tradingAsEOA: bool to indicate if the UniswapBroker is being called by a DSProxy or an EOA.
- uniswapPool: address of the pool to uniswap v3 trade against.
- uniswapRouter: address of the uniswap v3 router to route the trade.
- sqrtRatioTargetX96: target, encoded price.
- recipient: address that the output tokens should be sent to.
- deadline: to limit when the trade can execute. If the tx is mined after this timestamp then revert.