@@ -3,32 +3,131 @@ pragma solidity 0.6.12;
33pragma experimental ABIEncoderV2;
44
55interface IAaveIncentivesController {
6- struct AssetData {
7- uint128 emissionPerSecond;
8- uint128 lastUpdateTimestamp;
9- uint256 index;
10- }
6+ event RewardsAccrued (address indexed user , uint256 amount );
117
12- function REWARD_TOKEN () external view returns ( address rewardToken );
8+ event RewardsClaimed ( address indexed user , address indexed to , uint256 amount );
139
14- function PRECISION () external view returns (uint8 );
10+ event RewardsClaimed (
11+ address indexed user ,
12+ address indexed to ,
13+ address indexed claimer ,
14+ uint256 amount
15+ );
1516
16- function DISTRIBUTION_END () external view returns (uint256 );
17+ event ClaimerSet (address indexed user , address indexed claimer );
18+
19+ /*
20+ * @dev Returns the configuration of the distribution for a certain asset
21+ * @param asset The address of the reference asset of the distribution
22+ * @return The asset index, the emission per second and the last updated timestamp
23+ **/
24+ function getAssetData (address asset )
25+ external
26+ view
27+ returns (
28+ uint256 ,
29+ uint256 ,
30+ uint256
31+ );
32+
33+ /**
34+ * @dev Whitelists an address to claim the rewards on behalf of another address
35+ * @param user The address of the user
36+ * @param claimer The address of the claimer
37+ */
38+ function setClaimer (address user , address claimer ) external ;
1739
18- function assets (address underlying ) external view returns (AssetData memory assets );
40+ /**
41+ * @dev Returns the whitelisted claimer for a certain address (0x0 if not set)
42+ * @param user The address of the user
43+ * @return The claimer address
44+ */
45+ function getClaimer (address user ) external view returns (address );
1946
47+ /**
48+ * @dev Configure assets for a certain rewards emission
49+ * @param assets The assets to incentivize
50+ * @param emissionsPerSecond The emission for each asset
51+ */
52+ function configureAssets (address [] calldata assets , uint256 [] calldata emissionsPerSecond )
53+ external ;
54+
55+ /**
56+ * @dev Called by the corresponding asset on any update that affects the rewards distribution
57+ * @param asset The address of the user
58+ * @param userBalance The balance of the user of the asset in the lending pool
59+ * @param totalSupply The total supply of the asset in the lending pool
60+ **/
2061 function handleAction (
21- address user ,
62+ address asset ,
2263 uint256 userBalance ,
2364 uint256 totalSupply
2465 ) external ;
2566
67+ /**
68+ * @dev Returns the total of rewards of an user, already accrued + not yet accrued
69+ * @param user The address of the user
70+ * @return The rewards
71+ **/
2672 function getRewardsBalance (address [] calldata assets , address user )
2773 external
2874 view
2975 returns (uint256 );
3076
31- function getUserUnclaimedRewards (address _user ) external view returns (uint256 );
77+ /**
78+ * @dev Claims reward for an user, on all the assets of the lending pool, accumulating the pending rewards
79+ * @param amount Amount of rewards to claim
80+ * @param to Address that will be receiving the rewards
81+ * @return Rewards claimed
82+ **/
83+ function claimRewards (
84+ address [] calldata assets ,
85+ uint256 amount ,
86+ address to
87+ ) external returns (uint256 );
3288
89+ /**
90+ * @dev Claims reward for an user on behalf, on all the assets of the lending pool, accumulating the pending rewards. The caller must
91+ * be whitelisted via "allowClaimOnBehalf" function by the RewardsAdmin role manager
92+ * @param amount Amount of rewards to claim
93+ * @param user Address to check and claim rewards
94+ * @param to Address that will be receiving the rewards
95+ * @return Rewards claimed
96+ **/
97+ function claimRewardsOnBehalf (
98+ address [] calldata assets ,
99+ uint256 amount ,
100+ address user ,
101+ address to
102+ ) external returns (uint256 );
103+
104+ /**
105+ * @dev returns the unclaimed rewards of the user
106+ * @param user the address of the user
107+ * @return the unclaimed user rewards
108+ */
109+ function getUserUnclaimedRewards (address user ) external view returns (uint256 );
110+
111+ /**
112+ * @dev returns the unclaimed rewards of the user
113+ * @param user the address of the user
114+ * @param asset The asset to incentivize
115+ * @return the user index for the asset
116+ */
33117 function getUserAssetData (address user , address asset ) external view returns (uint256 );
118+
119+ /**
120+ * @dev for backward compatibility with previous implementation of the Incentives controller
121+ */
122+ function REWARD_TOKEN () external view returns (address );
123+
124+ /**
125+ * @dev for backward compatibility with previous implementation of the Incentives controller
126+ */
127+ function PRECISION () external view returns (uint8 );
128+
129+ /**
130+ * @dev for backward compatibility with previous implementation of the Incentives controller
131+ */
132+ function DISTRIBUTION_END () external view returns (uint256 );
34133}
0 commit comments