-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
deploying executor and always true condition
- Loading branch information
Showing
11 changed files
with
139 additions
and
16 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
packages/contracts/deploy/new/10_framework/52_global_executor.ts
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,22 @@ | ||
import executorArtifact from '../../../artifacts/@aragon/osx-commons-contracts/src/executors/Executor.sol/Executor.json'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, ethers} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
await deploy('GlobalExecutor', { | ||
contract: executorArtifact, | ||
from: deployer.address, | ||
args: [], | ||
log: true, | ||
}); | ||
|
||
hre.aragonToVerifyContracts.push({ | ||
...(await deployments.get('GlobalExecutor')), | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['New', 'GlobalExecutor']; |
22 changes: 22 additions & 0 deletions
22
packages/contracts/deploy/new/10_framework/53_always_true_condition.ts
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,22 @@ | ||
import alwaysTrueConditionArtifact from '../../../artifacts/@aragon/osx-commons-contracts/src/permission/condition/extensions/AlwaysTrueCondition.sol/AlwaysTrueCondition.json'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, ethers} = hre; | ||
const {deploy} = deployments; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
await deploy('AlwaysTrueCondition', { | ||
contract: alwaysTrueConditionArtifact, | ||
from: deployer.address, | ||
args: [], | ||
log: true, | ||
}); | ||
|
||
hre.aragonToVerifyContracts.push({ | ||
...(await deployments.get('AlwaysTrueCondition')), | ||
}); | ||
}; | ||
export default func; | ||
func.tags = ['New', 'AlwaysTrueCondition']; |
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 |
---|---|---|
|
@@ -17,14 +17,16 @@ import {IProtocolVersion} from "@aragon/osx-commons-contracts/src/utils/versioni | |
import {ProtocolVersion} from "@aragon/osx-commons-contracts/src/utils/versioning/ProtocolVersion.sol"; | ||
import {VersionComparisonLib} from "@aragon/osx-commons-contracts/src/utils/versioning/VersionComparisonLib.sol"; | ||
import {hasBit, flipBit} from "@aragon/osx-commons-contracts/src/utils/math/BitMap.sol"; | ||
import {Action} from "@aragon/osx-commons-contracts/src/executors/Executor.sol"; | ||
import {IExecutor} from "@aragon/osx-commons-contracts/src/executors/IExecutor.sol"; | ||
import {IDAO} from "@aragon/osx-commons-contracts/src/dao/IDAO.sol"; | ||
|
||
import {PermissionManager} from "../permission/PermissionManager.sol"; | ||
import {CallbackHandler} from "../utils/CallbackHandler.sol"; | ||
import {IEIP4824} from "./IEIP4824.sol"; | ||
|
||
/// @title DAO | ||
/// @author Aragon X - 2021-2023 | ||
/// @author Aragon X - 2021-2024 | ||
/// @notice This contract is the entry point to the Aragon DAO framework and provides our users a simple and easy to use public interface. | ||
/// @dev Public API of the Aragon DAO framework. | ||
/// @custom:security-contact [email protected] | ||
|
@@ -34,6 +36,7 @@ contract DAO is | |
IERC1271, | ||
ERC165StorageUpgradeable, | ||
IDAO, | ||
IExecutor, | ||
UUPSUpgradeable, | ||
ProtocolVersion, | ||
PermissionManager, | ||
|
@@ -117,6 +120,9 @@ contract DAO is | |
/// @notice Thrown when a function is removed but left to not corrupt the interface ID. | ||
error FunctionRemoved(); | ||
|
||
/// @notice Thrown when initialize is called after it has already been executed. | ||
error AlreadyInitialized(); | ||
|
||
/// @notice Emitted when a new DAO URI is set. | ||
/// @param daoURI The new URI. | ||
event NewURI(string daoURI); | ||
|
@@ -134,6 +140,15 @@ contract DAO is | |
_reentrancyStatus = _NOT_ENTERED; | ||
} | ||
|
||
/// @notice This ensures that the initialize function cannot be called during the upgrade process. | ||
modifier onlyCallAtInitialization() { | ||
if (_getInitializedVersion() != 0) { | ||
revert AlreadyInitialized(); | ||
} | ||
|
||
_; | ||
} | ||
|
||
/// @notice Disables the initializers on the implementation contract to prevent it from being left uninitialized. | ||
/// @custom:oz-upgrades-unsafe-allow constructor | ||
constructor() { | ||
|
@@ -155,10 +170,14 @@ contract DAO is | |
address _initialOwner, | ||
address _trustedForwarder, | ||
string calldata daoURI_ | ||
) external reinitializer(3) { | ||
) external onlyCallAtInitialization reinitializer(3) { | ||
_reentrancyStatus = _NOT_ENTERED; // added in v1.3.0 | ||
|
||
// In addition to the current interfaceId, also support previous version of the interfaceId. | ||
_registerInterface(type(IDAO).interfaceId ^ IExecutor.execute.selector); | ||
|
||
_registerInterface(type(IDAO).interfaceId); | ||
_registerInterface(type(IExecutor).interfaceId); | ||
_registerInterface(type(IERC1271).interfaceId); | ||
_registerInterface(type(IEIP4824).interfaceId); | ||
_registerInterface(type(IProtocolVersion).interfaceId); // added in v1.3.0 | ||
|
@@ -198,6 +217,9 @@ contract DAO is | |
_who: address(this), | ||
_permissionId: keccak256("SET_SIGNATURE_VALIDATOR_PERMISSION") | ||
}); | ||
|
||
_registerInterface(type(IDAO).interfaceId); | ||
_registerInterface(type(IExecutor).interfaceId); | ||
} | ||
} | ||
|
||
|
@@ -246,7 +268,7 @@ contract DAO is | |
_setMetadata(_metadata); | ||
} | ||
|
||
/// @inheritdoc IDAO | ||
/// @inheritdoc IExecutor | ||
function execute( | ||
bytes32 _callId, | ||
Action[] calldata _actions, | ||
|
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
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,7 +17,7 @@ | |
dependencies: | ||
tslib "^2.6.2" | ||
|
||
"@aragon/[email protected]": | ||
"@aragon/osx-commons-contracts@^1.4.0-alpha.5": | ||
version "1.4.0-alpha.5" | ||
resolved "https://registry.yarnpkg.com/@aragon/osx-commons-contracts/-/osx-commons-contracts-1.4.0-alpha.5.tgz#37a28085677c21216628ba0a05f5fe09489eb71c" | ||
integrity sha512-F2JWWxmUNmiJsaXcTDyd6F2GUIgnc313vvWTp/cSmSVkccT2pfMleWqxIi4LIodX3ueFUYfE02rLj8Gjp1jljA== | ||
|