feature: added emission end timestamp. Return struct instead, to save on stack space

This commit is contained in:
sendra 2021-04-16 17:48:19 +02:00
parent b0caaee52e
commit 5e5962372e
3 changed files with 24 additions and 3 deletions

View File

@ -13,6 +13,8 @@ interface IAaveIncentivesController {
function PRECISION() external view returns (uint8); function PRECISION() external view returns (uint8);
function DISTRIBUTION_END() external view returns (uint256);
function assets(address underlying) external view returns (AssetData memory assets); function assets(address underlying) external view returns (AssetData memory assets);
function handleAction( function handleAction(

View File

@ -59,7 +59,7 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
AggregatedReserveData[] memory, AggregatedReserveData[] memory,
UserReserveData[] memory, UserReserveData[] memory,
uint256, uint256,
uint256 IncentivesControllerData memory
) )
{ {
ILendingPool lendingPool = ILendingPool(provider.getLendingPool()); ILendingPool lendingPool = ILendingPool(provider.getLendingPool());
@ -194,11 +194,20 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
} }
} }
IncentivesControllerData memory incentivesControllerData;
incentivesControllerData.userUnclaimedRewards = incentivesController.getUserUnclaimedRewards(user);
// incentivesControllerData.rewardToken = incentivesController.REWARD_TOKEN();
// incentivesControllerData.rewardTokenDecimals = IERC20Detailed(incentivesControllerData.rewardToken).decimals();
// incentivesControllerData.rewardTokenSymbol = IERC20Detailed(incentivesControllerData.rewardToken).symbol();
// incentivesControllerData.precision = incentivesController.PRECISION();
incentivesControllerData.emissionEndTimestamp = incentivesController.DISTRIBUTION_END();
return ( return (
reservesData, reservesData,
userReservesData, userReservesData,
oracle.getAssetPrice(MOCK_USD_ADDRESS), oracle.getAssetPrice(MOCK_USD_ADDRESS),
incentivesController.getUserUnclaimedRewards(user) incentivesControllerData
); );
} }
} }

View File

@ -68,6 +68,16 @@ interface IUiPoolDataProvider {
uint256 sTokenincentivesUserIndex; uint256 sTokenincentivesUserIndex;
} }
struct IncentivesControllerData {
uint256 userUnclaimedRewards;
// address rewardToken;
// uint256 rewardTokenDecimals;
// string rewardTokenSymbol;
// uint8 precision;
uint256 emissionEndTimestamp;
}
function getReservesData(ILendingPoolAddressesProvider provider, address user) function getReservesData(ILendingPoolAddressesProvider provider, address user)
external external
view view
@ -75,6 +85,6 @@ interface IUiPoolDataProvider {
AggregatedReserveData[] memory, AggregatedReserveData[] memory,
UserReserveData[] memory, UserReserveData[] memory,
uint256, uint256,
uint256 IncentivesControllerData memory
); );
} }