Skip to main content

FEYGMXProduct

Git Source

Inherits: FEYProduct, TraderJoeLPAdapter

Author: Struct Finance

State Variables

BASIS_POINTS_DIVISOR

uint256 public constant BASIS_POINTS_DIVISOR = 10000;

VAULT

IGMXVault public constant VAULT = IGMXVault(0x9ab2De34A33fB459b538c43f251eB825645e8595);

VAULT_PRICE_FEED

IVaultPriceFeed public constant VAULT_PRICE_FEED = IVaultPriceFeed(0x27e99387af40e5CA9CE21418552f15F02C8C57E7);

FAST_PRICE_FEED

IFastPriceFeed public constant FAST_PRICE_FEED = IFastPriceFeed(0xE547CaDbe081749e5b3DC53CB792DfaEA2D02fD2);

yieldSource

The address of the GMXYieldSource contract

IGMXYieldSource public yieldSource;

seniorToNative

Swap paths

address[] internal seniorToNative;

juniorToNative

address[] internal juniorToNative;

Functions

initialize

Initializes the Product based on the given parameters

function initialize(
DataTypes.InitConfigParam calldata _initConfig,
IStructPriceOracle _structPriceOracle,
ISPToken _spToken,
IGAC _globalAccessControl,
IDistributionManager _distributionManager,
address _yieldSource,
address payable _nativeToken
) external override;

Parameters

NameTypeDescription
_initConfigDataTypes.InitConfigParamConfiguration of the tranches and product config
_structPriceOracleIStructPriceOracleThe address of the struct price oracle
_spTokenISPTokenAddress of the Struct SP Token
_globalAccessControlIGACAddress of the StructGAC contract
_distributionManagerIDistributionManagerAddress of the distribution manager contract
_yieldSourceaddressAddress of the YieldSource contract
_nativeTokenaddress payable

invest

Method will deposit the funds into the relevant LP.

function invest() external override nonReentrant gacPausable;

setSlippage

Used to update the slippage

function setSlippage(uint256 _newSlippage) external onlyRole(GOVERNANCE);

Parameters

NameTypeDescription
_newSlippageuint256The new slippage value to be updated

getTokenRate

Returns the rate of the tranche token

function getTokenRate(DataTypes.Tranche _tranche) public view returns (uint256);

Parameters

NameTypeDescription
_trancheDataTypes.TrancheThe tranche id for which the token rate should be fetched.

Returns

NameTypeDescription
<none>uint256uint256 - GMX rate of the given _tranche token against the other tranche token

_getTokenPrice

function _getTokenPrice(address _token) private view returns (bool, uint256);

_depositToLP

Adds liquidity to the AMM pool

function _depositToLP(uint256 _tokensInvestableSr, uint256 _tokensInvestableJr)
private
returns (uint256 _seniorTokensSupplied, uint256 _juniorTokensSupplied);

Parameters

NameTypeDescription
_tokensInvestableSruint256Senior tokens eligible for investment to the pool
_tokensInvestableJruint256Junior tokens eligible for investment to the pool

Returns

NameTypeDescription
_seniorTokensSupplieduint256Senior tranche tokens invested
_juniorTokensSupplieduint256Junior tranche tokens invested

removeFundsFromLP

Method withdraws the product's investments from the LP and charges and sends fees to the Distribution Manager.

function removeFundsFromLP() external override nonReentrant gacPausable;

_chargeFee

Used to transfer fee when the product is matured

function _chargeFee(uint256 _receivedSr, uint256 _receivedJr) private;

Parameters

NameTypeDescription
_receivedSruint256Senior tokens received from pool
_receivedJruint256Junior tokens received from pool