TraderJoeLPAdapter
Author: Struct Finance
Implements the logic for interacting with the Liquidity pools of TraderJoe
State Variables
slippage
The slippage amount
uint256 public slippage;
trancheTokenSr
Address of the Senior tranche token
IERC20Metadata public trancheTokenSr;
trancheTokenJr
Address of the Junior tranche token
IERC20Metadata public trancheTokenJr;
joeRouter
Address of the JoeRouter contract
IJoeRouter public immutable joeRouter = IJoeRouter(0x60aE616a2155Ee3d9A68541Ba4544862310933d4);
lbRouter
Address of the LiquidityBook router contract
ILBRouter public immutable lbRouter = ILBRouter(0xb4315e873dBcf96Ffd0acd8EA43f689D8c20fB30);
lbQuoter
Address of the LiquidityBook quoter contract
ILBQuoter public immutable lbQuoter = ILBQuoter(0x64b57F4249aA99a812212cee7DAEFEDC40B203cD);
Functions
_swapExact
Used to swap from exact tokens to tokens
function _swapExact(uint256 _amountIn, uint256 _minimumAmountOut, address[] memory _path, address _receiver)
internal
returns (uint256 _amtTokensReceived);
Parameters
Name | Type | Description |
---|---|---|
_amountIn | uint256 | Amount in |
_minimumAmountOut | uint256 | Minimum amount expected |
_path | address[] | The swap path |
_receiver | address | Address of the receiver |
Returns
Name | Type | Description |
---|---|---|
_amtTokensReceived | uint256 | Tokens received after swap |
_swapToExact
Used to swap tokens to exact tokens
function _swapToExact(ILBQuoter.Quote memory _quote, uint256 _amountInMax, uint256 _amountOut, address _receiver)
internal;
Parameters
Name | Type | Description |
---|---|---|
_quote | ILBQuoter.Quote | The ILBQuoter.Quote struct |
_amountInMax | uint256 | Amount in max |
_amountOut | uint256 | Amount out |
_receiver | address | Address of the receiver |