Liquidity Direction
Fully on chain execution, with rebalancing of strategies across multiple asset classes
function getDeployedAmountAndRewards(
bytes calldata data
) external onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256) {
(
IERC20 lpToken,
uint256 convexPoolId,
uint256 assetId
) = decodeRewardsParams(data);
uint256 lpAmount;
if (convexPoolId != type(uint256).max) {
ICvxBaseRewardPool rewards = getCvxRewardPool(convexPoolId);
lpAmount = rewards.balanceOf(address(this));
rewards.getReward(address(this), true);
} else {
lpAmount = lpToken.balanceOf(address(this));
}
(uint256 fiatPrice, uint8 fiatDecimals) = IPriceFeedRouterV2(priceFeed)
.getPriceOfAmount(address(lpToken), lpAmount, assetId);
return
IPriceFeedRouterV2(priceFeed).decimalsConverter(
fiatPrice,
fiatDecimals,
18
);
}Last updated