Skip to content

Commit

Permalink
Simplify deployAndUpgradeTo() and delete unused ITransparentUpgradeab…
Browse files Browse the repository at this point in the history
…leProxy.sol
  • Loading branch information
kevincheng96 committed Mar 15, 2022
1 parent 6c47ac2 commit f8518a1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
17 changes: 0 additions & 17 deletions contracts/interfaces/ITransparentUpgradeableProxy.sol

This file was deleted.

1 change: 0 additions & 1 deletion contracts/test/Timelock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ contract Timelock {
callData = abi.encodePacked(bytes4(keccak256(bytes(signatures[i]))), data[i]);
}

// solium-disable-next-line security/no-call-value
(bool success, bytes memory returnData) = targets[i].call{value: values[i]}(callData);
require(success, "failed to call");
}
Expand Down
11 changes: 6 additions & 5 deletions contracts/vendored/CometProxyAdmin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ pragma solidity ^0.8.11;

import "../vendor/proxy/ProxyAdmin.sol";

interface Deployable {
function deploy() external returns (address);
}

contract CometProxyAdmin is ProxyAdmin {
/**
* @dev Deploy a new Comet and upgrade the implementation of the Comet proxy.
Expand All @@ -11,11 +15,8 @@ contract CometProxyAdmin is ProxyAdmin {
*
* - This contract must be the admin of `CometProxy`.
*/
function deployAndUpgradeTo(TransparentUpgradeableProxy configuratorProxy, TransparentUpgradeableProxy cometProxy) public virtual onlyOwner {
(bool success, bytes memory returnData) = address(configuratorProxy).call(abi.encodeWithSignature("deploy()"));
require(success, "failed to deploy new contract");

(address newCometImpl) = abi.decode(returnData, (address));
function deployAndUpgradeTo(Deployable configuratorProxy, TransparentUpgradeableProxy cometProxy) public virtual onlyOwner {
address newCometImpl = configuratorProxy.deploy();
upgrade(cometProxy, newCometImpl);
}
}

0 comments on commit f8518a1

Please sign in to comment.