creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "lib/ens-reverse-claimable/src/ENSReverseClaimable.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract ENSReverseClaimable {\n    /// @notice ENS reverse name resolution is claimable by the owner of the contract.\n    function owner() external pure virtual returns (address) {\n        return 0x2309762aAcA0a8F689463a42c0A6A84BE3A7ea51; // plopmenz.eth\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.20;\n\nimport {IERC165} from \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
      },
      "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.20;\n\n/**\n * @dev Interface of the ERC-165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[ERC].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
      },
      "lib/trustless-management/lib/osx-commons/contracts/src/dao/IDAO.sol": {
        "content": "// SPDX-License-Identifier: AGPL-3.0-or-later\n\npragma solidity ^0.8.8;\n\n/// @title IDAO\n/// @author Aragon Association - 2022-2023\n/// @notice The interface required for DAOs within the Aragon App DAO framework.\n/// @custom:security-contact sirt@aragon.org\ninterface IDAO {\n    /// @notice The action struct to be consumed by the DAO's `execute` function resulting in an external call.\n    /// @param to The address to call.\n    /// @param value The native token value to be sent with the call.\n    /// @param data The bytes-encoded function selector and calldata for the call.\n    struct Action {\n        address to;\n        uint256 value;\n        bytes data;\n    }\n\n    /// @notice Checks if an address has permission on a contract via a permission identifier and considers if `ANY_ADDRESS` was used in the granting process.\n    /// @param _where The address of the contract.\n    /// @param _who The address of a EOA or contract to give the permissions.\n    /// @param _permissionId The permission identifier.\n    /// @param _data The optional data passed to the `PermissionCondition` registered.\n    /// @return Returns true if the address has permission, false if not.\n    function hasPermission(\n        address _where,\n        address _who,\n        bytes32 _permissionId,\n        bytes memory _data\n    ) external view returns (bool);\n\n    /// @notice Updates the DAO metadata (e.g., an IPFS hash).\n    /// @param _metadata The IPFS hash of the new metadata object.\n    function setMetadata(bytes calldata _metadata) external;\n\n    /// @notice Emitted when the DAO metadata is updated.\n    /// @param metadata The IPFS hash of the new metadata object.\n    event MetadataSet(bytes metadata);\n\n    /// @notice Executes a list of actions. If a zero allow-failure map is provided, a failing action reverts the entire execution. If a non-zero allow-failure map is provided, allowed actions can fail without the entire call being reverted.\n    /// @param _callId The ID of the call. The definition of the value of `callId` is up to the calling contract and can be used, e.g., as a nonce.\n    /// @param _actions The array of actions.\n    /// @param _allowFailureMap A bitmap allowing execution to succeed, even if individual actions might revert. If the bit at index `i` is 1, the execution succeeds even if the `i`th action reverts. A failure map value of 0 requires every action to not revert.\n    /// @return The array of results obtained from the executed actions in `bytes`.\n    /// @return The resulting failure map containing the actions have actually failed.\n    function execute(\n        bytes32 _callId,\n        Action[] memory _actions,\n        uint256 _allowFailureMap\n    ) external returns (bytes[] memory, uint256);\n\n    /// @notice Emitted when a proposal is executed.\n    /// @param actor The address of the caller.\n    /// @param callId The ID of the call.\n    /// @param actions The array of actions executed.\n    /// @param allowFailureMap The allow failure map encoding which actions are allowed to fail.\n    /// @param failureMap The failure map encoding which actions have failed.\n    /// @param execResults The array with the results of the executed actions.\n    /// @dev The value of `callId` is defined by the component/contract calling the execute function. A `Plugin` implementation can use it, for example, as a nonce.\n    event Executed(\n        address indexed actor,\n        bytes32 callId,\n        Action[] actions,\n        uint256 allowFailureMap,\n        uint256 failureMap,\n        bytes[] execResults\n    );\n\n    /// @notice Emitted when a standard callback is registered.\n    /// @param interfaceId The ID of the interface.\n    /// @param callbackSelector The selector of the callback function.\n    /// @param magicNumber The magic number to be registered for the callback function selector.\n    event StandardCallbackRegistered(\n        bytes4 interfaceId,\n        bytes4 callbackSelector,\n        bytes4 magicNumber\n    );\n\n    /// @notice Deposits (native) tokens to the DAO contract with a reference string.\n    /// @param _token The address of the token or address(0) in case of the native token.\n    /// @param _amount The amount of tokens to deposit.\n    /// @param _reference The reference describing the deposit reason.\n    function deposit(address _token, uint256 _amount, string calldata _reference) external payable;\n\n    /// @notice Emitted when a token deposit has been made to the DAO.\n    /// @param sender The address of the sender.\n    /// @param token The address of the deposited token.\n    /// @param amount The amount of tokens deposited.\n    /// @param _reference The reference describing the deposit reason.\n    event Deposited(\n        address indexed sender,\n        address indexed token,\n        uint256 amount,\n        string _reference\n    );\n\n    /// @notice Emitted when a native token deposit has been made to the DAO.\n    /// @dev This event is intended to be emitted in the `receive` function and is therefore bound by the gas limitations for `send`/`transfer` calls introduced by [ERC-2929](https://eips.ethereum.org/EIPS/eip-2929).\n    /// @param sender The address of the sender.\n    /// @param amount The amount of native tokens deposited.\n    event NativeTokenDeposited(address sender, uint256 amount);\n\n    /// @notice Setter for the trusted forwarder verifying the meta transaction.\n    /// @param _trustedForwarder The trusted forwarder address.\n    function setTrustedForwarder(address _trustedForwarder) external;\n\n    /// @notice Getter for the trusted forwarder verifying the meta transaction.\n    /// @return The trusted forwarder address.\n    function getTrustedForwarder() external view returns (address);\n\n    /// @notice Emitted when a new TrustedForwarder is set on the DAO.\n    /// @param forwarder the new forwarder address.\n    event TrustedForwarderSet(address forwarder);\n\n    /// @notice Checks whether a signature is valid for a provided hash according to [ERC-1271](https://eips.ethereum.org/EIPS/eip-1271).\n    /// @param _hash The hash of the data to be signed.\n    /// @param _signature The signature byte array associated with `_hash`.\n    /// @return Returns the `bytes4` magic value `0x1626ba7e` if the signature is valid and `0xffffffff` if not.\n    function isValidSignature(bytes32 _hash, bytes memory _signature) external returns (bytes4);\n\n    /// @notice Registers an ERC standard having a callback by registering its [ERC-165](https://eips.ethereum.org/EIPS/eip-165) interface ID and callback function signature.\n    /// @param _interfaceId The ID of the interface.\n    /// @param _callbackSelector The selector of the callback function.\n    /// @param _magicNumber The magic number to be registered for the function signature.\n    function registerStandardCallback(\n        bytes4 _interfaceId,\n        bytes4 _callbackSelector,\n        bytes4 _magicNumber\n    ) external;\n\n    /// @notice Removed function being left here to not corrupt the IDAO interface ID. Any call will revert.\n    /// @dev Introduced in v1.0.0. Removed in v1.4.0.\n    function setSignatureValidator(address) external;\n}\n"
      },
      "lib/trustless-management/src/IDAOExtensionWithAdmin.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IDAO} from \"../lib/osx-commons/contracts/src/dao/IDAO.sol\";\n\ninterface IDAOExtensionWithAdmin {\n    error SenderIsNotAdmin();\n\n    event AdminSet(IDAO indexed dao, address admin);\n\n    /// @notice Registers or updates the admin of a DAO. The admin has the permission to change permissions.\n    /// @param _dao The DAO this admin will control.\n    /// @param _admin The address that will control the DAO.\n    /// @dev If no admin is set, this can only be called by the DAO itself. When an admin is set, only the existing admin can update.\n    function setAdmin(IDAO _dao, address _admin) external;\n}\n"
      },
      "lib/trustless-management/src/IDAOManager.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IDAOExtensionWithAdmin, IDAO} from \"./IDAOExtensionWithAdmin.sol\";\n\ninterface IDAOManager is IDAOExtensionWithAdmin {\n    error AccessDenied();\n\n    event Execution(\n        IDAO indexed dao,\n        uint256 indexed role,\n        address indexed sender,\n        IDAO.Action[] actions,\n        bytes[] returnValues,\n        uint256 failureMap\n    );\n\n    /// @notice Executes a list of actions as the DAO.\n    /// @param _dao Which DAO should execute the actions.\n    /// @param _role The role to use for validation if execution is allowed.\n    /// @param _actions The actions to execute.\n    /// @param _failureMap Which actions are allowed to fail without reverting the whole transaction.\n    /// @dev Only a single role means that a user satisfies multiple roles they might need to split their actions into multiple batches (one per role).\n    function asDAO(IDAO _dao, uint256 _role, IDAO.Action[] calldata _actions, uint256 _failureMap)\n        external\n        returns (bytes[] memory returnValues, uint256 failureMap);\n}\n"
      },
      "src/IPessimisticActions.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ITrustlessActions} from \"./ITrustlessActions.sol\";\n\ninterface IPessimisticActions is ITrustlessActions {\n    error SenderNotDAO();\n}\n"
      },
      "src/ITrustlessActions.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {IDAOManager, IDAO} from \"../lib/trustless-management/src/IDAOManager.sol\";\n\ninterface ITrustlessActions {\n    error RequestDoesNotExist();\n    error RequestAlreadyExecuted();\n\n    event ActionCreated(\n        uint32 indexed id,\n        IDAO indexed dao,\n        IDAOManager manager,\n        uint256 role,\n        IDAO.Action[] actions,\n        uint256 failureMap,\n        string metadata\n    );\n    event ActionExecuted(\n        uint32 indexed id, IDAO indexed dao, address indexed executor, bytes[] returnValues, uint256 failureMap\n    );\n\n    /// @notice A container for multiple requests.\n    /// @param requestCount How many proposed actions have been created.\n    /// @param getRequest The proposed actions to be executed.\n    struct ActionRequests {\n        uint32 requestCount;\n        mapping(uint32 id => ActionRequest request) getRequest;\n    }\n\n    /// @notice A container for all info related to an execute action request.\n    /// @param executed If the action has been executed.\n    /// @param manager The management contract to use for the execution.\n    /// @param role The role to use for the execution.\n    /// @param actions The actions to execute.\n    /// @param failureMap Which actions are allowed to fail without reverting the transaction.\n    struct ActionRequest {\n        bool executed;\n        IDAOManager manager;\n        uint256 role;\n        IDAO.Action[] actions;\n        uint256 failureMap;\n    }\n\n    /// @notice Gets a certain action request.\n    /// @param _dao The DAO that has the request.\n    /// @param _id The id of the request.\n    function getAction(IDAO _dao, uint32 _id) external view returns (ActionRequest memory request);\n\n    /// @notice Creates a request to execute certain actions.\n    /// @param _manager The management contract to use for performing the actions.\n    /// @param _role The role of the management contract to use for performing the actions.\n    /// @param _actions The actions that are proposed to be executed.\n    /// @param _failureMap The actions that are allowed to be revert.\n    /// @param _metadata Additional info from the creator.\n    /// @dev The sender should be the DAO (utilizing a management solution).\n    function createAction(\n        IDAOManager _manager,\n        uint256 _role,\n        IDAO.Action[] calldata _actions,\n        uint256 _failureMap,\n        string calldata _metadata\n    ) external returns (uint32 id);\n\n    /// @notice Executes a certain action request.\n    /// @param _dao The DAO that has the request.\n    /// @param _id The id of the request.\n    /// @dev This is only possible if the request has not been executed yet and the conditions of the TrustlessActions implementation are met.\n    function executeAction(IDAO _dao, uint32 _id) external returns (bytes[] memory returnValues, uint256 failureMap);\n}\n"
      },
      "src/PessimisticActions.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {TrustlessActions, IDAO, IDAOManager} from \"./TrustlessActions.sol\";\nimport {IPessimisticActions} from \"./IPessimisticActions.sol\";\n\ncontract PessimisticActions is TrustlessActions, IPessimisticActions {\n    /// @inheritdoc TrustlessActions\n    function _ensureRequestExecutable(IDAO _dao, uint32) internal view override {\n        if (msg.sender != address(_dao)) {\n            revert SenderNotDAO();\n        }\n    }\n}\n"
      },
      "src/TrustlessActions.sol": {
        "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport {ERC165} from \"../lib/openzeppelin-contracts/contracts/utils/introspection/ERC165.sol\";\nimport {ENSReverseClaimable} from \"../lib/ens-reverse-claimable/src/ENSReverseClaimable.sol\";\n\nimport {ITrustlessActions, IDAO, IDAOManager} from \"./ITrustlessActions.sol\";\n\nabstract contract TrustlessActions is ERC165, ENSReverseClaimable, ITrustlessActions {\n    mapping(IDAO dao => ActionRequests requests) private daoRequests;\n\n    /// @inheritdoc ERC165\n    function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n        return _interfaceId == type(ITrustlessActions).interfaceId || super.supportsInterface(_interfaceId);\n    }\n\n    /// @inheritdoc ITrustlessActions\n    function getAction(IDAO _dao, uint32 _id) external view override returns (ActionRequest memory request) {\n        return daoRequests[_dao].getRequest[_id];\n    }\n\n    /// @inheritdoc ITrustlessActions\n    function createAction(\n        IDAOManager _manager,\n        uint256 _role,\n        IDAO.Action[] calldata _actions,\n        uint256 _failureMap,\n        string calldata _metadata\n    ) public virtual returns (uint32 id) {\n        ActionRequests storage requests = daoRequests[IDAO(msg.sender)];\n        id = requests.requestCount++;\n\n        ActionRequest storage request = requests.getRequest[id];\n        // executed = false (default value)\n        request.manager = _manager;\n        request.role = _role;\n        request.actions = _actions;\n        request.failureMap = _failureMap;\n        emit ActionCreated(id, IDAO(msg.sender), _manager, _role, _actions, _failureMap, _metadata);\n    }\n\n    /// @inheritdoc ITrustlessActions\n    function executeAction(IDAO _dao, uint32 _id) external returns (bytes[] memory returnValues, uint256 failureMap) {\n        ActionRequest storage request = _ensureRequestNotExecuted(_dao, _id);\n        _ensureRequestExecutable(_dao, _id);\n\n        request.executed = true;\n        (returnValues, failureMap) = request.manager.asDAO(_dao, request.role, request.actions, request.failureMap);\n        emit ActionExecuted(_id, _dao, msg.sender, returnValues, failureMap);\n    }\n\n    function _ensureRequestExists(IDAO _dao, uint32 _id) internal view returns (ActionRequest storage request) {\n        ActionRequests storage requests = daoRequests[_dao];\n        if (_id >= requests.requestCount) {\n            revert RequestDoesNotExist();\n        }\n\n        request = requests.getRequest[_id];\n    }\n\n    function _ensureRequestNotExecuted(IDAO _dao, uint32 _id) internal view returns (ActionRequest storage request) {\n        request = _ensureRequestExists(_dao, _id);\n        if (request.executed) {\n            revert RequestAlreadyExecuted();\n        }\n    }\n\n    function _ensureRequestExecutable(IDAO _dao, uint32 _id) internal view virtual;\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
        "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
        "ens-reverse-claimable/=lib/ens-reverse-claimable/src/",
        "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
        "forge-std/=lib/forge-std/src/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/",
        "osx-commons/=lib/trustless-management/lib/osx-commons/",
        "smart-account/=lib/smart-account/src/",
        "tag-manager/=lib/trustless-management/lib/tag-manager/src/",
        "trustless-management/=lib/trustless-management/src/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "evmVersion": "shanghai",
      "viaIR": true,
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      }
    }
  }}