Skip to main content

ExampleSwapToPrice

State Variables

router

IButtonswapRouter public immutable router;

factory

address public immutable factory;

Functions

constructor

constructor(address factory_, IButtonswapRouter router_);

computeProfitMaximizingTrade

function computeProfitMaximizingTrade(
uint256 truePriceTokenA,
uint256 truePriceTokenB,
uint256 reserveA,
uint256 reserveB
) public pure returns (bool aToB, uint256 amountIn);

swapToPrice

function swapToPrice(
address tokenA,
address tokenB,
uint256 truePriceTokenA,
uint256 truePriceTokenB,
uint256 maxSpendTokenA,
uint256 maxSpendTokenB,
address to,
uint256 deadline
) public;