Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to use new proxy #75

Merged
merged 4 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion certora/stata/harness/StataTokenV2Harness.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.10;

import {IERC20} from 'openzeppelin-contracts/contracts/interfaces/IERC20.sol';
import {StataTokenV2, IPool, IRewardsController} from '../munged/src/contracts/extensions/static-a-token/StataTokenV2.sol';
import {StataTokenV2, IPool, IRewardsController} from '../munged/src/contracts/extensions/stata-token/StataTokenV2.sol';
import {SymbolicLendingPool} from './pool/SymbolicLendingPool.sol';

contract StataTokenV2Harness is StataTokenV2 {
Expand Down
6 changes: 3 additions & 3 deletions src/contracts/extensions/stata-token/StataTokenFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.10;

import {IERC20Metadata} from 'solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {ITransparentProxyFactory, ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
import {IPool, DataTypes} from '../../../contracts/interfaces/IPool.sol';
import {StataTokenV2} from './StataTokenV2.sol';
Expand Down Expand Up @@ -56,12 +56,12 @@ contract StataTokenFactory is Initializable, IStataTokenFactory {
);
address stataToken = TRANSPARENT_PROXY_FACTORY.createDeterministic(
STATA_TOKEN_IMPL,
PROXY_ADMIN,
ProxyAdmin(PROXY_ADMIN),
abi.encodeWithSelector(
StataTokenV2.initialize.selector,
reserveData.aTokenAddress,
string(
abi.encodePacked('Static ', IERC20Metadata(reserveData.aTokenAddress).name(), ' v2')
abi.encodePacked('Stata ', IERC20Metadata(reserveData.aTokenAddress).name(), ' v2')
),
string(symbol)
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import '../../interfaces/IMarketReportTypes.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
import {ITransparentProxyFactory, ProxyAdmin} 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';
Expand Down Expand Up @@ -33,7 +33,7 @@ contract AaveV3HelpersProcedureTwo is IErrors {
staticATokenReport.transparentProxyFactory
).create(
staticATokenReport.staticATokenFactoryImplementation,
proxyAdmin,
ProxyAdmin(proxyAdmin),
abi.encodeWithSelector(StataTokenFactory.initialize.selector)
);

Expand Down
14 changes: 7 additions & 7 deletions src/deployments/contracts/procedures/AaveV3SetupProcedure.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pragma solidity ^0.8.0;

import '../../interfaces/IMarketReportTypes.sol';
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
import {Ownable} from '../../../contracts/dependencies/openzeppelin/contracts/Ownable.sol';
import {ACLManager} from '../../../contracts/protocol/configuration/ACLManager.sol';
import {IPoolConfigurator} from '../../../contracts/interfaces/IPoolConfigurator.sol';
import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
Expand Down Expand Up @@ -99,7 +99,7 @@ contract AaveV3SetupProcedure {
poolAddressesProvider,
providerId
);
IOwnable(poolAddressesProviderRegistry).transferOwnership(marketOwner);
Ownable(poolAddressesProviderRegistry).transferOwnership(marketOwner);
} else {
poolAddressesProviderRegistry = providerRegistry;
}
Expand Down Expand Up @@ -137,7 +137,7 @@ contract AaveV3SetupProcedure {
IRewardsController(report.rewardsControllerProxy).EMISSION_MANAGER()
);
emissionManager.setRewardsController(report.rewardsControllerProxy);
IOwnable(address(emissionManager)).transferOwnership(input.poolAdmin);
Ownable(address(emissionManager)).transferOwnership(input.poolAdmin);
} else {
provider.setAddress(controllerId, input.rewardsControllerProxy);
report.rewardsControllerProxy = provider.getAddress(controllerId);
Expand Down Expand Up @@ -199,15 +199,15 @@ contract AaveV3SetupProcedure {
}

function _transferMarketOwnership(Roles memory roles, InitialReport memory report) internal {
address addressesProviderOwner = IOwnable(report.poolAddressesProvider).owner();
address marketOwner = IOwnable(report.poolAddressesProviderRegistry).owner();
address addressesProviderOwner = Ownable(report.poolAddressesProvider).owner();
address marketOwner = Ownable(report.poolAddressesProviderRegistry).owner();

if (addressesProviderOwner == address(this)) {
IOwnable(report.poolAddressesProvider).transferOwnership(roles.marketOwner);
Ownable(report.poolAddressesProvider).transferOwnership(roles.marketOwner);
}

if (marketOwner == address(this)) {
IOwnable(report.poolAddressesProviderRegistry).transferOwnership(roles.marketOwner);
Ownable(report.poolAddressesProviderRegistry).transferOwnership(roles.marketOwner);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ 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 {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
import {Collector} from '../../../contracts/treasury/Collector.sol';
import '../../interfaces/IMarketReportTypes.sol';

Expand All @@ -30,7 +29,7 @@ contract AaveV3TreasuryProcedure {
treasuryReport.treasury = address(
new TransparentUpgradeableProxy{salt: salt}(
treasuryReport.treasuryImplementation,
deployedProxyAdmin,
ProxyAdmin(deployedProxyAdmin),
abi.encodeWithSelector(
treasuryImplementation.initialize.selector,
address(treasuryOwner),
Expand All @@ -46,7 +45,7 @@ contract AaveV3TreasuryProcedure {
treasuryReport.treasury = address(
new TransparentUpgradeableProxy(
treasuryReport.treasuryImplementation,
deployedProxyAdmin,
ProxyAdmin(deployedProxyAdmin),
abi.encodeWithSelector(
treasuryImplementation.initialize.selector,
address(treasuryOwner),
Expand Down
34 changes: 0 additions & 34 deletions src/deployments/interfaces/IProxyAdmin.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import {AaveV3TreasuryProcedure} from '../../../contracts/procedures/AaveV3Treas
import {AaveV3OracleProcedure} from '../../../contracts/procedures/AaveV3OracleProcedure.sol';
import {AaveV3IncentiveProcedure} from '../../../contracts/procedures/AaveV3IncentiveProcedure.sol';
import {AaveV3DefaultRateStrategyProcedure} from '../../../contracts/procedures/AaveV3DefaultRateStrategyProcedure.sol';
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
import {Ownable} from '../../../../contracts/dependencies/openzeppelin/contracts/Ownable.sol';
import '../../../interfaces/IMarketReportTypes.sol';
import {IRewardsController} from '../../../../contracts/rewards/interfaces/IRewardsController.sol';
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
import {RevenueSplitter} from '../../../../contracts/treasury/RevenueSplitter.sol';

contract AaveV3PeripheryBatch is
Expand All @@ -25,8 +24,7 @@ contract AaveV3PeripheryBatch is
address setupBatch
) {
if (config.proxyAdmin == address(0)) {
_report.proxyAdmin = address(new ProxyAdmin{salt: config.salt}());
IOwnable(_report.proxyAdmin).transferOwnership(poolAdmin);
_report.proxyAdmin = address(new ProxyAdmin{salt: config.salt}(poolAdmin));
} else {
_report.proxyAdmin = config.proxyAdmin;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/extensions/stata-token/StataTokenV2Getters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ contract StataTokenV2GettersTest is BaseTest {
}

function test_getters() public view {
assertEq(stataTokenV2.name(), 'Static Aave Local WETH v2');
assertEq(stataTokenV2.name(), 'Stata Aave Local WETH v2');
assertEq(stataTokenV2.symbol(), 'stataLocWETHv2');

address referenceAsset = stataTokenV2.getReferenceAsset();
Expand Down
8 changes: 0 additions & 8 deletions tests/extensions/stata-token/TestBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,6 @@ abstract contract BaseTest is TestnetProcedures {
vm.warp(block.timestamp + blocks * 12); // assuming a block is around 12seconds
}

function testAdmin() public {
vm.stopPrank();
vm.startPrank(proxyAdmin);
assertEq(TransparentUpgradeableProxy(payable(address(stataTokenV2))).admin(), proxyAdmin);
assertEq(TransparentUpgradeableProxy(payable(address(factory))).admin(), proxyAdmin);
vm.stopPrank();
}

function _fundUnderlying(uint256 assets, address receiver) internal {
deal(underlying, receiver, assets);
}
Expand Down