// SPDX-License-Identifier: LGPL-3.0-only pragma solidity >=0.7.0 <0.9.0; import {Enum} from "./../libraries/Enum.sol"; import {IFallbackManager} from "./IFallbackManager.sol"; import {IGuardManager} from "./IGuardManager.sol"; import {IModuleManager} from "./IModuleManager.sol"; import {INativeCurrencyPaymentFallback} from "./INativeCurrencyPaymentFallback.sol"; import {IOwnerManager} from "./IOwnerManager.sol"; import {IStorageAccessible} from "./IStorageAccessible.sol"; /** * @title ISafe - A multisignature wallet interface with support for confirmations using signed messages based on EIP-712. * @author @safe-global/safe-protocol */ interface ISafe is INativeCurrencyPaymentFallback, IModuleManager, IGuardManager, IOwnerManager, IFallbackManager, IStorageAccessible { event SafeSetup(address indexed initiator, address[] owners, uint256 threshold, address initializer, address fallbackHandler); event ApproveHash(bytes32 indexed approvedHash, address indexed owner); event SignMsg(bytes32 indexed msgHash); event ExecutionFailure(bytes32 indexed txHash, uint256 payment); event ExecutionSuccess(bytes32 indexed txHash, uint256 payment); /** * @notice Sets an initial storage of the Safe contract. * @dev This method can only be called once. * If a proxy was created without setting up, anyone can call setup and claim the proxy. * This method emits a {SafeSetup} event with the setup parameters instead of reading from storage, * which may be inaccurate if the delegate call to `to` modifies the owners, threshold or fallback handler. * @param _owners List of Safe owners. * @param _threshold Number of required confirmations for a Safe transaction. * @param to Contract address for optional delegate call. * @param data Data payload for optional delegate call. * @param fallbackHandler Handler for fallback calls to this contract * @param paymentToken Token that should be used for the payment (0 is ETH) * @param payment Value that should be paid * @param paymentReceiver Address that should receive the payment (or 0 if tx.origin) */ function setup( address[] calldata _owners, uint256 _threshold, address to, bytes calldata data, address fallbackHandler, address paymentToken, uint256 payment, address payable paymentReceiver ) external; /** @notice Executes a `operation` {0: Call, 1: DelegateCall} transaction to `to` with `value` (Native Currency) * and pays `gasPrice` * `gasLimit` in `gasToken` token to `refundReceiver`. * @dev The fees are always transferred, even if the user transaction fails. * This method doesn't perform any sanity check of the transaction, such as: * - if the contract at `to` address has code or not * - if the `gasToken` is a contract or not * It is the responsibility of the caller to perform such checks. * @param to Destination address of Safe transaction. * @param value Ether value of Safe transaction. * @param data Data payload of Safe transaction. * @param operation Operation type of Safe transaction. * @param safeTxGas Gas that should be used for the Safe transaction. * @param baseGas Gas costs that are independent of the transaction execution(e.g. base transaction fee, signature check, payment of the refund) * @param gasPrice Gas price that should be used for the payment calculation. * @param gasToken Token address (or 0 if ETH) that is used for the payment. * @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). * @param signatures Signature data that should be verified. * Can be packed ECDSA signature ({bytes32 r}{bytes32 s}{uint8 v}), contract signature (EIP-1271) or approved hash. * @return success Boolean indicating transaction's success. */ function execTransaction( address to, uint256 value, bytes calldata data, Enum.Operation operation, uint256 safeTxGas, uint256 baseGas, uint256 gasPrice, address gasToken, address payable refundReceiver, bytes memory signatures ) external payable returns (bool success); /** * @notice Checks whether the signature provided is valid for the provided data and hash and executor. Reverts otherwise. * @param executor Address that executes the transaction. * ⚠️⚠️⚠️ Make sure that the executor address is a legitimate executor. * Incorrectly passed the executor might reduce the threshold by 1 signature. ⚠️⚠️⚠️ * @param dataHash Hash of the data (could be either a message hash or transaction hash) * @param signatures Signature data that should be verified. * Can be packed ECDSA signature ({bytes32 r}{bytes32 s}{uint8 v}), contract signature (EIP-1271) or approved hash. */ function checkSignatures(address executor, bytes32 dataHash, bytes memory signatures) external view; /** * @notice Checks whether the signature provided is valid for the provided data and hash. Reverts otherwise. * @dev Since the EIP-1271 does an external call, be mindful of reentrancy attacks. * @param executor Address that executes the transaction. * ⚠️⚠️⚠️ Make sure that the executor address is a legitimate executor. * Incorrectly passed the executor might reduce the threshold by 1 signature. ⚠️⚠️⚠️ * @param dataHash Hash of the data (could be either a message hash or transaction hash) * @param signatures Signature data that should be verified. * Can be packed ECDSA signature ({bytes32 r}{bytes32 s}{uint8 v}), contract signature (EIP-1271) or approved hash. * @param requiredSignatures Amount of required valid signatures. */ function checkNSignatures(address executor, bytes32 dataHash, bytes memory signatures, uint256 requiredSignatures) external view; /** * @notice Marks hash `hashToApprove` as approved. * @dev This can be used with a pre-approved hash transaction signature. * IMPORTANT: The approved hash stays approved forever. There's no revocation mechanism, so it behaves similarly to ECDSA signatures * @param hashToApprove The hash to mark as approved for signatures that are verified by this contract. */ function approveHash(bytes32 hashToApprove) external; /** * @dev Returns the domain separator for this contract, as defined in the EIP-712 standard. * @return bytes32 The domain separator hash. */ function domainSeparator() external view returns (bytes32); /** * @notice Returns transaction hash to be signed by owners. * @param to Destination address. * @param value Ether value. * @param data Data payload. * @param operation Operation type. * @param safeTxGas Gas that should be used for the safe transaction. * @param baseGas Gas costs for data used to trigger the safe transaction. * @param gasPrice Maximum gas price that should be used for this transaction. * @param gasToken Token address (or 0 if ETH) that is used for the payment. * @param refundReceiver Address of receiver of gas payment (or 0 if tx.origin). * @param _nonce Transaction nonce. * @return Transaction hash. */ function getTransactionHash( address to, uint256 value, bytes calldata data, Enum.Operation operation, uint256 safeTxGas, uint256 baseGas, uint256 gasPrice, address gasToken, address refundReceiver, uint256 _nonce ) external view returns (bytes32); /** * External getter function for state variables. */ /** * @notice Returns the version of the Safe contract. * @return Version string. */ // solhint-disable-next-line function VERSION() external view returns (string memory); /** * @notice Returns the nonce of the Safe contract. * @return Nonce. */ function nonce() external view returns (uint256); /** * @notice Returns a uint if the messageHash is signed by the owner. * @param messageHash Hash of message that should be checked. * @return Number denoting if an owner signed the hash. */ function signedMessages(bytes32 messageHash) external view returns (uint256); /** * @notice Returns a uint if the messageHash is approved by the owner. * @param owner Owner address that should be checked. * @param messageHash Hash of message that should be checked. * @return Number denoting if an owner approved the hash. */ function approvedHashes(address owner, bytes32 messageHash) external view returns (uint256); }