feat: Updated to new interface of Incentives Controller

This commit is contained in:
David Racero 2021-04-21 18:00:00 +02:00
parent 8000d838a3
commit 2a19131b7a
3 changed files with 36 additions and 33 deletions

View File

@ -3,19 +3,9 @@ pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
interface IAaveIncentivesController {
struct AssetData {
uint104 emissionPerSecond;
uint104 index;
uint40 lastUpdateTimestamp;
}
event RewardsAccrued(address indexed user, uint256 amount);
event RewardsClaimed(
address indexed user,
address indexed to,
uint256 amount
);
event RewardsClaimed(address indexed user, address indexed to, uint256 amount);
event RewardsClaimed(
address indexed user,
@ -26,7 +16,19 @@ interface IAaveIncentivesController {
event ClaimerSet(address indexed user, address indexed claimer);
function assets(address underlying) external view returns (AssetData memory assets);
/*
* @dev Returns the configuration of the distribution for a certain asset
* @param asset The address of the reference asset of the distribution
* @return The asset index, the emission per second and the last updated timestamp
**/
function getAssetData(address asset)
external
view
returns (
uint256,
uint256,
uint256
);
/**
* @dev Whitelists an address to claim the rewards on behalf of another address
@ -50,7 +52,6 @@ interface IAaveIncentivesController {
function configureAssets(address[] calldata assets, uint256[] calldata emissionsPerSecond)
external;
/**
* @dev Called by the corresponding asset on any update that affects the rewards distribution
* @param asset The address of the user
@ -116,12 +117,12 @@ interface IAaveIncentivesController {
function getUserAssetData(address user, address asset) external view returns (uint256);
/**
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
function REWARD_TOKEN() external view returns (address);
/**
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
* @dev for backward compatibility with previous implementation of the Incentives controller
*/
function PRECISION() external view returns (uint8);
}

View File

@ -131,21 +131,23 @@ contract UiPoolDataProvider is IUiPoolDataProvider {
);
// incentives
IAaveIncentivesController.AssetData memory tokenIncentivesInfo =
incentivesController.assets(reserveData.aTokenAddress);
reserveData.aEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
reserveData.aIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
reserveData.aTokenIncentivesIndex = tokenIncentivesInfo.index;
(
reserveData.aEmissionPerSecond,
reserveData.aIncentivesLastUpdateTimestamp,
reserveData.aTokenIncentivesIndex
) = incentivesController.getAssetData(reserveData.aTokenAddress);
tokenIncentivesInfo = incentivesController.assets(reserveData.stableDebtTokenAddress);
reserveData.sEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
reserveData.sIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
reserveData.sTokenIncentivesIndex = tokenIncentivesInfo.index;
(
reserveData.sEmissionPerSecond,
reserveData.sIncentivesLastUpdateTimestamp,
reserveData.sTokenIncentivesIndex
) = incentivesController.getAssetData(reserveData.stableDebtTokenAddress);
tokenIncentivesInfo = incentivesController.assets(reserveData.variableDebtTokenAddress);
reserveData.vEmissionPerSecond = tokenIncentivesInfo.emissionPerSecond;
reserveData.vIncentivesLastUpdateTimestamp = tokenIncentivesInfo.lastUpdateTimestamp;
reserveData.vTokenIncentivesIndex = tokenIncentivesInfo.index;
(
reserveData.vEmissionPerSecond,
reserveData.vIncentivesLastUpdateTimestamp,
reserveData.vTokenIncentivesIndex
) = incentivesController.getAssetData(reserveData.variableDebtTokenAddress);
if (user != address(0)) {
// incentives

View File

@ -43,9 +43,9 @@ interface IUiPoolDataProvider {
uint256 stableRateSlope1;
uint256 stableRateSlope2;
// incentives
uint128 aEmissionPerSecond;
uint128 vEmissionPerSecond;
uint128 sEmissionPerSecond;
uint256 aEmissionPerSecond;
uint256 vEmissionPerSecond;
uint256 sEmissionPerSecond;
uint256 aIncentivesLastUpdateTimestamp;
uint256 vIncentivesLastUpdateTimestamp;
uint256 sIncentivesLastUpdateTimestamp;