-
Notifications
You must be signed in to change notification settings - Fork 19
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
VAL-118 Make PoolAccessControl and PoolAdminAccessControl upgradeable #137
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f6799c8
PoolAccessControl tests
4a8021a
Add more tests guarding against unauthorized upgrades
123e268
Add tests for base classes.
7feccd4
Cont.
ede21db
Lint
795c368
Fix build warnings. Update VeriteAccessControl mock to be upgradeable
6dd956a
Cleanups
9f63a3d
Remove comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,12 +17,12 @@ import {Math} from "@openzeppelin/contracts/utils/math/Math.sol"; | |
import "./libraries/PoolLib.sol"; | ||
import "./FeeVault.sol"; | ||
import "./FirstLossVault.sol"; | ||
import "./upgrades/interfaces/IBeaconImplementation.sol"; | ||
import "./upgrades/BeaconImplementation.sol"; | ||
|
||
/** | ||
* @title Pool | ||
*/ | ||
contract Pool is IPool, ERC20Upgradeable, IBeaconImplementation { | ||
contract Pool is IPool, ERC20Upgradeable, BeaconImplementation { | ||
using SafeERC20Upgradeable for IERC20Upgradeable; | ||
using SafeMath for uint256; | ||
using EnumerableSet for EnumerableSet.AddressSet; | ||
|
@@ -118,7 +118,7 @@ contract Pool is IPool, ERC20Upgradeable, IBeaconImplementation { | |
* @dev Initializer for Pool | ||
* @param liquidityAsset asset held by the poo | ||
* @param poolAdmin admin of the pool | ||
* @param serviceConfiguration address of global service configuration | ||
* @param serviceConfiguration_ address of global service configuration | ||
* @param withdrawControllerFactory factory address of the withdraw controller | ||
* @param poolSettings configurable settings for the pool | ||
* @param tokenName Name used for issued pool tokens | ||
|
@@ -127,15 +127,15 @@ contract Pool is IPool, ERC20Upgradeable, IBeaconImplementation { | |
function initialize( | ||
address liquidityAsset, | ||
address poolAdmin, | ||
address serviceConfiguration, | ||
address serviceConfiguration_, | ||
address withdrawControllerFactory, | ||
address poolControllerFactory, | ||
IPoolConfigurableSettings memory poolSettings, | ||
string memory tokenName, | ||
string memory tokenSymbol | ||
) public initializer { | ||
__ERC20_init(tokenName, tokenSymbol); | ||
_serviceConfiguration = IServiceConfiguration(serviceConfiguration); | ||
_serviceConfiguration = IServiceConfiguration(serviceConfiguration_); | ||
_liquidityAsset = IERC20Upgradeable(liquidityAsset); | ||
_feeVault = new FeeVault(address(this)); | ||
|
||
|
@@ -149,7 +149,7 @@ contract Pool is IPool, ERC20Upgradeable, IBeaconImplementation { | |
poolController = IPoolController( | ||
IPoolControllerFactory(poolControllerFactory).createController( | ||
address(this), | ||
serviceConfiguration, | ||
serviceConfiguration_, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same - shadowing warning |
||
poolAdmin, | ||
liquidityAsset, | ||
poolSettings | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.16; | ||
|
||
import "../../upgrades/BeaconImplementation.sol"; | ||
|
||
contract MockBeaconImplementation is BeaconImplementation { | ||
function foo() external pure virtual returns (string memory) { | ||
return "bar"; | ||
} | ||
|
||
function initialize() public initializer {} | ||
} | ||
|
||
contract MockBeaconImplementationV2 is MockBeaconImplementation { | ||
function foo() external pure override returns (string memory) { | ||
return "baz"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.16; | ||
|
||
import "../../upgrades/BeaconProxyFactory.sol"; | ||
import "../../interfaces/IServiceConfiguration.sol"; | ||
import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; | ||
import "./MockBeaconImplementation.sol"; | ||
|
||
contract MockBeaconProxyFactory is BeaconProxyFactory { | ||
event Created(address proxy); | ||
|
||
constructor(address serviceConfig) { | ||
_serviceConfiguration = IServiceConfiguration(serviceConfig); | ||
} | ||
|
||
function create() external returns (address) { | ||
BeaconProxy proxy = new BeaconProxy( | ||
address(this), | ||
abi.encodeWithSelector(MockBeaconImplementation.initialize.selector) | ||
); | ||
emit Created(address(proxy)); | ||
return address(proxy); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.16; | ||
|
||
import "../../permissioned/PoolAccessControl.sol"; | ||
import "./MockUpgrade.sol"; | ||
|
||
contract PoolAccessControlMockV2 is PoolAccessControl, MockUpgrade {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.16; | ||
|
||
import "../../permissioned/PoolAdminAccessControl.sol"; | ||
import "./MockUpgrade.sol"; | ||
|
||
contract PoolAdminAccessControlMockV2 is PoolAdminAccessControl, MockUpgrade {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable shadowing fix