FEYGMXProduct
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
Name | Type | Description |
---|---|---|
_initConfig | DataTypes.InitConfigParam | Configuration of the tranches and product config |
_structPriceOracle | IStructPriceOracle | The address of the struct price oracle |
_spToken | ISPToken | Address of the Struct SP Token |
_globalAccessControl | IGAC | Address of the StructGAC contract |
_distributionManager | IDistributionManager | Address of the distribution manager contract |
_yieldSource | address | Address of the YieldSource contract |
_nativeToken | address 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
Name | Type | Description |
---|---|---|
_newSlippage | uint256 | The new slippage value to be updated |
getTokenRate
Returns the rate of the tranche token
function getTokenRate(DataTypes.Tranche _tranche) public view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
_tranche | DataTypes.Tranche | The tranche id for which the token rate should be fetched. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | uint256 - 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
Name | Type | Description |
---|---|---|
_tokensInvestableSr | uint256 | Senior tokens eligible for investment to the pool |
_tokensInvestableJr | uint256 | Junior tokens eligible for investment to the pool |
Returns
Name | Type | Description |
---|---|---|
_seniorTokensSupplied | uint256 | Senior tranche tokens invested |
_juniorTokensSupplied | uint256 | Junior 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
Name | Type | Description |
---|---|---|
_receivedSr | uint256 | Senior tokens received from pool |
_receivedJr | uint256 | Junior tokens received from pool |