From 7d706f00fa0c25f747c75284e8724dd927bbe42a Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 29 Jan 2025 12:27:27 +0100 Subject: [PATCH] feat: upgrade factory (#95) * feat: upgrade factory * fix: cleanup * fix: use local copy * fix: tests * fix: remove deployment of proxyAdmin * fix: update tests * fix: update utils to latest --------- Co-authored-by: Harsh Pandey --- foundry.toml | 8 ++--- lib/solidity-utils | 2 +- snapshots/StataTokenV2.json | 8 ++--- .../stata-token/ERC20AaveLMUpgradeable.sol | 2 +- .../stata-token/StataTokenFactory.sol | 14 ++++----- .../interfaces/IStataTokenFactory.sol | 6 ++-- .../v3-config-engine/AaveV3ConfigEngine.sol | 2 +- .../v3-config-engine/AaveV3Payload.sol | 2 +- .../libraries/EModeEngine.sol | 2 +- .../libraries/ListingEngine.sol | 2 +- .../procedures/AaveV3HelpersProcedureTwo.sol | 10 +++---- .../procedures/AaveV3TreasuryProcedure.sol | 8 ++--- .../contracts/utilities/MarketReportUtils.sol | 1 - .../contracts/utilities/MetadataReporter.sol | 1 - src/deployments/interfaces/IErrors.sol | 2 +- .../interfaces/IMarketReportTypes.sol | 5 ---- .../AaveV3BatchOrchestration.sol | 9 +++--- .../batches/AaveV3HelpersBatchTwo.sol | 4 +-- .../batches/AaveV3PeripheryBatch.sol | 12 +------- tests/deployments/AaveV3BatchDeployment.t.sol | 1 - tests/deployments/AaveV3BatchTests.t.sol | 3 +- tests/deployments/AaveV3PermissionsTest.t.sol | 30 +++++-------------- tests/deployments/DeploymentsGasLimits.t.sol | 3 +- tests/extensions/stata-token/TestBase.sol | 8 +++-- tests/utils/BatchTestProcedures.sol | 1 - 25 files changed, 57 insertions(+), 89 deletions(-) diff --git a/foundry.toml b/foundry.toml index a2c225e2..c474f11a 100644 --- a/foundry.toml +++ b/foundry.toml @@ -4,7 +4,7 @@ test = 'tests' script = 'scripts' optimizer = true optimizer_runs = 200 -solc = '0.8.20' +solc = '0.8.22' evm_version = 'shanghai' bytecode_hash = 'none' ignored_warnings_from = ["src/periphery/contracts/treasury/RevenueSplitter.sol"] @@ -12,9 +12,9 @@ out = 'out' libs = ['lib'] remappings = [] fs_permissions = [ - { access = "write", path = "./reports" }, - { access = "read", path = "./out" }, - { access = "read", path = "./config" }, + { access = "write", path = "./reports" }, + { access = "read", path = "./out" }, + { access = "read", path = "./config" }, ] ffi = true diff --git a/lib/solidity-utils b/lib/solidity-utils index 6f72233c..1422f3e6 160000 --- a/lib/solidity-utils +++ b/lib/solidity-utils @@ -1 +1 @@ -Subproject commit 6f72233c112ed0df5b6c3e02a2a3d04a56e3b2bc +Subproject commit 1422f3e6cc2ea038e37b1578e713b13b1f6f2dc8 diff --git a/snapshots/StataTokenV2.json b/snapshots/StataTokenV2.json index 5f9315f7..a5ffdef8 100644 --- a/snapshots/StataTokenV2.json +++ b/snapshots/StataTokenV2.json @@ -1,6 +1,6 @@ { - "deposit": "284677", - "depositATokens": "220136", - "redeem": "205767", - "redeemAToken": "153413" + "deposit": "283763", + "depositATokens": "219223", + "redeem": "205909", + "redeemAToken": "152567" } \ No newline at end of file diff --git a/src/contracts/extensions/stata-token/ERC20AaveLMUpgradeable.sol b/src/contracts/extensions/stata-token/ERC20AaveLMUpgradeable.sol index d56b3899..cd076d6c 100644 --- a/src/contracts/extensions/stata-token/ERC20AaveLMUpgradeable.sol +++ b/src/contracts/extensions/stata-token/ERC20AaveLMUpgradeable.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.17; import {ERC20Upgradeable} from 'openzeppelin-contracts-upgradeable/contracts/token/ERC20/ERC20Upgradeable.sol'; import {IERC20} from 'openzeppelin-contracts/contracts/interfaces/IERC20.sol'; import {SafeERC20} from 'openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol'; -import {SafeCast} from 'solidity-utils/contracts/oz-common/SafeCast.sol'; +import {SafeCast} from 'openzeppelin-contracts/contracts/utils/math/SafeCast.sol'; import {IRewardsController} from '../../rewards/interfaces/IRewardsController.sol'; import {IERC20AaveLM} from './interfaces/IERC20AaveLM.sol'; diff --git a/src/contracts/extensions/stata-token/StataTokenFactory.sol b/src/contracts/extensions/stata-token/StataTokenFactory.sol index 3de7890a..5741c0b6 100644 --- a/src/contracts/extensions/stata-token/StataTokenFactory.sol +++ b/src/contracts/extensions/stata-token/StataTokenFactory.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.10; -import {IERC20Metadata} from 'solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol'; -import {ITransparentProxyFactory, ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol'; -import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol'; +import {IERC20Metadata} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol'; +import {Initializable} from 'openzeppelin-contracts/contracts/proxy/utils/Initializable.sol'; +import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol'; import {IPool, DataTypes} from '../../../contracts/interfaces/IPool.sol'; import {StataTokenV2} from './StataTokenV2.sol'; import {IStataTokenFactory} from './interfaces/IStataTokenFactory.sol'; @@ -20,7 +20,7 @@ contract StataTokenFactory is Initializable, IStataTokenFactory { IPool public immutable POOL; ///@inheritdoc IStataTokenFactory - address public immutable PROXY_ADMIN; + address public immutable INITIAL_OWNER; ///@inheritdoc IStataTokenFactory ITransparentProxyFactory public immutable TRANSPARENT_PROXY_FACTORY; @@ -35,12 +35,12 @@ contract StataTokenFactory is Initializable, IStataTokenFactory { constructor( IPool pool, - address proxyAdmin, + address initialOwner, ITransparentProxyFactory transparentProxyFactory, address stataTokenImpl ) { POOL = pool; - PROXY_ADMIN = proxyAdmin; + INITIAL_OWNER = initialOwner; TRANSPARENT_PROXY_FACTORY = transparentProxyFactory; STATA_TOKEN_IMPL = stataTokenImpl; } @@ -62,7 +62,7 @@ contract StataTokenFactory is Initializable, IStataTokenFactory { ); address stataToken = TRANSPARENT_PROXY_FACTORY.createDeterministic( STATA_TOKEN_IMPL, - ProxyAdmin(PROXY_ADMIN), + INITIAL_OWNER, abi.encodeWithSelector( StataTokenV2.initialize.selector, reserveData.aTokenAddress, diff --git a/src/contracts/extensions/stata-token/interfaces/IStataTokenFactory.sol b/src/contracts/extensions/stata-token/interfaces/IStataTokenFactory.sol index 5566d023..ee22809e 100644 --- a/src/contracts/extensions/stata-token/interfaces/IStataTokenFactory.sol +++ b/src/contracts/extensions/stata-token/interfaces/IStataTokenFactory.sol @@ -14,10 +14,10 @@ interface IStataTokenFactory { function POOL() external view returns (IPool); /** - * @notice The proxy admin used for all tokens created via the factory. - * @return The proxy admin address. + * @notice The initial owner used for all tokens created via the factory. + * @return The address of the initial owner. */ - function PROXY_ADMIN() external view returns (address); + function INITIAL_OWNER() external view returns (address); /** * @notice The proxy factory used for all tokens created via the stata factory. diff --git a/src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol b/src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol index 3c9df057..85921157 100644 --- a/src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol +++ b/src/contracts/extensions/v3-config-engine/AaveV3ConfigEngine.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.18; +import {Address} from 'openzeppelin-contracts/contracts/utils/Address.sol'; import {CapsEngine} from './libraries/CapsEngine.sol'; import {BorrowEngine} from './libraries/BorrowEngine.sol'; import {CollateralEngine} from './libraries/CollateralEngine.sol'; @@ -8,7 +9,6 @@ import {RateEngine} from './libraries/RateEngine.sol'; import {PriceFeedEngine} from './libraries/PriceFeedEngine.sol'; import {EModeEngine} from './libraries/EModeEngine.sol'; import {ListingEngine} from './libraries/ListingEngine.sol'; -import {Address} from 'solidity-utils/contracts/oz-common/Address.sol'; import './IAaveV3ConfigEngine.sol'; /** diff --git a/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol b/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol index 50ecc07a..5f56397c 100644 --- a/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol +++ b/src/contracts/extensions/v3-config-engine/AaveV3Payload.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import {Address} from 'solidity-utils/contracts/oz-common/Address.sol'; +import {Address} from 'openzeppelin-contracts/contracts/utils/Address.sol'; import {WadRayMath} from '../../protocol/libraries/math/WadRayMath.sol'; import {IAaveV3ConfigEngine as IEngine} from './IAaveV3ConfigEngine.sol'; import {EngineFlags} from './EngineFlags.sol'; diff --git a/src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol index df2f72ab..fef88337 100644 --- a/src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol +++ b/src/contracts/extensions/v3-config-engine/libraries/EModeEngine.sol @@ -1,9 +1,9 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.18; +import {SafeCast} from 'openzeppelin-contracts/contracts/utils/math/SafeCast.sol'; import {EngineFlags} from '../EngineFlags.sol'; import {DataTypes} from '../../../protocol/libraries/types/DataTypes.sol'; -import {SafeCast} from 'solidity-utils/contracts/oz-common/SafeCast.sol'; import {PercentageMath} from '../../../protocol/libraries/math/PercentageMath.sol'; import {IAaveV3ConfigEngine as IEngine, IPoolConfigurator, IPool} from '../IAaveV3ConfigEngine.sol'; diff --git a/src/contracts/extensions/v3-config-engine/libraries/ListingEngine.sol b/src/contracts/extensions/v3-config-engine/libraries/ListingEngine.sol index 29d98807..3d7009f4 100644 --- a/src/contracts/extensions/v3-config-engine/libraries/ListingEngine.sol +++ b/src/contracts/extensions/v3-config-engine/libraries/ListingEngine.sol @@ -1,6 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.18; +import {Address} from 'openzeppelin-contracts/contracts/utils/Address.sol'; import {IAaveV3ConfigEngine as IEngine, IPoolConfigurator, IPool, IDefaultInterestRateStrategyV2} from '../IAaveV3ConfigEngine.sol'; import {PriceFeedEngine} from './PriceFeedEngine.sol'; import {CapsEngine} from './CapsEngine.sol'; @@ -8,7 +9,6 @@ import {BorrowEngine} from './BorrowEngine.sol'; import {CollateralEngine} from './CollateralEngine.sol'; import {EModeEngine} from './EModeEngine.sol'; import {ConfiguratorInputTypes} from '../../../protocol/libraries/types/ConfiguratorInputTypes.sol'; -import {Address} from 'solidity-utils/contracts/oz-common/Address.sol'; import {SafeCast} from '../../../dependencies/openzeppelin/contracts/SafeCast.sol'; library ListingEngine { diff --git a/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol b/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol index 12890f5d..4a1981d9 100644 --- a/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol +++ b/src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.0; import '../../interfaces/IMarketReportTypes.sol'; -import {ITransparentProxyFactory, ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol'; +import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol'; import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/TransparentProxyFactory.sol'; import {StataTokenV2} from '../../../contracts/extensions/stata-token/StataTokenV2.sol'; import {StataTokenFactory} from '../../../contracts/extensions/stata-token/StataTokenFactory.sol'; @@ -12,9 +12,9 @@ contract AaveV3HelpersProcedureTwo is IErrors { function _deployStaticAToken( address pool, address rewardsController, - address proxyAdmin + address poolAdmin ) internal returns (StaticATokenReport memory staticATokenReport) { - if (proxyAdmin == address(0)) revert ProxyAdminNotFound(); + if (poolAdmin == address(0)) revert PoolAdminNotFound(); staticATokenReport.transparentProxyFactory = address(new TransparentProxyFactory()); staticATokenReport.staticATokenImplementation = address( @@ -23,7 +23,7 @@ contract AaveV3HelpersProcedureTwo is IErrors { staticATokenReport.staticATokenFactoryImplementation = address( new StataTokenFactory( IPool(pool), - proxyAdmin, + poolAdmin, ITransparentProxyFactory(staticATokenReport.transparentProxyFactory), staticATokenReport.staticATokenImplementation ) @@ -33,7 +33,7 @@ contract AaveV3HelpersProcedureTwo is IErrors { staticATokenReport.transparentProxyFactory ).create( staticATokenReport.staticATokenFactoryImplementation, - ProxyAdmin(proxyAdmin), + poolAdmin, abi.encodeWithSelector(StataTokenFactory.initialize.selector) ); diff --git a/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol b/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol index 76f6650b..a80aa754 100644 --- a/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol +++ b/src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol @@ -1,8 +1,7 @@ // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; -import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; -import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {TransparentUpgradeableProxy} from 'openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; import {Collector} from '../../../contracts/treasury/Collector.sol'; import '../../interfaces/IMarketReportTypes.sol'; @@ -14,7 +13,6 @@ contract AaveV3TreasuryProcedure { function _deployAaveV3Treasury( address poolAdmin, - address deployedProxyAdmin, bytes32 collectorSalt ) internal returns (TreasuryReport memory) { TreasuryReport memory treasuryReport; @@ -29,7 +27,7 @@ contract AaveV3TreasuryProcedure { treasuryReport.treasury = address( new TransparentUpgradeableProxy{salt: salt}( treasuryReport.treasuryImplementation, - ProxyAdmin(deployedProxyAdmin), + poolAdmin, abi.encodeWithSelector( treasuryImplementation.initialize.selector, address(treasuryOwner), @@ -45,7 +43,7 @@ contract AaveV3TreasuryProcedure { treasuryReport.treasury = address( new TransparentUpgradeableProxy( treasuryReport.treasuryImplementation, - ProxyAdmin(deployedProxyAdmin), + poolAdmin, abi.encodeWithSelector( treasuryImplementation.initialize.selector, address(treasuryOwner), diff --git a/src/deployments/contracts/utilities/MarketReportUtils.sol b/src/deployments/contracts/utilities/MarketReportUtils.sol index 24edd37f..85ac7f41 100644 --- a/src/deployments/contracts/utilities/MarketReportUtils.sol +++ b/src/deployments/contracts/utilities/MarketReportUtils.sol @@ -24,7 +24,6 @@ library MarketReportUtils { defaultInterestRateStrategy: IDefaultInterestRateStrategyV2( report.defaultInterestRateStrategy ), - proxyAdmin: ProxyAdmin(report.proxyAdmin), treasuryImplementation: ICollector(report.treasuryImplementation), wrappedTokenGateway: IWrappedTokenGatewayV3(report.wrappedTokenGateway), walletBalanceProvider: WalletBalanceProvider(payable(report.walletBalanceProvider)), diff --git a/src/deployments/contracts/utilities/MetadataReporter.sol b/src/deployments/contracts/utilities/MetadataReporter.sol index 7b2f6f92..f143aeae 100644 --- a/src/deployments/contracts/utilities/MetadataReporter.sol +++ b/src/deployments/contracts/utilities/MetadataReporter.sol @@ -38,7 +38,6 @@ contract MetadataReporter is IMetadataReporter { ); vm.serializeAddress(jsonReport, 'aaveOracle', report.aaveOracle); vm.serializeAddress(jsonReport, 'treasury', report.treasury); - vm.serializeAddress(jsonReport, 'proxyAdmin', report.proxyAdmin); vm.serializeAddress(jsonReport, 'wrappedTokenGateway', report.wrappedTokenGateway); vm.serializeAddress(jsonReport, 'walletBalanceProvider', report.walletBalanceProvider); vm.serializeAddress(jsonReport, 'uiIncentiveDataProvider', report.uiIncentiveDataProvider); diff --git a/src/deployments/interfaces/IErrors.sol b/src/deployments/interfaces/IErrors.sol index 7d0df80a..e865485b 100644 --- a/src/deployments/interfaces/IErrors.sol +++ b/src/deployments/interfaces/IErrors.sol @@ -5,5 +5,5 @@ interface IErrors { error L2MustBeEnabled(); error L2MustBeDisabled(); error ProviderNotFound(); - error ProxyAdminNotFound(); + error PoolAdminNotFound(); } diff --git a/src/deployments/interfaces/IMarketReportTypes.sol b/src/deployments/interfaces/IMarketReportTypes.sol index afa6a2e2..96bf5af7 100644 --- a/src/deployments/interfaces/IMarketReportTypes.sol +++ b/src/deployments/interfaces/IMarketReportTypes.sol @@ -22,7 +22,6 @@ import '../../contracts/extensions/paraswap-adapters/ParaSwapWithdrawSwapAdapter import '../../contracts/helpers/interfaces/IWrappedTokenGatewayV3.sol'; import '../../contracts/helpers/L2Encoder.sol'; import {ICollector} from '../../contracts/treasury/ICollector.sol'; -import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol'; struct ContractsReport { IPoolAddressesProviderRegistry poolAddressesProviderRegistry; @@ -36,7 +35,6 @@ struct ContractsReport { IACLManager aclManager; ICollector treasury; IDefaultInterestRateStrategyV2 defaultInterestRateStrategy; - ProxyAdmin proxyAdmin; ICollector treasuryImplementation; IWrappedTokenGatewayV3 wrappedTokenGateway; WalletBalanceProvider walletBalanceProvider; @@ -66,7 +64,6 @@ struct MarketReport { address priceOracleSentinel; address aclManager; address treasury; - address proxyAdmin; address treasuryImplementation; address wrappedTokenGateway; address walletBalanceProvider; @@ -117,7 +114,6 @@ struct MarketConfig { uint256 providerId; bytes32 salt; address wrappedNativeToken; - address proxyAdmin; uint128 flashLoanPremiumTotal; uint128 flashLoanPremiumToProtocol; address incentivesProxy; @@ -172,7 +168,6 @@ struct SetupReport { struct PeripheryReport { address aaveOracle; - address proxyAdmin; address treasury; address treasuryImplementation; address emissionManager; diff --git a/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol b/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol index 1ef2ee87..1b213cb7 100644 --- a/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol +++ b/src/deployments/projects/aave-v3-batched/AaveV3BatchOrchestration.sol @@ -88,6 +88,8 @@ library AaveV3BatchOrchestration { AaveV3TokensBatch.TokensReport memory tokensReport = _deployTokens(setupReport.poolProxy); + // to avoid issues when running without --via-ir we copy the variable + address pa = roles.poolAdmin; ConfigEngineReport memory configEngineReport = _deployHelpersBatch1( setupReport, miscReport, @@ -98,7 +100,7 @@ library AaveV3BatchOrchestration { StaticATokenReport memory staticATokenReport = _deployHelpersBatch2( setupReport.poolProxy, setupReport.rewardsControllerProxy, - peripheryReport.proxyAdmin + pa ); // Save final report at AaveV3SetupBatch contract @@ -191,12 +193,12 @@ library AaveV3BatchOrchestration { function _deployHelpersBatch2( address pool, address rewardsController, - address proxyAdmin + address poolAdmin ) internal returns (StaticATokenReport memory) { AaveV3HelpersBatchTwo helpersBatchTwo = new AaveV3HelpersBatchTwo( pool, rewardsController, - proxyAdmin + poolAdmin ); return helpersBatchTwo.staticATokenReport(); @@ -311,7 +313,6 @@ library AaveV3BatchOrchestration { report.paraSwapRepayAdapter = paraswapReport.paraSwapRepayAdapter; report.paraSwapWithdrawSwapAdapter = paraswapReport.paraSwapWithdrawSwapAdapter; report.treasuryImplementation = peripheryReport.treasuryImplementation; - report.proxyAdmin = peripheryReport.proxyAdmin; report.treasury = peripheryReport.treasury; report.poolProxy = setupReport.poolProxy; report.poolConfiguratorProxy = setupReport.poolConfiguratorProxy; diff --git a/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol b/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol index 1db9f7b9..eb52c646 100644 --- a/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol +++ b/src/deployments/projects/aave-v3-batched/batches/AaveV3HelpersBatchTwo.sol @@ -7,8 +7,8 @@ import '../../../interfaces/IMarketReportTypes.sol'; contract AaveV3HelpersBatchTwo is AaveV3HelpersProcedureTwo { StaticATokenReport internal _report; - constructor(address pool, address rewardsController, address proxyAdmin) { - _report = _deployStaticAToken(pool, rewardsController, proxyAdmin); + constructor(address pool, address rewardsController, address poolAdmin) { + _report = _deployStaticAToken(pool, rewardsController, poolAdmin); } function staticATokenReport() external view returns (StaticATokenReport memory) { diff --git a/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol b/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol index ce332dfe..af043379 100644 --- a/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol +++ b/src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol @@ -23,20 +23,10 @@ contract AaveV3PeripheryBatch is address poolAddressesProvider, address setupBatch ) { - if (config.proxyAdmin == address(0)) { - _report.proxyAdmin = address(new ProxyAdmin{salt: config.salt}(poolAdmin)); - } else { - _report.proxyAdmin = config.proxyAdmin; - } - _report.aaveOracle = _deployAaveOracle(config.oracleDecimals, poolAddressesProvider); if (config.treasury == address(0)) { - TreasuryReport memory treasuryReport = _deployAaveV3Treasury( - poolAdmin, - _report.proxyAdmin, - config.salt - ); + TreasuryReport memory treasuryReport = _deployAaveV3Treasury(poolAdmin, config.salt); _report.treasury = treasuryReport.treasury; _report.treasuryImplementation = treasuryReport.treasuryImplementation; diff --git a/tests/deployments/AaveV3BatchDeployment.t.sol b/tests/deployments/AaveV3BatchDeployment.t.sol index e329b09d..6d556c5c 100644 --- a/tests/deployments/AaveV3BatchDeployment.t.sol +++ b/tests/deployments/AaveV3BatchDeployment.t.sol @@ -50,7 +50,6 @@ contract AaveV3BatchDeployment is BatchTestProcedures { 8080, emptySalt, weth9, - address(0), 0.0005e4, 0.0004e4, address(0), diff --git a/tests/deployments/AaveV3BatchTests.t.sol b/tests/deployments/AaveV3BatchTests.t.sol index 2252b7ce..7aacb55f 100644 --- a/tests/deployments/AaveV3BatchTests.t.sol +++ b/tests/deployments/AaveV3BatchTests.t.sol @@ -64,7 +64,6 @@ contract AaveV3BatchTests is BatchTestProcedures { 8080, emptySalt, address(new WETH9()), - address(0), 0.0005e4, 0.0004e4, address(0), @@ -200,7 +199,7 @@ contract AaveV3BatchTests is BatchTestProcedures { new AaveV3HelpersBatchTwo( setupReportTwo.poolProxy, setupReportTwo.rewardsControllerProxy, - peripheryReportOne.proxyAdmin + roles.poolAdmin ); } } diff --git a/tests/deployments/AaveV3PermissionsTest.t.sol b/tests/deployments/AaveV3PermissionsTest.t.sol index 170c8022..46174303 100644 --- a/tests/deployments/AaveV3PermissionsTest.t.sol +++ b/tests/deployments/AaveV3PermissionsTest.t.sol @@ -150,19 +150,12 @@ contract AaveV3PermissionsTest is BatchTestProcedures { ); } { - address treasuryAdmin = address(uint160(uint256(vm.load(report.treasury, ADMIN_SLOT)))); + address proxyAdmin = address(uint160(uint256(vm.load(report.treasury, ADMIN_SLOT)))); + address owner = Ownable(proxyAdmin).owner(); assertEq( - treasuryAdmin, - report.proxyAdmin, - 'Treasury proxy admin does not match with report.proxyAdmin' - ); - } - { - address proxyAdminOwner = Ownable(report.proxyAdmin).owner(); - assertEq( - proxyAdminOwner, + owner, roles.poolAdmin, - 'ProxyAdmin owner does not match with roles.poolAdmin' + 'Treasury proxy admin does not match with report.proxyAdmin' ); } } @@ -299,19 +292,12 @@ contract AaveV3PermissionsTest is BatchTestProcedures { ); } { - address treasuryAdmin = address(uint160(uint256(vm.load(report.treasury, ADMIN_SLOT)))); + address proxyAdmin = address(uint160(uint256(vm.load(report.treasury, ADMIN_SLOT)))); + address owner = Ownable(proxyAdmin).owner(); assertEq( - treasuryAdmin, - report.proxyAdmin, - 'Treasury proxy admin does not match with report.proxyAdmin' - ); - } - { - address proxyAdminOwner = Ownable(report.proxyAdmin).owner(); - assertEq( - proxyAdminOwner, + owner, roles.poolAdmin, - 'ProxyAdmin owner does not match with roles.poolAdmin' + 'Treasury proxy admin does not match with report.proxyAdmin' ); } { diff --git a/tests/deployments/DeploymentsGasLimits.t.sol b/tests/deployments/DeploymentsGasLimits.t.sol index 98e2da92..5a38d66d 100644 --- a/tests/deployments/DeploymentsGasLimits.t.sol +++ b/tests/deployments/DeploymentsGasLimits.t.sol @@ -60,7 +60,6 @@ contract DeploymentsGasLimits is BatchTestProcedures { 8080, empty, address(new WETH9()), - address(0), 0.0005e4, 0.0004e4, address(0), @@ -185,7 +184,7 @@ contract DeploymentsGasLimits is BatchTestProcedures { new AaveV3HelpersBatchTwo( setupReportTwo.poolProxy, setupReportTwo.rewardsControllerProxy, - peripheryReportOne.proxyAdmin + roles.poolAdmin ); } diff --git a/tests/extensions/stata-token/TestBase.sol b/tests/extensions/stata-token/TestBase.sol index e7cfab41..f923c1f1 100644 --- a/tests/extensions/stata-token/TestBase.sol +++ b/tests/extensions/stata-token/TestBase.sol @@ -2,7 +2,7 @@ pragma solidity ^0.8.10; import {IERC20Metadata, IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol'; -import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol'; +import {TransparentUpgradeableProxy} from 'openzeppelin-contracts/contracts/proxy/transparent/TransparentUpgradeableProxy.sol'; import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol'; import {StataTokenFactory} from '../../../src/contracts/extensions/stata-token/StataTokenFactory.sol'; import {StataTokenV2} from '../../../src/contracts/extensions/stata-token/StataTokenV2.sol'; @@ -11,6 +11,10 @@ import {TestnetProcedures, TestnetERC20} from '../../utils/TestnetProcedures.sol import {DataTypes} from '../../../src/contracts/protocol/libraries/types/DataTypes.sol'; abstract contract BaseTest is TestnetProcedures { + /// @dev Storage slot with the admin of the contract. + bytes32 internal constant ADMIN_SLOT = + 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; + address constant OWNER = address(1234); address public constant EMISSION_ADMIN = address(25); @@ -51,12 +55,12 @@ abstract contract BaseTest is TestnetProcedures { rewardTokens.push(rewardToken); proxyFactory = ITransparentProxyFactory(report.transparentProxyFactory); - proxyAdmin = report.proxyAdmin; factory = StataTokenFactory(report.staticATokenFactoryProxy); factory.createStataTokens(contracts.poolProxy.getReservesList()); stataTokenV2 = StataTokenV2(factory.getStataToken(underlying)); + proxyAdmin = address(uint160(uint256(vm.load(address(stataTokenV2), ADMIN_SLOT)))); } function _skipBlocks(uint128 blocks) internal { diff --git a/tests/utils/BatchTestProcedures.sol b/tests/utils/BatchTestProcedures.sol index edbda935..ff962262 100644 --- a/tests/utils/BatchTestProcedures.sol +++ b/tests/utils/BatchTestProcedures.sol @@ -188,7 +188,6 @@ contract BatchTestProcedures is Test, DeployUtils, FfiUtils, DefaultMarketInput assertTrue(r.aaveOracle != address(0), 'report.aaveOracle'); assertTrue(r.defaultInterestRateStrategy != address(0), 'report.defaultInterestRateStrategy'); assertTrue(r.aclManager != address(0), 'report.aclManager'); - assertTrue(r.proxyAdmin != address(0), 'report.proxyAdmin'); if (config.treasury == address(0)) { assertTrue(r.treasury != address(0), 'report.treasury'); assertTrue(r.treasuryImplementation != address(0), 'report.treasuryImplementation');