Skip to content
This repository was archived by the owner on Oct 21, 2025. It is now read-only.

Commit d24f24c

Browse files
committed
Merge branch 'master' of github.com:aave/aave-v3-periphery
2 parents 0916252 + 6c3b1fd commit d24f24c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1438
-4237
lines changed

.solcover.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
'./misc/UiIncentiveDataProvider.sol',
77
'./misc/UiPoolDataProvider.sol',
88
'./misc/WalletBalanceProvider.sol',
9-
'./incentives-v2/interfaces/',
9+
'./rewards/interfaces/',
1010
'./misc/interfaces/',
1111
],
1212
onCompileComplete: function () {

contracts/misc/UiIncentiveDataProviderV3.sol

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity 0.8.10;
33

44
import {IPoolAddressesProvider} from '@aave/core-v3/contracts/interfaces/IPoolAddressesProvider.sol';
5-
import {IAaveIncentivesControllerV2} from '../incentives-v2/interfaces/IAaveIncentivesControllerV2.sol';
5+
import {IRewardsController} from '../rewards/interfaces/IRewardsController.sol';
66
import {IUiIncentiveDataProviderV3} from './interfaces/IUiIncentiveDataProviderV3.sol';
77
import {IPool} from '@aave/core-v3/contracts/interfaces/IPool.sol';
88
import {IncentivizedERC20} from '@aave/core-v3/contracts/protocol/tokenization/IncentivizedERC20.sol';
@@ -52,7 +52,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
5252

5353
// Get aTokens rewards information
5454
// TODO: check that this is deployed correctly on contract and remove casting
55-
IAaveIncentivesControllerV2 aTokenIncentiveController = IAaveIncentivesControllerV2(
55+
IRewardsController aTokenIncentiveController = IRewardsController(
5656
address(IncentivizedERC20(baseData.aTokenAddress).getIncentivesController())
5757
);
5858
RewardInfo[] memory aRewardsInformation;
@@ -76,7 +76,9 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
7676
rewardInformation.rewardTokenAddress
7777
);
7878

79-
rewardInformation.precision = aTokenIncentiveController.getAssetDecimals(baseData.aTokenAddress);
79+
rewardInformation.precision = aTokenIncentiveController.getAssetDecimals(
80+
baseData.aTokenAddress
81+
);
8082
rewardInformation.rewardTokenDecimals = IERC20Detailed(
8183
rewardInformation.rewardTokenAddress
8284
).decimals();
@@ -105,7 +107,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
105107
);
106108

107109
// Get vTokens rewards information
108-
IAaveIncentivesControllerV2 vTokenIncentiveController = IAaveIncentivesControllerV2(
110+
IRewardsController vTokenIncentiveController = IRewardsController(
109111
address(IncentivizedERC20(baseData.variableDebtTokenAddress).getIncentivesController())
110112
);
111113
address[] memory vTokenRewardAddresses = vTokenIncentiveController.getRewardsByAsset(
@@ -129,7 +131,9 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
129131
rewardInformation.rewardTokenAddress
130132
);
131133

132-
rewardInformation.precision = vTokenIncentiveController.getAssetDecimals(baseData.variableDebtTokenAddress);
134+
rewardInformation.precision = vTokenIncentiveController.getAssetDecimals(
135+
baseData.variableDebtTokenAddress
136+
);
133137
rewardInformation.rewardTokenDecimals = IERC20Detailed(
134138
rewardInformation.rewardTokenAddress
135139
).decimals();
@@ -158,7 +162,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
158162
);
159163

160164
// Get sTokens rewards information
161-
IAaveIncentivesControllerV2 sTokenIncentiveController = IAaveIncentivesControllerV2(
165+
IRewardsController sTokenIncentiveController = IRewardsController(
162166
address(IncentivizedERC20(baseData.stableDebtTokenAddress).getIncentivesController())
163167
);
164168
address[] memory sTokenRewardAddresses = sTokenIncentiveController.getRewardsByAsset(
@@ -182,7 +186,9 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
182186
rewardInformation.rewardTokenAddress
183187
);
184188

185-
rewardInformation.precision = sTokenIncentiveController.getAssetDecimals(baseData.stableDebtTokenAddress);
189+
rewardInformation.precision = sTokenIncentiveController.getAssetDecimals(
190+
baseData.stableDebtTokenAddress
191+
);
186192
rewardInformation.rewardTokenDecimals = IERC20Detailed(
187193
rewardInformation.rewardTokenAddress
188194
).decimals();
@@ -241,7 +247,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
241247
// user reserve data
242248
userReservesIncentivesData[i].underlyingAsset = reserves[i];
243249

244-
IAaveIncentivesControllerV2 aTokenIncentiveController = IAaveIncentivesControllerV2(
250+
IRewardsController aTokenIncentiveController = IRewardsController(
245251
address(IncentivizedERC20(baseData.aTokenAddress).getIncentivesController())
246252
);
247253
if (address(aTokenIncentiveController) != address(0)) {
@@ -294,7 +300,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
294300
}
295301

296302
// variable debt token
297-
IAaveIncentivesControllerV2 vTokenIncentiveController = IAaveIncentivesControllerV2(
303+
IRewardsController vTokenIncentiveController = IRewardsController(
298304
address(IncentivizedERC20(baseData.variableDebtTokenAddress).getIncentivesController())
299305
);
300306
if (address(vTokenIncentiveController) != address(0)) {
@@ -347,7 +353,7 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
347353
}
348354

349355
// stable debt toekn
350-
IAaveIncentivesControllerV2 sTokenIncentiveController = IAaveIncentivesControllerV2(
356+
IRewardsController sTokenIncentiveController = IRewardsController(
351357
address(IncentivizedERC20(baseData.stableDebtTokenAddress).getIncentivesController())
352358
);
353359
if (address(sTokenIncentiveController) != address(0)) {
@@ -402,4 +408,4 @@ contract UiIncentiveDataProviderV3 is IUiIncentiveDataProviderV3 {
402408

403409
return (userReservesIncentivesData);
404410
}
405-
}
411+
}

contracts/mocks/ATokenMock.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// SPDX-License-Identifier: agpl-3.0
22
pragma solidity 0.8.10;
33

4-
import {IAaveIncentivesControllerV2} from '../incentives-v2/interfaces/IAaveIncentivesControllerV2.sol';
4+
import {IRewardsController} from '../rewards/interfaces/IRewardsController.sol';
55

66
contract ATokenMock {
7-
IAaveIncentivesControllerV2 public _aic;
7+
IRewardsController public _aic;
88
uint256 internal _userBalance;
99
uint256 internal _totalSupply;
1010
uint256 internal immutable _decimals;
@@ -17,7 +17,7 @@ contract ATokenMock {
1717
event AssetIndexUpdated(address indexed asset, uint256 index);
1818
event UserIndexUpdated(address indexed user, address indexed asset, uint256 index);
1919

20-
constructor(IAaveIncentivesControllerV2 aic, uint256 decimals) {
20+
constructor(IRewardsController aic, uint256 decimals) {
2121
_aic = aic;
2222
_decimals = decimals;
2323
}

contracts/mocks/MockBadTransferStrategy.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
pragma solidity 0.8.10;
22

3-
import {ITransferStrategyBase} from '../incentives-v2/interfaces/ITransferStrategyBase.sol';
4-
import {TransferStrategyBase} from '../incentives-v2/transfer-strategies/TransferStrategyBase.sol';
3+
import {ITransferStrategyBase} from '../rewards/interfaces/ITransferStrategyBase.sol';
4+
import {TransferStrategyBase} from '../rewards/transfer-strategies/TransferStrategyBase.sol';
55
import {GPv2SafeERC20} from '@aave/core-v3/contracts/dependencies/gnosis/contracts/GPv2SafeERC20.sol';
66
import {IERC20} from '@aave/core-v3/contracts/dependencies/openzeppelin/contracts/IERC20.sol';
77

contracts/incentives-v2/IncentivesControllerV2.sol renamed to contracts/rewards/RewardsController.sol

Lines changed: 24 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,18 @@ pragma solidity 0.8.10;
22

33
import {VersionedInitializable} from '@aave/core-v3/contracts/protocol/libraries/aave-upgradeability/VersionedInitializable.sol';
44
import {IScaledBalanceToken} from '@aave/core-v3/contracts/interfaces/IScaledBalanceToken.sol';
5-
import {DistributionManagerV2} from './DistributionManagerV2.sol';
6-
import {IAaveIncentivesControllerV2} from './interfaces/IAaveIncentivesControllerV2.sol';
5+
import {RewardsDistributor} from './RewardsDistributor.sol';
6+
import {IRewardsController} from './interfaces/IRewardsController.sol';
77
import {ITransferStrategyBase} from './interfaces/ITransferStrategyBase.sol';
8-
import {DistributionTypesV2} from './libraries/DistributionTypesV2.sol';
8+
import {RewardsDistributorTypes} from './libraries/RewardsDistributorTypes.sol';
99
import {IEACAggregatorProxy} from '../misc/interfaces/IEACAggregatorProxy.sol';
1010

1111
/**
12-
* @title IncentivesControllerV2
12+
* @title RewardsController
1313
* @notice Abstract contract template to build Distributors contracts for ERC20 rewards to protocol participants
1414
* @author Aave
1515
**/
16-
contract IncentivesControllerV2 is
17-
DistributionManagerV2,
18-
VersionedInitializable,
19-
IAaveIncentivesControllerV2
20-
{
16+
contract RewardsController is RewardsDistributor, VersionedInitializable, IRewardsController {
2117
uint256 public constant REVISION = 1;
2218

2319
// This mapping allows whitelisted addresses to claim on behalf of others
@@ -41,14 +37,14 @@ contract IncentivesControllerV2 is
4137
_;
4238
}
4339

44-
constructor(address emissionManager) DistributionManagerV2(emissionManager) {}
40+
constructor(address emissionManager) RewardsDistributor(emissionManager) {}
4541

4642
/**
47-
* @dev Empty initialize for IncentivesControllerV2
43+
* @dev Empty initialize for RewardsController
4844
**/
4945
function initialize() external initializer {}
5046

51-
/// @inheritdoc IAaveIncentivesControllerV2
47+
/// @inheritdoc IRewardsController
5248
function getClaimer(address user) external view override returns (address) {
5349
return _authorizedClaimers[user];
5450
}
@@ -61,18 +57,18 @@ contract IncentivesControllerV2 is
6157
return REVISION;
6258
}
6359

64-
/// @inheritdoc IAaveIncentivesControllerV2
60+
/// @inheritdoc IRewardsController
6561
function getRewardOracle(address reward) external view override returns (address) {
6662
return address(_rewardOracle[reward]);
6763
}
6864

69-
/// @inheritdoc IAaveIncentivesControllerV2
65+
/// @inheritdoc IRewardsController
7066
function getTransferStrategy(address reward) external view override returns (address) {
7167
return address(_transferStrategy[reward]);
7268
}
7369

74-
/// @inheritdoc IAaveIncentivesControllerV2
75-
function configureAssets(DistributionTypesV2.RewardsConfigInput[] memory config)
70+
/// @inheritdoc IRewardsController
71+
function configureAssets(RewardsDistributorTypes.RewardsConfigInput[] memory config)
7672
external
7773
override
7874
onlyEmissionManager
@@ -90,23 +86,23 @@ contract IncentivesControllerV2 is
9086
_configureAssets(config);
9187
}
9288

93-
/// @inheritdoc IAaveIncentivesControllerV2
89+
/// @inheritdoc IRewardsController
9490
function setTransferStrategy(address reward, ITransferStrategyBase transferStrategy)
9591
external
9692
onlyEmissionManager
9793
{
9894
_installTransferStrategy(reward, transferStrategy);
9995
}
10096

101-
/// @inheritdoc IAaveIncentivesControllerV2
97+
/// @inheritdoc IRewardsController
10298
function setRewardOracle(address reward, IEACAggregatorProxy rewardOracle)
10399
external
104100
onlyEmissionManager
105101
{
106102
_setRewardOracle(reward, rewardOracle);
107103
}
108104

109-
/// @inheritdoc IAaveIncentivesControllerV2
105+
/// @inheritdoc IRewardsController
110106
function handleAction(
111107
address user,
112108
uint256 totalSupply,
@@ -115,7 +111,7 @@ contract IncentivesControllerV2 is
115111
_updateUserRewardsPerAssetInternal(msg.sender, user, userBalance, totalSupply);
116112
}
117113

118-
/// @inheritdoc IAaveIncentivesControllerV2
114+
/// @inheritdoc IRewardsController
119115
function claimRewards(
120116
address[] calldata assets,
121117
uint256 amount,
@@ -126,7 +122,7 @@ contract IncentivesControllerV2 is
126122
return _claimRewards(assets, amount, msg.sender, msg.sender, to, reward);
127123
}
128124

129-
/// @inheritdoc IAaveIncentivesControllerV2
125+
/// @inheritdoc IRewardsController
130126
function claimRewardsOnBehalf(
131127
address[] calldata assets,
132128
uint256 amount,
@@ -139,7 +135,7 @@ contract IncentivesControllerV2 is
139135
return _claimRewards(assets, amount, msg.sender, user, to, reward);
140136
}
141137

142-
/// @inheritdoc IAaveIncentivesControllerV2
138+
/// @inheritdoc IRewardsController
143139
function claimRewardsToSelf(
144140
address[] calldata assets,
145141
uint256 amount,
@@ -148,7 +144,7 @@ contract IncentivesControllerV2 is
148144
return _claimRewards(assets, amount, msg.sender, msg.sender, msg.sender, reward);
149145
}
150146

151-
/// @inheritdoc IAaveIncentivesControllerV2
147+
/// @inheritdoc IRewardsController
152148
function claimAllRewards(address[] calldata assets, address to)
153149
external
154150
override
@@ -158,7 +154,7 @@ contract IncentivesControllerV2 is
158154
return _claimAllRewards(assets, msg.sender, msg.sender, to);
159155
}
160156

161-
/// @inheritdoc IAaveIncentivesControllerV2
157+
/// @inheritdoc IRewardsController
162158
function claimAllRewardsOnBehalf(
163159
address[] calldata assets,
164160
address user,
@@ -174,7 +170,7 @@ contract IncentivesControllerV2 is
174170
return _claimAllRewards(assets, msg.sender, user, to);
175171
}
176172

177-
/// @inheritdoc IAaveIncentivesControllerV2
173+
/// @inheritdoc IRewardsController
178174
function claimAllRewardsToSelf(address[] calldata assets)
179175
external
180176
override
@@ -183,7 +179,7 @@ contract IncentivesControllerV2 is
183179
return _claimAllRewards(assets, msg.sender, msg.sender, msg.sender);
184180
}
185181

186-
/// @inheritdoc IAaveIncentivesControllerV2
182+
/// @inheritdoc IRewardsController
187183
function setClaimer(address user, address caller) external override onlyEmissionManager {
188184
_authorizedClaimers[user] = caller;
189185
emit ClaimerSet(user, caller);
@@ -199,9 +195,9 @@ contract IncentivesControllerV2 is
199195
internal
200196
view
201197
override
202-
returns (DistributionTypesV2.UserAssetStatsInput[] memory userState)
198+
returns (RewardsDistributorTypes.UserAssetStatsInput[] memory userState)
203199
{
204-
userState = new DistributionTypesV2.UserAssetStatsInput[](assets.length);
200+
userState = new RewardsDistributorTypes.UserAssetStatsInput[](assets.length);
205201
for (uint256 i = 0; i < assets.length; i++) {
206202
userState[i].underlyingAsset = assets[i];
207203
(userState[i].userBalance, userState[i].totalSupply) = IScaledBalanceToken(assets[i])

0 commit comments

Comments
 (0)