Skip to main content

TraderJoeLPAdapter

Git Source

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

NameTypeDescription
_amountInuint256Amount in
_minimumAmountOutuint256Minimum amount expected
_pathaddress[]The swap path
_receiveraddressAddress of the receiver

Returns

NameTypeDescription
_amtTokensReceiveduint256Tokens 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

NameTypeDescription
_quoteILBQuoter.QuoteThe ILBQuoter.Quote struct
_amountInMaxuint256Amount in max
_amountOutuint256Amount out
_receiveraddressAddress of the receiver