Skip to content

[hebao1.2] update UpgraderModule.sol #2010

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

Merged
merged 1 commit into from
Nov 8, 2020
Merged
Changes from all 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
21 changes: 0 additions & 21 deletions packages/hebao_v1/contracts/modules/upgrade/UpgraderModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import "./SecurityStore_1_1_6.sol";
contract UpgraderModule is BaseModule {
ControllerImpl private immutable controller_;

address public immutable walletImplementation;
address[] public modulesToRemove;
address[] public modulesToAdd;

Expand All @@ -27,7 +26,6 @@ contract UpgraderModule is BaseModule {

constructor(
ControllerImpl _controller,
address _walletImplementation,
address[] memory _modulesToAdd,
address[] memory _modulesToRemove,
address _oldSecurityStore,
Expand All @@ -36,28 +34,13 @@ contract UpgraderModule is BaseModule {
BaseModule(_controller)
{
controller_ = _controller;
walletImplementation = _walletImplementation;
modulesToAdd = _modulesToAdd;
modulesToRemove = _modulesToRemove;

oldSecurityStore = SecurityStore_1_1_6(_oldSecurityStore);
newSecurityStore = SecurityStore(_newSecurityStore);
}

function upgradeWalletImplementation(address payable wallet)
external
{
require(msg.sender == address(this), "NOT_ALLOWED");

if (walletImplementation != OwnedUpgradeabilityProxy(wallet).implementation()) {
bytes memory txData = abi.encodeWithSelector(
OwnedUpgradeabilityProxy.upgradeTo.selector,
walletImplementation
);
transactCall(wallet, wallet, 0, txData);
}
}

function migrateSecurityStore(address wallet)
internal
{
Expand Down Expand Up @@ -90,10 +73,6 @@ contract UpgraderModule is BaseModule {
{
address payable wallet = msg.sender;

if (walletImplementation != address(0)) {
try UpgraderModule(address(this)).upgradeWalletImplementation(wallet) {} catch {}
}

BaseWallet w = BaseWallet(wallet);

// Upgrade the controller if different
Expand Down