Skip to content

Commit

Permalink
action as free level export
Browse files Browse the repository at this point in the history
  • Loading branch information
novaknole committed Sep 27, 2024
1 parent f9bfd50 commit 3a99c6b
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

pragma solidity ^0.8.8;

import {IExecutor} from "./IExecutor.sol";
import {IExecutor, Action} from "./IExecutor.sol";
import {flipBit, hasBit} from "../utils/math/BitMap.sol";

/// @notice Simple Executor that loops through actions and executes them.
/// @notice Simple Executor that loops through the actions and executes them.
/// @dev Reverts in case enough gas was not provided for the last action.
contract SimpleExecutor is IExecutor {
contract Executor is IExecutor {
/// @notice The internal constant storing the maximal action array length.
uint256 internal constant MAX_ACTIONS = 256;

Expand Down
20 changes: 10 additions & 10 deletions contracts/src/executors/IExecutor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ pragma solidity ^0.8.8;

import {IDAO} from "../dao/IDAO.sol";

/// @notice The action struct to be consumed by the DAO's `execute` function resulting in an external call.
/// @param to The address to call.
/// @param value The native token value to be sent with the call.
/// @param data The bytes-encoded function selector and calldata for the call.
struct Action {
address to;
uint256 value;
bytes data;
}

/// @title IDAO
/// @author Aragon X - 2022-2023
/// @notice The interface required for Executors within the Aragon App DAO framework.
/// @custom:security-contact [email protected]
interface IExecutor {
/// @notice The action struct to be consumed by the DAO's `execute` function resulting in an external call.
/// @param to The address to call.
/// @param value The native token value to be sent with the call.
/// @param data The bytes-encoded function selector and calldata for the call.
struct Action {
address to;
uint256 value;
bytes data;
}

/// @notice Emitted when a proposal is executed.
/// @param actor The address of the caller.
/// @param callId The ID of the call.
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/mocks/dao/DAOMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity ^0.8.8;

import {IDAO} from "../../dao/IDAO.sol";
import {IExecutor} from "../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../executors/IExecutor.sol";

/// @notice A mock DAO that anyone can set permissions in.
/// @dev DO NOT USE IN PRODUCTION!
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/mocks/plugin/CustomExecutorMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity ^0.8.8;

import {IDAO} from "../../dao/IDAO.sol";
import {IExecutor} from "../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../executors/IExecutor.sol";

/// @notice A mock DAO that anyone can set permissions in.
/// @dev DO NOT USE IN PRODUCTION!
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/mocks/plugin/PluginCloneableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.8;

import {PluginCloneable} from "../../plugin/PluginCloneable.sol";
import {IDAO} from "../../dao/IDAO.sol";
import {IExecutor} from "../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../executors/IExecutor.sol";

/// @notice A mock cloneable plugin to be deployed via the minimal proxy pattern.
/// v1.1 (Release 1, Build 1)
Expand All @@ -20,7 +20,7 @@ contract PluginCloneableMockBuild1 is PluginCloneable {

function execute(
uint256 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap
) external returns (bytes[] memory execResults, uint256 failureMap) {
(execResults, failureMap) = _execute(bytes32(_callId), _actions, _allowFailureMap);
Expand All @@ -29,7 +29,7 @@ contract PluginCloneableMockBuild1 is PluginCloneable {
function execute(
address _target,
uint256 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap,
Operation _op
) external returns (bytes[] memory execResults, uint256 failureMap) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/mocks/plugin/PluginMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.8;

import {Plugin} from "../../plugin/Plugin.sol";
import {IDAO} from "../../dao/IDAO.sol";
import {IExecutor} from "../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../executors/IExecutor.sol";

/// @notice A mock plugin to be deployed via the `new` keyword.
/// v1.1 (Release 1, Build 1)
Expand All @@ -18,7 +18,7 @@ contract PluginMockBuild1 is Plugin {

function execute(
uint256 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap
) external returns (bytes[] memory execResults, uint256 failureMap) {
(execResults, failureMap) = _execute(bytes32(_callId), _actions, _allowFailureMap);
Expand All @@ -27,7 +27,7 @@ contract PluginMockBuild1 is Plugin {
function execute(
address _target,
uint256 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap,
Operation _op
) external returns (bytes[] memory execResults, uint256 failureMap) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/mocks/plugin/PluginUUPSUpgradeableMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.8;

import {PluginUUPSUpgradeable} from "../../plugin/PluginUUPSUpgradeable.sol";
import {IDAO} from "../../dao/IDAO.sol";
import {IExecutor} from "../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../executors/IExecutor.sol";

/// @notice A mock upgradeable plugin to be deployed via the UUPS proxy pattern.
/// v1.1 (Release 1, Build 1)
Expand All @@ -20,7 +20,7 @@ contract PluginUUPSUpgradeableMockBuild1 is PluginUUPSUpgradeable {

function execute(
uint256 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap
) external returns (bytes[] memory execResults, uint256 failureMap) {
(execResults, failureMap) = _execute(bytes32(_callId), _actions, _allowFailureMap);
Expand All @@ -29,7 +29,7 @@ contract PluginUUPSUpgradeableMockBuild1 is PluginUUPSUpgradeable {
function execute(
address _target,
uint256 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap,
Operation _op
) external returns (bytes[] memory execResults, uint256 failureMap) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity ^0.8.8;

import {Proposal} from "../../../../plugin/extensions/proposal/Proposal.sol";
import {IExecutor} from "../../../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../../../executors/IExecutor.sol";

/// @notice A mock contract.
/// @dev DO NOT USE IN PRODUCTION!
Expand All @@ -14,7 +14,7 @@ contract ProposalMock is Proposal {
// solhint-disable no-empty-blocks
function createProposal(
bytes memory data,
IExecutor.Action[] memory actions,
Action[] memory actions,
uint64 startDate,
uint64 endDate,
bytes memory
Expand All @@ -23,7 +23,7 @@ contract ProposalMock is Proposal {
function canExecute(uint256 proposalId) external view returns (bool) {}

function createProposalId(
IExecutor.Action[] memory actions,
Action[] memory actions,
bytes memory metadata
) external view returns (uint256) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity ^0.8.8;

import {ProposalUpgradeable} from "../../../../plugin/extensions/proposal/ProposalUpgradeable.sol";
import {IExecutor} from "../../../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../../../executors/IExecutor.sol";

/// @notice A mock contract.
/// @dev DO NOT USE IN PRODUCTION!
Expand All @@ -14,7 +14,7 @@ contract ProposalUpgradeableMock is ProposalUpgradeable {
// solhint-disable no-empty-blocks
function createProposal(
bytes memory data,
IExecutor.Action[] memory actions,
Action[] memory actions,
uint64 startDate,
uint64 endDate,
bytes memory
Expand All @@ -23,7 +23,7 @@ contract ProposalUpgradeableMock is ProposalUpgradeable {
function canExecute(uint256 proposalId) external view returns (bool) {}

function createProposalId(
IExecutor.Action[] memory actions,
Action[] memory actions,
bytes memory metadata
) external view returns (uint256) {}

Expand Down
6 changes: 3 additions & 3 deletions contracts/src/plugin/Plugin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {ProtocolVersion} from "../utils/versioning/ProtocolVersion.sol";
import {DaoAuthorizable} from "../permission/auth/DaoAuthorizable.sol";
import {IDAO} from "../dao/IDAO.sol";
import {IPlugin} from "./IPlugin.sol";
import {IExecutor} from "../executors/IExecutor.sol";
import {IExecutor, Action} from "../executors/IExecutor.sol";

/// @title Plugin
/// @author Aragon X - 2022-2023
Expand Down Expand Up @@ -118,7 +118,7 @@ abstract contract Plugin is IPlugin, ERC165, DaoAuthorizable, ProtocolVersion {
/// @return failureMap address of the implementation contract.
function _execute(
bytes32 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap
) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
return
Expand All @@ -141,7 +141,7 @@ abstract contract Plugin is IPlugin, ERC165, DaoAuthorizable, ProtocolVersion {
function _execute(
address _target,
bytes32 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap,
Operation _op
) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/plugin/PluginCloneable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {ProtocolVersion} from "../utils/versioning/ProtocolVersion.sol";
import {DaoAuthorizableUpgradeable} from "../permission/auth/DaoAuthorizableUpgradeable.sol";
import {IDAO} from "../dao/IDAO.sol";
import {IPlugin} from "./IPlugin.sol";
import {IExecutor} from "../executors/IExecutor.sol";
import {IExecutor, Action} from "../executors/IExecutor.sol";

/// @title PluginCloneable
/// @author Aragon X - 2022-2023
Expand Down Expand Up @@ -133,7 +133,7 @@ abstract contract PluginCloneable is
/// @return failureMap address of the implementation contract.
function _execute(
bytes32 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap
) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
return
Expand All @@ -156,7 +156,7 @@ abstract contract PluginCloneable is
function _execute(
address _target,
bytes32 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap,
Operation _op
) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
Expand Down
6 changes: 3 additions & 3 deletions contracts/src/plugin/PluginUUPSUpgradeable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {ProtocolVersion} from "../utils/versioning/ProtocolVersion.sol";
import {DaoAuthorizableUpgradeable} from "../permission/auth/DaoAuthorizableUpgradeable.sol";
import {IPlugin} from "./IPlugin.sol";
import {IDAO} from "../dao/IDAO.sol";
import {IExecutor} from "../executors/IExecutor.sol";
import {IExecutor, Action} from "../executors/IExecutor.sol";

/// @title PluginUUPSUpgradeable
/// @author Aragon X - 2022-2023
Expand Down Expand Up @@ -148,7 +148,7 @@ abstract contract PluginUUPSUpgradeable is
/// @return failureMap address of the implementation contract.
function _execute(
bytes32 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap
) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
return
Expand All @@ -171,7 +171,7 @@ abstract contract PluginUUPSUpgradeable is
function _execute(
address _target,
bytes32 _callId,
IExecutor.Action[] memory _actions,
Action[] memory _actions,
uint256 _allowFailureMap,
Operation _op
) internal virtual returns (bytes[] memory execResults, uint256 failureMap) {
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/plugin/extensions/proposal/IProposal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity ^0.8.8;

import {IDAO} from "../../../dao/IDAO.sol";
import {IExecutor} from "../../../executors/IExecutor.sol";
import {IExecutor, Action} from "../../../executors/IExecutor.sol";

/// @title IProposal
/// @author Aragon X - 2022-2023
Expand All @@ -24,7 +24,7 @@ interface IProposal {
uint64 startDate,
uint64 endDate,
bytes metadata,
IExecutor.Action[] actions,
Action[] actions,
uint256 allowFailureMap
);

Expand All @@ -41,7 +41,7 @@ interface IProposal {
/// @return proposalId The id of the proposal.
function createProposal(
bytes memory metadata,
IExecutor.Action[] memory actions,
Action[] memory actions,
uint64 startDate,
uint64 endDate,
bytes memory data
Expand All @@ -57,7 +57,7 @@ interface IProposal {
/// @param metadata The custom metadata that is passed when creating a proposal.
/// @return proposalId The id of the proposal.
function createProposalId(
IExecutor.Action[] memory actions,
Action[] memory actions,
bytes memory metadata
) external view returns (uint256);

Expand Down

0 comments on commit 3a99c6b

Please sign in to comment.