Skip to content

Commit 1e7e80f

Browse files
committed
test: check on incentive controller
1 parent 5bc924f commit 1e7e80f

1 file changed

Lines changed: 35 additions & 5 deletions

File tree

tests/utils/HorizonConfigAssertionHelper.sol

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ import {IDefaultInterestRateStrategyV2} from 'aave-v3-origin/contracts/interface
1515
import {DataTypes} from 'aave-v3-origin/contracts/protocol/libraries/types/DataTypes.sol';
1616
import {ReserveConfiguration} from 'aave-v3-origin/contracts/protocol/libraries/configuration/ReserveConfiguration.sol';
1717
import {EModeConfiguration} from 'aave-v3-origin/contracts/protocol/libraries/configuration/EModeConfiguration.sol';
18+
import {IncentivizedERC20} from 'aave-helpers/lib/aave-address-book/lib/aave-v3-origin/src/contracts/protocol/tokenization/base/IncentivizedERC20.sol';
1819
import {ReserveConfig} from 'aave-helpers/src/ProtocolV3TestBase.sol';
1920
import {IRwaOracleParameterRegistry} from 'src/interfaces/IRwaOracleParameterRegistry.sol';
2021
import {AaveV3EthereumHorizonCustom} from 'src/utils/AaveV3EthereumHorizonCustom.sol';
21-
import {AaveV3EthereumHorizonAssets} from 'aave-address-book-latest/AaveV3EthereumHorizon.sol';
22+
import {AaveV3EthereumHorizon, AaveV3EthereumHorizonAssets} from 'aave-address-book-latest/AaveV3EthereumHorizon.sol';
2223
import {Errors} from 'src/dependencies/Errors.sol';
2324

2425
/**
@@ -136,6 +137,12 @@ abstract contract HorizonConfigAssertionHelper is Test {
136137
} else {
137138
assertEq(impl, AaveV3EthereumHorizonCustom.DEFAULT_A_TOKEN_IMPL, 'aTokenImpl');
138139
}
140+
141+
assertEq(
142+
address(IncentivizedERC20(aToken).getIncentivesController()),
143+
AaveV3EthereumHorizon.DEFAULT_INCENTIVES_CONTROLLER,
144+
'aToken incentivesController'
145+
);
139146
}
140147

141148
function _assertVariableDebtToken(IPool pool, ExpectedAssetConfig memory expected) internal view {
@@ -157,6 +164,12 @@ abstract contract HorizonConfigAssertionHelper is Test {
157164
AaveV3EthereumHorizonCustom.DEFAULT_VARIABLE_DEBT_TOKEN_IMPL,
158165
'variableDebtTokenImpl'
159166
);
167+
168+
assertEq(
169+
address(IncentivizedERC20(variableDebtToken).getIncentivesController()),
170+
AaveV3EthereumHorizon.DEFAULT_INCENTIVES_CONTROLLER,
171+
'variableDebtToken incentivesController'
172+
);
160173
}
161174

162175
function _assertPriceFeed(IPool pool, ExpectedAssetConfig memory expected) internal view {
@@ -215,12 +228,12 @@ abstract contract HorizonConfigAssertionHelper is Test {
215228
IERC20(aToken).approve(makeAddr('tmpUser'), 0);
216229
}
217230

218-
function _assertRwaATokenTransferReverts(IPool pool, address underlying) internal {
231+
function _assertRwaATokenTransferReverts(IPool pool, address underlying) internal virtual {
219232
address aToken = pool.getReserveAToken(underlying);
220-
deal(aToken, makeAddr('tmpUser'), 1e18);
221-
// rwa aTokens do not support aToken transfers
233+
// rwa aTokens do not support transfers
234+
vm.prank(makeAddr('rwaTransferSender'));
222235
vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
223-
IERC20(aToken).transfer(makeAddr('tmpUser2'), 1);
236+
IERC20(aToken).transfer(makeAddr('nonWhitelistedUser'), 0);
224237
}
225238

226239
// ─── eMode config assertions ──────────────────────────────────────
@@ -410,6 +423,23 @@ abstract contract HorizonConfigAssertionHelper is Test {
410423
vm.expectRevert(bytes(Errors.OPERATION_NOT_SUPPORTED));
411424
IERC20(configs[i].aToken).approve(address(1), 0);
412425
}
426+
427+
// verify incentives controller on aToken
428+
assertEq(
429+
address(IncentivizedERC20(configs[i].aToken).getIncentivesController()),
430+
AaveV3EthereumHorizon.DEFAULT_INCENTIVES_CONTROLLER,
431+
string.concat('VALIDATION: unexpected aToken incentivesController for ', configs[i].symbol)
432+
);
433+
434+
// verify incentives controller on variable debt token
435+
assertEq(
436+
address(IncentivizedERC20(configs[i].variableDebtToken).getIncentivesController()),
437+
AaveV3EthereumHorizon.DEFAULT_INCENTIVES_CONTROLLER,
438+
string.concat(
439+
'VALIDATION: unexpected variableDebtToken incentivesController for ',
440+
configs[i].symbol
441+
)
442+
);
413443
}
414444
}
415445

0 commit comments

Comments
 (0)