Skip to content

Commit 665b480

Browse files
authored
feat: update to use new proxy & change stata naming (#75)
1 parent 809dd8a commit 665b480

File tree

12 files changed

+56
-72
lines changed

12 files changed

+56
-72
lines changed

certora/stata/harness/StataTokenV2Harness.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.10;
33

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

88
contract StataTokenV2Harness is StataTokenV2 {

src/contracts/extensions/stata-token/StataTokenFactory.sol

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.10;
33

44
import {IERC20Metadata} from 'solidity-utils/contracts/oz-common/interfaces/IERC20Metadata.sol';
5-
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
5+
import {ITransparentProxyFactory, ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
66
import {Initializable} from 'solidity-utils/contracts/transparent-proxy/Initializable.sol';
77
import {IPool, DataTypes} from '../../../contracts/interfaces/IPool.sol';
88
import {StataTokenV2} from './StataTokenV2.sol';
@@ -16,9 +16,16 @@ import {IStataTokenFactory} from './interfaces/IStataTokenFactory.sol';
1616
* @author BGD labs
1717
*/
1818
contract StataTokenFactory is Initializable, IStataTokenFactory {
19+
///@inheritdoc IStataTokenFactory
1920
IPool public immutable POOL;
21+
22+
///@inheritdoc IStataTokenFactory
2023
address public immutable PROXY_ADMIN;
24+
25+
///@inheritdoc IStataTokenFactory
2126
ITransparentProxyFactory public immutable TRANSPARENT_PROXY_FACTORY;
27+
28+
///@inheritdoc IStataTokenFactory
2229
address public immutable STATA_TOKEN_IMPL;
2330

2431
mapping(address => address) internal _underlyingToStataToken;
@@ -50,19 +57,16 @@ contract StataTokenFactory is Initializable, IStataTokenFactory {
5057
if (reserveData.aTokenAddress == address(0))
5158
revert NotListedUnderlying(reserveData.aTokenAddress);
5259
bytes memory symbol = abi.encodePacked(
53-
'stat',
54-
IERC20Metadata(reserveData.aTokenAddress).symbol(),
55-
'v2'
60+
'w',
61+
IERC20Metadata(reserveData.aTokenAddress).symbol()
5662
);
5763
address stataToken = TRANSPARENT_PROXY_FACTORY.createDeterministic(
5864
STATA_TOKEN_IMPL,
59-
PROXY_ADMIN,
65+
ProxyAdmin(PROXY_ADMIN),
6066
abi.encodeWithSelector(
6167
StataTokenV2.initialize.selector,
6268
reserveData.aTokenAddress,
63-
string(
64-
abi.encodePacked('Static ', IERC20Metadata(reserveData.aTokenAddress).name(), ' v2')
65-
),
69+
string(abi.encodePacked('Wrapped ', IERC20Metadata(reserveData.aTokenAddress).name())),
6670
string(symbol)
6771
),
6872
bytes32(uint256(uint160(underlyings[i])))

src/contracts/extensions/stata-token/interfaces/IStataTokenFactory.sol

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,36 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.10;
33

4+
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
5+
import {IPool, IPoolAddressesProvider} from '../../../interfaces/IPool.sol';
6+
47
interface IStataTokenFactory {
58
error NotListedUnderlying(address underlying);
69

10+
/**
11+
* @notice The pool associated with the factory.
12+
* @return The pool address.
13+
*/
14+
function POOL() external view returns (IPool);
15+
16+
/**
17+
* @notice The proxy admin used for all tokens created via the factory.
18+
* @return The proxy admin address.
19+
*/
20+
function PROXY_ADMIN() external view returns (address);
21+
22+
/**
23+
* @notice The proxy factory used for all tokens created via the stata factory.
24+
* @return The proxy factory address.
25+
*/
26+
function TRANSPARENT_PROXY_FACTORY() external view returns (ITransparentProxyFactory);
27+
28+
/**
29+
* @notice The stata implementation used for all tokens created via the factory.
30+
* @return The implementation address.
31+
*/
32+
function STATA_TOKEN_IMPL() external view returns (address);
33+
734
/**
835
* @notice Creates new StataTokens
936
* @param underlyings the addresses of the underlyings to create.

src/deployments/contracts/procedures/AaveV3HelpersProcedureTwo.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
import '../../interfaces/IMarketReportTypes.sol';
5-
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
5+
import {ITransparentProxyFactory, ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';
66
import {TransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/TransparentProxyFactory.sol';
77
import {StataTokenV2} from '../../../contracts/extensions/stata-token/StataTokenV2.sol';
88
import {StataTokenFactory} from '../../../contracts/extensions/stata-token/StataTokenFactory.sol';
@@ -33,7 +33,7 @@ contract AaveV3HelpersProcedureTwo is IErrors {
3333
staticATokenReport.transparentProxyFactory
3434
).create(
3535
staticATokenReport.staticATokenFactoryImplementation,
36-
proxyAdmin,
36+
ProxyAdmin(proxyAdmin),
3737
abi.encodeWithSelector(StataTokenFactory.initialize.selector)
3838
);
3939

src/deployments/contracts/procedures/AaveV3SetupProcedure.sol

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
pragma solidity ^0.8.0;
33

44
import '../../interfaces/IMarketReportTypes.sol';
5-
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
5+
import {Ownable} from '../../../contracts/dependencies/openzeppelin/contracts/Ownable.sol';
66
import {ACLManager} from '../../../contracts/protocol/configuration/ACLManager.sol';
77
import {IPoolConfigurator} from '../../../contracts/interfaces/IPoolConfigurator.sol';
88
import {IPoolAddressesProvider} from '../../../contracts/interfaces/IPoolAddressesProvider.sol';
@@ -99,7 +99,7 @@ contract AaveV3SetupProcedure {
9999
poolAddressesProvider,
100100
providerId
101101
);
102-
IOwnable(poolAddressesProviderRegistry).transferOwnership(marketOwner);
102+
Ownable(poolAddressesProviderRegistry).transferOwnership(marketOwner);
103103
} else {
104104
poolAddressesProviderRegistry = providerRegistry;
105105
}
@@ -137,7 +137,7 @@ contract AaveV3SetupProcedure {
137137
IRewardsController(report.rewardsControllerProxy).EMISSION_MANAGER()
138138
);
139139
emissionManager.setRewardsController(report.rewardsControllerProxy);
140-
IOwnable(address(emissionManager)).transferOwnership(input.poolAdmin);
140+
Ownable(address(emissionManager)).transferOwnership(input.poolAdmin);
141141
} else {
142142
provider.setAddress(controllerId, input.rewardsControllerProxy);
143143
report.rewardsControllerProxy = provider.getAddress(controllerId);
@@ -199,15 +199,15 @@ contract AaveV3SetupProcedure {
199199
}
200200

201201
function _transferMarketOwnership(Roles memory roles, InitialReport memory report) internal {
202-
address addressesProviderOwner = IOwnable(report.poolAddressesProvider).owner();
203-
address marketOwner = IOwnable(report.poolAddressesProviderRegistry).owner();
202+
address addressesProviderOwner = Ownable(report.poolAddressesProvider).owner();
203+
address marketOwner = Ownable(report.poolAddressesProviderRegistry).owner();
204204

205205
if (addressesProviderOwner == address(this)) {
206-
IOwnable(report.poolAddressesProvider).transferOwnership(roles.marketOwner);
206+
Ownable(report.poolAddressesProvider).transferOwnership(roles.marketOwner);
207207
}
208208

209209
if (marketOwner == address(this)) {
210-
IOwnable(report.poolAddressesProviderRegistry).transferOwnership(roles.marketOwner);
210+
Ownable(report.poolAddressesProviderRegistry).transferOwnership(roles.marketOwner);
211211
}
212212
}
213213

src/deployments/contracts/procedures/AaveV3TreasuryProcedure.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ pragma solidity ^0.8.0;
33

44
import {ProxyAdmin} from 'solidity-utils/contracts/transparent-proxy/ProxyAdmin.sol';
55
import {TransparentUpgradeableProxy} from 'solidity-utils/contracts/transparent-proxy/TransparentUpgradeableProxy.sol';
6-
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
76
import {Collector} from '../../../contracts/treasury/Collector.sol';
87
import '../../interfaces/IMarketReportTypes.sol';
98

@@ -30,7 +29,7 @@ contract AaveV3TreasuryProcedure {
3029
treasuryReport.treasury = address(
3130
new TransparentUpgradeableProxy{salt: salt}(
3231
treasuryReport.treasuryImplementation,
33-
deployedProxyAdmin,
32+
ProxyAdmin(deployedProxyAdmin),
3433
abi.encodeWithSelector(
3534
treasuryImplementation.initialize.selector,
3635
address(treasuryOwner),
@@ -46,7 +45,7 @@ contract AaveV3TreasuryProcedure {
4645
treasuryReport.treasury = address(
4746
new TransparentUpgradeableProxy(
4847
treasuryReport.treasuryImplementation,
49-
deployedProxyAdmin,
48+
ProxyAdmin(deployedProxyAdmin),
5049
abi.encodeWithSelector(
5150
treasuryImplementation.initialize.selector,
5251
address(treasuryOwner),

src/deployments/interfaces/IProxyAdmin.sol

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/deployments/projects/aave-v3-batched/batches/AaveV3PeripheryBatch.sol

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,9 @@ import {AaveV3TreasuryProcedure} from '../../../contracts/procedures/AaveV3Treas
55
import {AaveV3OracleProcedure} from '../../../contracts/procedures/AaveV3OracleProcedure.sol';
66
import {AaveV3IncentiveProcedure} from '../../../contracts/procedures/AaveV3IncentiveProcedure.sol';
77
import {AaveV3DefaultRateStrategyProcedure} from '../../../contracts/procedures/AaveV3DefaultRateStrategyProcedure.sol';
8-
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
8+
import {Ownable} from '../../../../contracts/dependencies/openzeppelin/contracts/Ownable.sol';
99
import '../../../interfaces/IMarketReportTypes.sol';
1010
import {IRewardsController} from '../../../../contracts/rewards/interfaces/IRewardsController.sol';
11-
import {IOwnable} from 'solidity-utils/contracts/transparent-proxy/interfaces/IOwnable.sol';
1211
import {RevenueSplitter} from '../../../../contracts/treasury/RevenueSplitter.sol';
1312

1413
contract AaveV3PeripheryBatch is
@@ -25,8 +24,7 @@ contract AaveV3PeripheryBatch is
2524
address setupBatch
2625
) {
2726
if (config.proxyAdmin == address(0)) {
28-
_report.proxyAdmin = address(new ProxyAdmin{salt: config.salt}());
29-
IOwnable(_report.proxyAdmin).transferOwnership(poolAdmin);
27+
_report.proxyAdmin = address(new ProxyAdmin{salt: config.salt}(poolAdmin));
3028
} else {
3129
_report.proxyAdmin = config.proxyAdmin;
3230
}

tests/extensions/stata-token/StataTokenV2Getters.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ contract StataTokenV2GettersTest is BaseTest {
1616
}
1717

1818
function test_getters() public view {
19-
assertEq(stataTokenV2.name(), 'Static Aave Local WETH v2');
20-
assertEq(stataTokenV2.symbol(), 'stataLocWETHv2');
19+
assertEq(stataTokenV2.name(), 'Wrapped Aave Local WETH');
20+
assertEq(stataTokenV2.symbol(), 'waLocWETH');
2121

2222
address referenceAsset = stataTokenV2.getReferenceAsset();
2323
assertEq(referenceAsset, aToken);

0 commit comments

Comments
 (0)