diff --git a/.gitignore b/.gitignore index c199a61c..92845bde 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,8 @@ out/ .env .env.bk .assets + +# artifacts reports/ diffs/ downloads/ diff --git a/bun.lockb b/bun.lockb index 512e8aff..471ed858 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 1ce81992..c151c49a 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "prettier-plugin-solidity": "^1.1.1" }, "dependencies": { - "@bgd-labs/aave-cli": "^0.7.2", - "catapulta-verify": "^1.0.6-b4e4af767ca0ef6644d50aeca57aae1a560fe40d.0" + "@bgd-labs/aave-cli": "^0.16.2", + "catapulta-verify": "^1.1.1" } } diff --git a/tests/mocks/AaveV3TestListing.sol b/tests/mocks/AaveV3TestListing.sol index 2e783855..30751b34 100644 --- a/tests/mocks/AaveV3TestListing.sol +++ b/tests/mocks/AaveV3TestListing.sol @@ -5,7 +5,7 @@ import 'aave-v3-periphery/contracts/v3-config-engine/AaveV3Payload.sol'; import {TestnetERC20} from 'aave-v3-periphery/contracts/mocks/testnet-helpers/TestnetERC20.sol'; import {MockAggregator} from 'aave-v3-core/contracts/mocks/oracle/CLAggregators/MockAggregator.sol'; import {ACLManager} from 'aave-v3-core/contracts/protocol/configuration/ACLManager.sol'; -import {MarketReport} from 'src/deployments/interfaces/IMarketReportTypes.sol'; +import {MarketReport} from '../../src/deployments/interfaces/IMarketReportTypes.sol'; /** * @dev Smart contract for token listing, for testing purposes diff --git a/tests/periphery/v3-config-engine/AaveV3ConfigEngineTest.t.sol b/tests/periphery/v3-config-engine/AaveV3ConfigEngineTest.t.sol index 0454771d..e73843f7 100644 --- a/tests/periphery/v3-config-engine/AaveV3ConfigEngineTest.t.sol +++ b/tests/periphery/v3-config-engine/AaveV3ConfigEngineTest.t.sol @@ -100,7 +100,10 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase { supplyCap: 85_000, borrowCap: 60_000, debtCeiling: 0, - eModeCategory: 0 + eModeCategory: 0, + virtualAccActive: true, + virtualBalance: 0, + aTokenUnderlyingBalance: 0 }); _validateReserveConfig(expectedAssetConfig, allConfigsAfter); @@ -200,7 +203,10 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase { supplyCap: 85_000, borrowCap: 60_000, debtCeiling: 0, - eModeCategory: 0 + eModeCategory: 0, + virtualAccActive: true, + virtualBalance: 0, + aTokenUnderlyingBalance: 0 }); _validateReserveConfig(expectedAssetConfig, allConfigsAfter); diff --git a/tests/utils/DiffUtils.sol b/tests/utils/DiffUtils.sol index 6ed13480..a5e7577d 100644 --- a/tests/utils/DiffUtils.sol +++ b/tests/utils/DiffUtils.sol @@ -22,7 +22,7 @@ contract DiffUtils is Test { string[] memory inputs = new string[](7); inputs[0] = 'npx'; - inputs[1] = '@bgd-labs/aave-cli@^0.7.2'; + inputs[1] = '@bgd-labs/aave-cli@^0.16.2'; inputs[2] = 'diff-snapshots'; inputs[3] = beforePath; inputs[4] = afterPath; diff --git a/tests/utils/ProtocolV3TestBase.sol b/tests/utils/ProtocolV3TestBase.sol index efe4b083..faf3436e 100644 --- a/tests/utils/ProtocolV3TestBase.sol +++ b/tests/utils/ProtocolV3TestBase.sol @@ -103,6 +103,9 @@ struct ReserveConfig { uint256 borrowCap; uint256 debtCeiling; uint256 eModeCategory; + bool virtualAccActive; + uint256 virtualBalance; + uint256 aTokenUnderlyingBalance; } struct LocalVars { @@ -187,42 +190,43 @@ contract ProtocolV3TestBase is DiffUtils { // keys for json stringification string memory strategiesKey = 'stategies'; string memory content = '{}'; + vm.serializeJson(strategiesKey, '{}'); - address[] memory usedStrategies = new address[](configs.length); for (uint256 i = 0; i < configs.length; i++) { - if (!_isInAddressArray(usedStrategies, configs[i].interestRateStrategy)) { - usedStrategies[i] = configs[i].interestRateStrategy; - IDefaultInterestRateStrategyV2 strategy = IDefaultInterestRateStrategyV2( - configs[i].interestRateStrategy - ); - string memory key = vm.toString(address(strategy)); - vm.serializeString( - key, - 'baseVariableBorrowRate', - vm.toString(strategy.getBaseVariableBorrowRate(configs[i].underlying)) - ); - vm.serializeString( - key, - 'variableRateSlope1', - vm.toString(strategy.getVariableRateSlope1(configs[i].underlying)) - ); - vm.serializeString( - key, - 'variableRateSlope2', - vm.toString(strategy.getVariableRateSlope2(configs[i].underlying)) - ); - vm.serializeString( - key, - 'maxVariableBorrowRate', - vm.toString(strategy.getMaxVariableBorrowRate(configs[i].underlying)) - ); - string memory object = vm.serializeString( - key, - 'optimalUsageRatio', - vm.toString(strategy.getOptimalUsageRatio(configs[i].underlying)) - ); - content = vm.serializeString(strategiesKey, key, object); - } + address asset = configs[i].underlying; + string memory key = vm.toString(asset); + vm.serializeJson(key, '{}'); + vm.serializeString(key, 'address', vm.toString(configs[i].interestRateStrategy)); + IDefaultInterestRateStrategyV2 strategy = IDefaultInterestRateStrategyV2( + configs[i].interestRateStrategy + ); + vm.serializeString( + key, + 'baseVariableBorrowRate', + vm.toString(strategy.getBaseVariableBorrowRate(asset)) + ); + vm.serializeString( + key, + 'variableRateSlope1', + vm.toString(strategy.getVariableRateSlope1(asset)) + ); + vm.serializeString( + key, + 'variableRateSlope2', + vm.toString(strategy.getVariableRateSlope2(asset)) + ); + vm.serializeString( + key, + 'maxVariableBorrowRate', + vm.toString(strategy.getMaxVariableBorrowRate(asset)) + ); + string memory object = vm.serializeString( + key, + 'optimalUsageRatio', + vm.toString(strategy.getOptimalUsageRatio(asset)) + ); + + content = vm.serializeString(strategiesKey, key, object); } string memory output = vm.serializeString('root', 'strategies', content); vm.writeJson(output, path); @@ -327,6 +331,11 @@ contract ProtocolV3TestBase is DiffUtils { } catch {} } } + + vm.serializeBool(key, 'virtualAccountingActive', config.virtualAccActive); + vm.serializeUint(key, 'virtualBalance', config.virtualBalance); + vm.serializeUint(key, 'aTokenUnderlyingBalance', config.aTokenUnderlyingBalance); + string memory out = vm.serializeUint( key, 'oracleLatestAnswer', @@ -450,6 +459,16 @@ contract ProtocolV3TestBase is DiffUtils { localConfig.isFlashloanable = configuration.getFlashLoanEnabled(); + // 3.1 configurations + localConfig.virtualAccActive = configuration.getIsVirtualAccActive(); + + if (localConfig.virtualAccActive) { + localConfig.virtualBalance = pool.getVirtualUnderlyingBalance(reserve.tokenAddress); + localConfig.aTokenUnderlyingBalance = IERC20Detailed(reserve.tokenAddress).balanceOf( + localConfig.aToken + ); + } + return localConfig; } @@ -481,7 +500,10 @@ contract ProtocolV3TestBase is DiffUtils { supplyCap: config.supplyCap, borrowCap: config.borrowCap, debtCeiling: config.debtCeiling, - eModeCategory: config.eModeCategory + eModeCategory: config.eModeCategory, + virtualAccActive: config.virtualAccActive, + virtualBalance: config.virtualBalance, + aTokenUnderlyingBalance: config.aTokenUnderlyingBalance }); }