ETH Price: $2,960.76 (+0.61%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Age:90D
Reset Filter

Transaction Hash
Method
Block
From
To

There are no matching entries

Update your filters to view other transactions

Age:90D
Reset Filter

Advanced mode:
Parent Transaction Hash Method Block
From
To

There are no matching entries

Update your filters to view other transactions

View All Internal Transactions
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ReservoirV6_0_0

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import {Address} from "@openzeppelin/contracts/utils/Address.sol";

contract ReservoirV6_0_0 is ReentrancyGuard {
    using Address for address;

    // --- Structs ---

    struct ExecutionInfo {
        address module;
        bytes data;
        uint256 value;
    }

    struct AmountCheckInfo {
        address target;
        bytes data;
        uint256 threshold;
    }

    // --- Errors ---

    error UnsuccessfulExecution();
    error UnsuccessfulPayment();

    // --- Modifiers ---

    modifier refundETH() {
        _;

        uint256 leftover = address(this).balance;
        if (leftover > 0) {
            (bool success, ) = payable(msg.sender).call{value: leftover}("");
            if (!success) {
                revert UnsuccessfulPayment();
            }
        }
    }

    // --- Fallback ---

    receive() external payable {}

    // --- Public ---

    // Trigger a set of executions atomically
    function execute(ExecutionInfo[] calldata executionInfos)
        external
        payable
        nonReentrant
        refundETH
    {
        uint256 length = executionInfos.length;
        for (uint256 i = 0; i < length; ) {
            _executeInternal(executionInfos[i]);

            unchecked {
                ++i;
            }
        }
    }

    // Trigger a set of executions with amount checking. As opposed to the regular
    // `execute` method, `executeWithAmountCheck` supports stopping the executions
    // once the provided amount check reaches a certain value. This is useful when
    // trying to fill orders with slippage (eg. provide multiple orders and try to
    // fill until a certain balance is reached). In order to be flexible, checking
    // the amount is done generically by calling the `target` contract with `data`.
    // For example, this could be used to check the ERC721 total owned balance (by
    // using `balanceOf(owner)`), the ERC1155 total owned balance per token id (by
    // using `balanceOf(owner, tokenId)`), but also for checking the ERC1155 total
    // owned balance per multiple token ids (by using a custom contract that wraps
    // `balanceOfBatch(owners, tokenIds)`).
    function executeWithAmountCheck(
        ExecutionInfo[] calldata executionInfos,
        AmountCheckInfo calldata amountCheckInfo
    ) external payable nonReentrant refundETH {
        // Cache some data for efficiency
        address target = amountCheckInfo.target;
        bytes calldata data = amountCheckInfo.data;
        uint256 threshold = amountCheckInfo.threshold;

        uint256 length = executionInfos.length;
        for (uint256 i = 0; i < length; ) {
            // Check the amount and break if it exceeds the threshold
            uint256 amount = _getAmount(target, data);
            if (amount >= threshold) {
                break;
            }

            _executeInternal(executionInfos[i]);

            unchecked {
                ++i;
            }
        }
    }

    // --- Internal ---

    function _executeInternal(ExecutionInfo calldata executionInfo) internal {
        address module = executionInfo.module;

        // Ensure the target is a contract
        if (!module.isContract()) {
            revert UnsuccessfulExecution();
        }

        (bool success, ) = module.call{value: executionInfo.value}(
            executionInfo.data
        );
        if (!success) {
            revert UnsuccessfulExecution();
        }
    }

    function _getAmount(address target, bytes calldata data)
        internal
        view
        returns (uint256 amount)
    {
        // Ensure the target is a contract
        if (!target.isContract()) {
            revert UnsuccessfulExecution();
        }

        (bool success, bytes memory result) = target.staticcall(data);
        if (!success) {
            revert UnsuccessfulExecution();
        }

        amount = abi.decode(result, (uint256));
    }
}

File 2 of 3 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"UnsuccessfulExecution","type":"error"},{"inputs":[],"name":"UnsuccessfulPayment","type":"error"},{"inputs":[{"components":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct ReservoirV6_0_0.ExecutionInfo[]","name":"executionInfos","type":"tuple[]"}],"name":"execute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct ReservoirV6_0_0.ExecutionInfo[]","name":"executionInfos","type":"tuple[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"threshold","type":"uint256"}],"internalType":"struct ReservoirV6_0_0.AmountCheckInfo","name":"amountCheckInfo","type":"tuple"}],"name":"executeWithAmountCheck","outputs":[],"stateMutability":"payable","type":"function"},{"stateMutability":"payable","type":"receive"}]

6080806040523461001b5760016000556103fd90816100218239f35b600080fdfe60406080815260048036101561001f575b5050361561001d57600080fd5b005b600091823560e01c806304871891146100e75763760f2a0b146100425750610010565b60203660031901126100e357813567ffffffffffffffff81116100df5761006c9036908401610208565b61007a60028654141561023e565b60028555845b8181106100c35750505082478061009a575b506001815580f35b81808092335af16100a961028a565b50156100b6578281610092565b5163d2dcf4f360e01b8152fd5b806100d96100d460019385876102eb565b61036a565b01610080565b8380fd5b8280fd5b5060031981813601126100df5767ffffffffffffffff8335818111610204576101139036908601610208565b926024359283116102005760608387019184360301126102005760449061013e60028954141561023e565b6002885561015961014e82610323565b916024860190610337565b929094013591885b86811061017f575b5050505050505082478061009a57506001815580f35b823b156101f0578980895184898237808581018381520390865afa6101a261028a565b90156101e057602080828051810103126101dc578591015110156101d757806101d16100d46001938a896102eb565b01610161565b610169565b8b80fd5b8851635589343b60e11b81528a90fd5b8751635589343b60e11b81528990fd5b8680fd5b8580fd5b9181601f840112156102395782359167ffffffffffffffff8311610239576020808501948460051b01011161023957565b600080fd5b1561024557565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b3d156102e65767ffffffffffffffff903d8281116102d05760405192601f8201601f19908116603f01168401908111848210176102d05760405282523d6000602084013e565b634e487b7160e01b600052604160045260246000fd5b606090565b919081101561030d5760051b81013590605e1981360301821215610239570190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b03811681036102395790565b903590601e1981360301821215610239570180359067ffffffffffffffff82116102395760200191813603831361023957565b61037381610323565b803b156103b5578160406000939261038f602086950184610337565b92908382519485928337810186815203930135905af16103ad61028a565b50156103b557565b604051635589343b60e11b8152600490fdfea26469706673582212207e4e3c7a02451502301f89f0e307102f413782fdae9d9e13c8c7c6c05939b52a64736f6c63430008110033

Deployed Bytecode

0x60406080815260048036101561001f575b5050361561001d57600080fd5b005b600091823560e01c806304871891146100e75763760f2a0b146100425750610010565b60203660031901126100e357813567ffffffffffffffff81116100df5761006c9036908401610208565b61007a60028654141561023e565b60028555845b8181106100c35750505082478061009a575b506001815580f35b81808092335af16100a961028a565b50156100b6578281610092565b5163d2dcf4f360e01b8152fd5b806100d96100d460019385876102eb565b61036a565b01610080565b8380fd5b8280fd5b5060031981813601126100df5767ffffffffffffffff8335818111610204576101139036908601610208565b926024359283116102005760608387019184360301126102005760449061013e60028954141561023e565b6002885561015961014e82610323565b916024860190610337565b929094013591885b86811061017f575b5050505050505082478061009a57506001815580f35b823b156101f0578980895184898237808581018381520390865afa6101a261028a565b90156101e057602080828051810103126101dc578591015110156101d757806101d16100d46001938a896102eb565b01610161565b610169565b8b80fd5b8851635589343b60e11b81528a90fd5b8751635589343b60e11b81528990fd5b8680fd5b8580fd5b9181601f840112156102395782359167ffffffffffffffff8311610239576020808501948460051b01011161023957565b600080fd5b1561024557565b60405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b3d156102e65767ffffffffffffffff903d8281116102d05760405192601f8201601f19908116603f01168401908111848210176102d05760405282523d6000602084013e565b634e487b7160e01b600052604160045260246000fd5b606090565b919081101561030d5760051b81013590605e1981360301821215610239570190565b634e487b7160e01b600052603260045260246000fd5b356001600160a01b03811681036102395790565b903590601e1981360301821215610239570180359067ffffffffffffffff82116102395760200191813603831361023957565b61037381610323565b803b156103b5578160406000939261038f602086950184610337565b92908382519485928337810186815203930135905af16103ad61028a565b50156103b557565b604051635589343b60e11b8152600490fdfea26469706673582212207e4e3c7a02451502301f89f0e307102f413782fdae9d9e13c8c7c6c05939b52a64736f6c63430008110033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.