Skip to main content

IAutoPoolYieldSource

Git Source

Defines the functions specific to the TraderJoe Autopool yield source

Functions

supplyTokens

Supplies liquidity to the LP.

function supplyTokens(uint256 amountAIn, uint256 amountBIn) external payable returns (uint256, uint256);

Parameters

NameTypeDescription
amountAInuint256The amount of tokenA to be supplied (in token decimals)
amountBInuint256The amount of tokenB to be supplied (in token decimals)

Returns

NameTypeDescription
<none>uint256The amount of tokenA actually supplied to LP (in WAD)
<none>uint256The amount of tokenB actually supplied to LP (in WAD)

recompoundRewards

Recompounds rewards

function recompoundRewards() external;

queueForRedemption

Queue for redemption in the AutoPool.

function queueForRedemption() external;

queueForRedemptionSansRecompound

Queue for redemption in the AutoPool without recompounding rewards

To call if there is an issue with recompounding

function queueForRedemptionSansRecompound() external;

redeemTokens

Used to execute queued withdrawals for the latest round from AutoPool

function redeemTokens() external;

setSlippage

Sets the slippage tolerance for swaps

function setSlippage(uint256 _newSlippage) external;

tokenA

Returns the token0 address of the pool

function tokenA() external view returns (IERC20Metadata);

tokenB

Returns the token1 address of the pool

function tokenB() external view returns (IERC20Metadata);

productAPTShare

Returns the autoPoolTokenShares for the given product

function productAPTShare(address) external view returns (uint256);

autoPoolVault

Returns the address of the underlying autoPoolVault

function autoPoolVault() external view returns (IAutoPoolVault);

totalShares

Returns the total shares value

function totalShares() external view returns (uint256);

totalAutoPoolShareTokens

Returns the totalAutoPoolShareTokens in the YieldSource contract

function totalAutoPoolShareTokens() external view returns (uint256);

sharesToTokens

Returns the equivalent tokenAmount for the given amount of shares

This function has the external modifier as it has to be accessed in the {FEYAutoPoolProductLens} contract

function sharesToTokens(uint256 _shares, uint256 _currentTotalShares, uint256 _currentTotalExternalShares)
external
view
returns (uint256 tokenAmount);

Events

TokensSupplied

Emitted whenever the tokens are supplied to a LP

event TokensSupplied(uint256 amountAIn, uint256 amountBIn, uint256 lpReceived);

RedemptionQueued

Emitted whenever the product is queued for redemption

event RedemptionQueued(address indexed productAddress, uint256 roundId);

TokensRedeemed

Emitted when the redemption has been executed by Autopool

event TokensRedeemed(address indexed productAddress, uint256 amountARedeemed, uint256 amountBRedeemed);

MaxIterationsUpdated

Emitted when the maxIterations is updated

event MaxIterationsUpdated(uint256 _maxIterations);

TokensFarmed

Emitted when tokens are farmed

event TokensFarmed(uint256 _aptFarmed);

RewardsRecompounded

Emitted when the rewards are recompounded

event RewardsRecompounded(uint256 _reward1, uint256 _reward2, uint256 _harvestedTokenA, uint256 _harvestedTokenB);

SwapPathUpdated

Emitted when the swap path is updated

event SwapPathUpdated(DataTypes.SwapPathType _swapPath, address[] _path);

SlippageUpdated

Emitted when the slippage tolerance is updated

event SlippageUpdated(uint256 _newSlippage);

Errors

ZeroAddress

If zero address is passed as an arg

error ZeroAddress();

Initialized

Already intialized

error Initialized();

ZeroShares

Product cannot have zero shares (during supply)

error ZeroShares();

AlreadySupplied

Products can supply tokens only once

error AlreadySupplied();

NoShares

No shares for the product yet (during redemption)

error NoShares();

NativeTransferFailed

Cannot transfer native tokens to the receiver

error NativeTransferFailed();

InvalidRoundId

RoundId passed is greater or equal to the current round in AutoPool for redemption

error InvalidRoundId(uint256 currentRoundId, uint256 inputRoundId);

RoundOccupied

Round is already full

error RoundOccupied();

InvalidSwapPathType

Invalid Swap Path Type

error InvalidSwapPathType();