Skip to content

Commit 61294e0

Browse files
committed
fix: test cleanup; print current price
1 parent 2c06eec commit 61294e0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/horizon/OracleDynamicBounds.t.sol

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,32 +344,53 @@ contract OracleDynamicBoundsTest is OracleDynamicBoundsTestBase {
344344
contract OracleDynamicBoundsPostMigrationTest is OracleDynamicBoundsTest {
345345
function setUp() public virtual override {
346346
vm.createSelectFork('mainnet', 23483206);
347+
_initEnvironment();
347348
}
348349

349350
function test_ustb() public virtual override {
351+
address oracleSource = aaveOracle.getSourceOfAsset(AaveV3HorizonEthereum.USTB_ADDRESS);
352+
_printAssetPrice(AaveV3HorizonEthereum.USTB_ADDRESS, oracleSource);
350353
test_aggregator_from_registry(AaveV3HorizonEthereum.USTB_ADDRESS, USTB_NEW_AGGREGATOR);
351354
}
352355

353356
function test_uscc() public virtual override {
357+
address oracleSource = aaveOracle.getSourceOfAsset(AaveV3HorizonEthereum.USCC_ADDRESS);
358+
_printAssetPrice(AaveV3HorizonEthereum.USCC_ADDRESS, oracleSource);
354359
test_aggregator_from_registry(AaveV3HorizonEthereum.USCC_ADDRESS, USCC_NEW_AGGREGATOR);
355360
}
356361

357362
function test_usyc() public virtual override {
363+
address oracleSource = aaveOracle.getSourceOfAsset(AaveV3HorizonEthereum.USYC_ADDRESS);
364+
_printAssetPrice(AaveV3HorizonEthereum.USYC_ADDRESS, oracleSource);
358365
test_aggregator_from_registry(AaveV3HorizonEthereum.USYC_ADDRESS, USYC_NEW_AGGREGATOR);
359366
}
360367

361368
function test_jtrsy() public virtual override {
369+
address oracleSource = aaveOracle.getSourceOfAsset(AaveV3HorizonEthereum.JTRSY_ADDRESS);
370+
_printAssetPrice(AaveV3HorizonEthereum.JTRSY_ADDRESS, oracleSource);
362371
test_aggregator_from_registry(AaveV3HorizonEthereum.JTRSY_ADDRESS, JTRSY_NEW_AGGREGATOR);
363372
}
364373

365374
function test_jaaa() public virtual override {
375+
address oracleSource = aaveOracle.getSourceOfAsset(AaveV3HorizonEthereum.JAAA_ADDRESS);
376+
_printAssetPrice(AaveV3HorizonEthereum.JAAA_ADDRESS, oracleSource);
366377
test_aggregator_from_registry(AaveV3HorizonEthereum.JAAA_ADDRESS, JAAA_NEW_AGGREGATOR);
367378
}
368379

369380
function test_vbill() public virtual override {
381+
_printAssetPrice(AaveV3HorizonEthereum.VBILL_ADDRESS, AaveV3HorizonEthereum.VBILL_PRICE_FEED);
370382
test_aggregator_from_registry(AaveV3HorizonEthereum.VBILL_ADDRESS, VBILL_NEW_AGGREGATOR);
371383
}
372384

385+
function _printAssetPrice(address asset, address oracleSource) internal {
386+
(bool success, bytes memory data) = oracleSource.call(
387+
abi.encodeWithSignature('latestAnswer()')
388+
);
389+
require(success, 'Failed to call latestAnswer()');
390+
int256 price = abi.decode(data, (int256));
391+
console.log('asset %s price %8e', asset, uint256(price));
392+
}
393+
373394
// check that oracle from param registry points to new aggregator
374395
function test_aggregator_from_registry(address asset, address newAggregator) internal {
375396
address paramRegistryOracle = _getParamRegistryOracle(asset);

0 commit comments

Comments
 (0)