Skip to content

Commit 034aafa

Browse files
committed
test: assertion on price source
1 parent 02bef90 commit 034aafa

2 files changed

Lines changed: 46 additions & 1 deletion

File tree

tests/utils/HorizonConfigAssertionHelper.sol

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,51 @@ abstract contract HorizonConfigAssertionHelper is Test {
323323
for (uint256 i; i < configs.length; i++) {
324324
uint256 price = oracle.getAssetPrice(configs[i].underlying);
325325
assertTrue(price > 0, string.concat('VALIDATION: zero oracle price for ', configs[i].symbol));
326+
address source = oracle.getSourceOfAsset(configs[i].underlying);
327+
assertEq(
328+
AggregatorInterface(source).decimals(),
329+
8,
330+
string.concat('VALIDATION: unexpected oracle decimals for ', configs[i].symbol)
331+
);
332+
address expectedFeed = _expectedPriceFeed(configs[i].underlying);
333+
assertEq(
334+
source,
335+
expectedFeed,
336+
string.concat('VALIDATION: oracle source mismatch for ', configs[i].symbol)
337+
);
338+
}
339+
}
340+
341+
function _expectedPriceFeed(address underlying) internal pure returns (address) {
342+
if (underlying == AaveV3HorizonEthereum.USTB_UNDERLYING) {
343+
return AaveV3HorizonEthereum.USTB_PRICE_FEED_ADAPTER;
344+
}
345+
if (underlying == AaveV3HorizonEthereum.USCC_UNDERLYING) {
346+
return AaveV3HorizonEthereum.USCC_PRICE_FEED_ADAPTER;
347+
}
348+
if (underlying == AaveV3HorizonEthereum.USYC_UNDERLYING) {
349+
return AaveV3HorizonEthereum.USYC_PRICE_FEED;
350+
}
351+
if (underlying == AaveV3HorizonEthereum.JTRSY_UNDERLYING) {
352+
return AaveV3HorizonEthereum.JTRSY_PRICE_FEED_ADAPTER;
353+
}
354+
if (underlying == AaveV3HorizonEthereum.JAAA_UNDERLYING) {
355+
return AaveV3HorizonEthereum.JAAA_PRICE_FEED_ADAPTER;
356+
}
357+
if (underlying == AaveV3HorizonEthereum.VBILL_UNDERLYING) {
358+
return AaveV3HorizonEthereum.VBILL_PRICE_FEED;
359+
}
360+
if (underlying == AaveV3HorizonEthereum.GHO_UNDERLYING) {
361+
return AaveV3HorizonEthereum.GHO_PRICE_FEED;
362+
}
363+
if (underlying == AaveV3HorizonEthereum.USDC_UNDERLYING) {
364+
return AaveV3HorizonEthereum.USDC_PRICE_FEED;
365+
}
366+
if (underlying == AaveV3HorizonEthereum.RLUSD_UNDERLYING) {
367+
return AaveV3HorizonEthereum.RLUSD_PRICE_FEED;
368+
}
369+
if (underlying == AaveV3HorizonEthereum.ACRED_UNDERLYING) {
370+
return AaveV3HorizonEthereum.ACRED_PRICE_FEED;
326371
}
327372
}
328373

tests/utils/ProtocolV3HorizonTestBase.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ abstract contract ProtocolV3HorizonTestBase is
7373

7474
diffReports(beforeString, afterString);
7575

76-
// pool-wide validations (replaces upstream seatbelt which requires PayloadsController)
76+
// pool-wide validations
7777
_runHorizonValidations(pool, configAfter);
7878

7979
configChangePlausibilityTest(configBefore, configAfter);

0 commit comments

Comments
 (0)