Skip to main content

IGMXYieldSource

Git Source

Defines the functions specific to the GMX yield source contract

Functions

setFEYGMXProductInfo

function setFEYGMXProductInfo(address _productAddress, DataTypes.FEYGMXProductInfo memory _productInfo) external;

supplyTokens

Supplies liquidity to the GLP index (Buying GLP)

function supplyTokens(uint256 amountAIn, uint256 amountBIn)
external
returns (uint256 _amountAInWei, uint256 _amountBInWei);

Parameters

NameTypeDescription
amountAInuint256The amount of token A to be supplied.
amountBInuint256The amount of token B to be supplied.

Returns

NameTypeDescription
_amountAInWeiuint256The amount of token A actually supplied to GLP
_amountBInWeiuint256The amount of token B actually supplied to GLP

redeemTokens

Redeems tokens from the GLP index. (Selling GLP)

The redeemed tokens will be directly sent to the product contract triggering the call

function redeemTokens(uint256 _expectedTokenAAmount) external returns (uint256, uint256);

Parameters

NameTypeDescription
_expectedTokenAAmountuint256The amount of token A expected to be redeemed

Returns

NameTypeDescription
<none>uint256The amount of token A received from the GLP
<none>uint256The amount of token B received from the GLP

recompoundRewards

Re-compounds rewards

function recompoundRewards() external;

getFEYGMXProductInfo

function getFEYGMXProductInfo(address _productAddress) external view returns (DataTypes.FEYGMXProductInfo memory);

Events

TokensSupplied

Emitted whenever the tokens are supplied (Buying GLP)

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

TokensRedeemed

Emitted whenever the tokens are redeemed from the GLP pool

event TokensRedeemed(uint256 amountARedeemed, uint256 amountBRedeemed);

RewardsRecompounded

Emitted whenever the rewards are harvested and recompounded

event RewardsRecompounded();

RewardsAdded

Emitted when additional rewards are added

event RewardsAdded(address indexed productAddress);

Errors

ZeroAddress

Generic errors If zero address is passed as an arg

error ZeroAddress();

Initialized

Already initialized\

error Initialized();

NoShares

No shares for the product yet

error NoShares(address _product);

ZeroShares

_sharesToTokens returns zero during redeem

error ZeroShares();

AlreadySupplied

Products can supply tokens only once

error AlreadySupplied();

InsufficientRewards

The expected reward amount is more than the actual rewards added

error InsufficientRewards(uint256 _actualRewardAmount, uint256 _expectedRewardAmount);