Skip to content

Commit

Permalink
move to proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Sep 27, 2024
1 parent f4944e3 commit d86d779
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
16 changes: 4 additions & 12 deletions packages/contracts/src/Admin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IMembership} from "@aragon/osx-commons-contracts/src/plugin/extensions/m

// solhint-disable-next-line max-line-length
import {ProposalUpgradeable} from "@aragon/osx-commons-contracts/src/plugin/extensions/proposal/ProposalUpgradeable.sol";
import {PluginUUPSUpgradeable} from "@aragon/osx-commons-contracts/src/plugin/PluginUUPSUpgradeable.sol";
import {PluginCloneable} from "@aragon/osx-commons-contracts/src/plugin/PluginCloneable.sol";
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {IProposal} from "@aragon/osx-commons-contracts/src/plugin/extensions/proposal/IProposal.sol";
import {IExecutor, Action} from "@aragon/osx-commons-contracts/src/executors/IExecutor.sol";

Check warning on line 14 in packages/contracts/src/Admin.sol

View workflow job for this annotation

GitHub Actions / checks

imported name IExecutor is not used

Check warning on line 14 in packages/contracts/src/Admin.sol

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

imported name IExecutor is not used

Check warning on line 14 in packages/contracts/src/Admin.sol

View workflow job for this annotation

GitHub Actions / formatting-linting / checks

imported name IExecutor is not used
Expand All @@ -18,7 +18,7 @@ import {IExecutor, Action} from "@aragon/osx-commons-contracts/src/executors/IEx
/// @notice The admin governance plugin giving execution permission on the DAO to a single address.
/// @dev v1.2 (Release 1, Build 2)
/// @custom:security-contact [email protected]
contract Admin is IMembership, PluginUUPSUpgradeable, ProposalUpgradeable {
contract Admin is IMembership, PluginCloneable, ProposalUpgradeable {
using SafeCastUpgradeable for uint256;

/// @notice The [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID of the contract.
Expand All @@ -34,7 +34,7 @@ contract Admin is IMembership, PluginUUPSUpgradeable, ProposalUpgradeable {
/// @param _dao The associated DAO.
/// @dev This method is required to support [ERC-1167](https://eips.ethereum.org/EIPS/eip-1167).
function initialize(IDAO _dao, TargetConfig calldata _targetConfig) external initializer {
__PluginUUPSUpgradeable_init(_dao);
__PluginCloneable_init(_dao);

_setTargetConfig(_targetConfig);

Expand All @@ -46,7 +46,7 @@ contract Admin is IMembership, PluginUUPSUpgradeable, ProposalUpgradeable {
/// @return Returns `true` if the interface is supported.
function supportsInterface(
bytes4 _interfaceId
) public view override(PluginUUPSUpgradeable, ProposalUpgradeable) returns (bool) {
) public view override(PluginCloneable, ProposalUpgradeable) returns (bool) {
return
_interfaceId == ADMIN_INTERFACE_ID ||
_interfaceId == type(IMembership).interfaceId ||
Expand Down Expand Up @@ -149,12 +149,4 @@ contract Admin is IMembership, PluginUUPSUpgradeable, ProposalUpgradeable {

emit ProposalExecuted(proposalId);
}

/// @notice Internal method authorizing the upgrade of the contract via the [upgradeability mechanism for UUPS proxies](https://docs.openzeppelin.com/contracts/4.x/api/proxy#UUPSUpgradeable) (see [ERC-1822](https://eips.ethereum.org/EIPS/eip-1822)).
/// @dev The Upgradeability disabled.
function _authorizeUpgrade(
address
) internal virtual override auth(UPGRADE_PLUGIN_PERMISSION_ID) {
revert NotAllowedOperation();
}
}
8 changes: 4 additions & 4 deletions packages/contracts/src/AdminSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {PluginSetup} from "@aragon/osx-commons-contracts/src/plugin/setup/Plugin
import {PermissionLib} from "@aragon/osx-commons-contracts/src/permission/PermissionLib.sol";
import {ProxyLib} from "@aragon/osx-commons-contracts/src/utils/deployment/ProxyLib.sol";
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol";
import {PluginUUPSUpgradeable} from "@aragon/osx-commons-contracts/src/plugin/PluginUUPSUpgradeable.sol";
import {PluginCloneable} from "@aragon/osx-commons-contracts/src/plugin/PluginCloneable.sol";

import {Admin} from "./Admin.sol";

Expand Down Expand Up @@ -36,9 +36,9 @@ contract AdminSetup is PluginSetup {
bytes calldata _data
) external returns (address plugin, PreparedSetupData memory preparedSetupData) {
// Decode `_data` to extract the params needed for cloning and initializing the `Admin` plugin.
(address admin, PluginUUPSUpgradeable.TargetConfig memory targetConfig) = abi.decode(
(address admin, PluginCloneable.TargetConfig memory targetConfig) = abi.decode(
_data,
(address, PluginUUPSUpgradeable.TargetConfig)
(address, PluginCloneable.TargetConfig)
);

if (admin == address(0)) {
Expand All @@ -47,7 +47,7 @@ contract AdminSetup is PluginSetup {

// Clone and initialize the plugin contract.
bytes memory initData = abi.encodeCall(Admin.initialize, (IDAO(_dao), targetConfig));
plugin = IMPLEMENTATION.deployUUPSProxy(initData);
plugin = IMPLEMENTATION.deployMinimalProxy(initData);

// Prepare permissions
PermissionLib.MultiTargetPermission[]
Expand Down

0 comments on commit d86d779

Please sign in to comment.