diff --git a/src/ProtocolV3TestBase.sol b/src/ProtocolV3TestBase.sol index b257fe1d7..d773fac67 100644 --- a/src/ProtocolV3TestBase.sol +++ b/src/ProtocolV3TestBase.sol @@ -59,10 +59,10 @@ contract ProtocolV3TestBase is CommonTestBase { * @param pool the pool to be snapshotted * @return ReserveConfig[] list of configs */ - function createConfigurationSnapshot(string memory reportName, IPool pool) - public - returns (ReserveConfig[] memory) - { + function createConfigurationSnapshot( + string memory reportName, + IPool pool + ) public returns (ReserveConfig[] memory) { string memory path = string(abi.encodePacked('./reports/', reportName, '.json')); // overwrite with empty json to later be extended vm.writeFile( @@ -99,11 +99,9 @@ contract ProtocolV3TestBase is CommonTestBase { /** * @dev returns the first collateral in the list that cannot be borrowed in stable mode */ - function _getFirstCollateral(ReserveConfig[] memory configs) - private - pure - returns (ReserveConfig memory config) - { + function _getFirstCollateral( + ReserveConfig[] memory configs + ) private pure returns (ReserveConfig memory config) { for (uint256 i = 0; i < configs.length; i++) { if (configs[i].usageAsCollateralEnabled && !configs[i].stableBorrowRateEnabled) return configs[i]; @@ -114,14 +112,10 @@ contract ProtocolV3TestBase is CommonTestBase { /** * @dev tests that all assets can be deposited & withdrawn */ - function _supplyWithdrawFlow( - ReserveConfig[] memory configs, - IPool pool, - address user - ) internal { + function _supplyWithdrawFlow(ReserveConfig[] memory configs, IPool pool, address user) internal { // test all basic interactions for (uint256 i = 0; i < configs.length; i++) { - uint256 amount = 100 * 10**configs[i].decimals; + uint256 amount = 100 * 10 ** configs[i].decimals; if (!configs[i].isFrozen) { _deposit(configs[i], pool, user, amount); _skipBlocks(1000); @@ -138,16 +132,12 @@ contract ProtocolV3TestBase is CommonTestBase { /** * @dev tests that all assets with borrowing enabled can be borrowed */ - function _variableBorrowFlow( - ReserveConfig[] memory configs, - IPool pool, - address user - ) internal { + function _variableBorrowFlow(ReserveConfig[] memory configs, IPool pool, address user) internal { // put 1M whatever collateral, which should be enough to borrow 1 of each ReserveConfig memory collateralConfig = _getFirstCollateral(configs); _deposit(collateralConfig, pool, user, 1000000 ether); for (uint256 i = 0; i < configs.length; i++) { - uint256 amount = 10**configs[i].decimals; + uint256 amount = 10 ** configs[i].decimals; if (configs[i].borrowingEnabled) { _deposit(configs[i], pool, EOA, amount * 2); this._borrow(configs[i], pool, user, amount, false); @@ -160,16 +150,12 @@ contract ProtocolV3TestBase is CommonTestBase { /** * @dev tests that all assets with stable borrowing enabled can be borrowed */ - function _stableBorrowFlow( - ReserveConfig[] memory configs, - IPool pool, - address user - ) internal { + function _stableBorrowFlow(ReserveConfig[] memory configs, IPool pool, address user) internal { // put 1M whatever collateral, which should be enough to borrow 1 of each ReserveConfig memory collateralConfig = _getFirstCollateral(configs); _deposit(collateralConfig, pool, user, 1000000 ether); for (uint256 i = 0; i < configs.length; i++) { - uint256 amount = 10**configs[i].decimals; + uint256 amount = 10 ** configs[i].decimals; if (configs[i].borrowingEnabled && configs[i].stableBorrowRateEnabled) { _deposit(configs[i], pool, EOA, amount * 2); this._borrow(configs[i], pool, user, amount, true); @@ -296,9 +282,7 @@ contract ProtocolV3TestBase is CommonTestBase { ); string memory key = vm.toString(address(strategy)); vm.serializeAddress(key, 'address', address(strategy)); - bool defaultIR = false; try strategy.getBaseStableBorrowRate() returns (uint256 baseStableBorrowRate) { - defaultIR = true; vm.serializeString(key, 'baseStableBorrowRate', vm.toString(baseStableBorrowRate)); vm.serializeString(key, 'stableRateSlope1', vm.toString(strategy.getStableRateSlope1())); vm.serializeString(key, 'stableRateSlope2', vm.toString(strategy.getStableRateSlope2())); @@ -480,11 +464,10 @@ contract ProtocolV3TestBase is CommonTestBase { return vars.configs; } - function _getStructReserveTokens(IPoolDataProvider pdp, address underlyingAddress) - internal - view - returns (ReserveTokens memory) - { + function _getStructReserveTokens( + IPoolDataProvider pdp, + address underlyingAddress + ) internal view returns (ReserveTokens memory) { ReserveTokens memory reserveTokens; (reserveTokens.aToken, reserveTokens.stableDebtToken, reserveTokens.variableDebtToken) = pdp .getReserveTokensAddresses(underlyingAddress); @@ -574,11 +557,10 @@ contract ProtocolV3TestBase is CommonTestBase { }); } - function _findReserveConfig(ReserveConfig[] memory configs, address underlying) - internal - pure - returns (ReserveConfig memory) - { + function _findReserveConfig( + ReserveConfig[] memory configs, + address underlying + ) internal pure returns (ReserveConfig memory) { for (uint256 i = 0; i < configs.length; i++) { if (configs[i].underlying == underlying) { // Important to clone the struct, to avoid unexpected side effect if modifying the returned config @@ -816,10 +798,10 @@ contract ProtocolV3TestBase is CommonTestBase { } } - function _requireNoChangeInConfigs(ReserveConfig memory config1, ReserveConfig memory config2) - internal - pure - { + function _requireNoChangeInConfigs( + ReserveConfig memory config1, + ReserveConfig memory config2 + ) internal pure { require( keccak256(abi.encodePacked(config1.symbol)) == keccak256(abi.encodePacked(config2.symbol)), '_noReservesConfigsChangesApartNewListings() : UNEXPECTED_SYMBOL_CHANGED'