Integrating SteakHut Liquidity
Receipt Token:
Underlying Assets
/// @notice Gets the underlying assets in the vault i.e tokenX and tokenY
/// includes all tokenX and tokenY idle in the strategy and supplied as liquidity
/// @param _shares amount of shares
/// @return totalX amounts of tokenX
/// @return totalY amounts of tokenY
function getUnderlyingAssets(
uint256 _shares
) external view returns (uint256 totalX, uint256 totalY) {
uint256 _totalSupply = totalSupply();
if (_totalSupply == 0) {
return (0, 0);
}
//add currently active tokens supplied as liquidity
(totalX, totalY) = LiquidityAmounts.getAmountsOf(
address(strategy),
strategy.strategyActiveBins(),
address(strategy.lbPair())
);
//add currently unused tokens in the strategy
totalX += strategy.getBalanceX();
totalY += strategy.getBalanceY();
totalX = (totalX * _shares) / _totalSupply;
totalY = (totalY * _shares) / _totalSupply;
}
Questions Regarding Integrations
Last updated