Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x79Ce8f93063f8BE4573a58F250b003859eBb7a24
Balance 0 ETH
Nonce 1
Code Size 2010 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

2010 bytes
0x608080604052600436101561001357600080fd5b600090813560e01c6374afcbe61461002a57600080fd5b3461039f57606036600319011261039f5760043567ffffffffffffffff81116106685761005b90369060040161066c565b60249291923567ffffffffffffffff81116106645761007e90369060040161066c565b93909260028654146106225750600285556040516020810160ff60f81b81526bffffffffffffffffffffffff197f00000000000000000000000000000000f9490004c11cef243f5400493c00ad6360601b16602183015260443560358301527f023d904f2503c37127200ca07b976c3a53cc562623f67023115bf311f58050596055830152605582526080820182811067ffffffffffffffff82111761060e576040529051902085926001600160a01b03909116918391825b8181106105e3575061016161014b84610764565b9361015960405195866106d4565b808552610764565b855b601f198201811061059d5750508490855b81811061048b5750505050604051928391632671a55160e11b83526024830160206004850152815180915260206044850192019083905b808210610407575050506020939183809203925af19081156103fc5784916103b5575b506001600160e01b03191663598e5aaf60e11b016103a35782907f000000000000000000000000c2c862322e9c97d6244a3506655da95f05246fd86001600160a01b03163b1561039f5760405163760f2a0b60e01b815260206004820152602481018490529283916044600583901b84018101929085908501835b8383106102d357505050918390039150829050837f000000000000000000000000c2c862322e9c97d6244a3506655da95f05246fd86001600160a01b03165af180156102c85761029c575b506001815580f35b67ffffffffffffffff81116102b45760405238610294565b634e487b7160e01b82526041600452602482fd5b6040513d84823e3d90fd5b919395509193604319888203018352853590605e198336030182121561039b57828201356001600160a01b03811690819003610397578152601e1983830136030160208484010135121561039b5782820160208101350167ffffffffffffffff8135116103975780353603602082011361039757608082602093926040876001978e6060898099015284356060870152843588860188880137868535870101520101356040830152601f801991350116010197019301930190928795949293610249565b8880fd5b8780fd5b5080fd5b6040516340e28b9b60e11b8152600490fd5b90506020813d6020116103f4575b816103d0602093836106d4565b810103126103f057516001600160e01b0319811681036103f057386101ce565b8380fd5b3d91506103c3565b6040513d86823e3d90fd5b9291945092508351805160048110156104775782526020818101516001600160a01b0390811682850152604080840151821690850152606080840151909116908401526080808301519084015260a0918201519183019190915286948a9460c090930193910191600101906101ab565b634e487b7160e01b8b52602160045260248bfd5b90919293955061049c8183866106f6565b6104a6818061072e565b916001600160a01b036104bb6020830161077c565b161561058b5791908b925b8284106104df5750505050600101908895939291610174565b9091929560048760071b8401351015610587576001818861057083948e61050d60208560071b8b010161077c565b61051960208a0161077c565b9060405195610527876106a2565b60071b8b01358652878060a01b03166020860152336040860152868060a01b0316606085015260408d60071b8a010135608085015260608d60071b8a01013560a0850152610790565b5261057b818d610790565b500196019291906104c6565b8c80fd5b604051634e46966960e11b8152600490fd5b60209192939496506040516105b1816106a2565b8a81528a838201528a60408201528a60608201528a60808201528a60a082015282828901015201908895939291610163565b945090916001906105fe6105f88785876106f6565b8061072e565b9190500194019087949291610137565b634e487b7160e01b88526041600452602488fd5b62461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b8480fd5b8280fd5b9181601f8401121561069d5782359167ffffffffffffffff831161069d576020808501948460051b01011161069d57565b600080fd5b60c0810190811067ffffffffffffffff8211176106be57604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff8211176106be57604052565b91908110156107185760051b81013590603e198136030182121561069d570190565b634e487b7160e01b600052603260045260246000fd5b903590601e198136030182121561069d570180359067ffffffffffffffff821161069d57602001918160071b3603831361069d57565b67ffffffffffffffff81116106be5760051b60200190565b356001600160a01b038116810361069d5790565b80518210156107185760209160051b01019056fea26469706673582212203c9faa9be378e5e391b2b6afd43f2e04484daf9e64fed5737e5b8a44c9841ad864736f6c63430008110033

Verified Source Code Full Match

Compiler: v0.8.17+commit.8df45f5f EVM: london Optimization: Yes (200 runs)
IConduit.sol 29 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

interface IConduitController {
  function getConduitCodeHashes()
    external
    view
    returns (bytes32 creationCodeHash, bytes32 runtimeCodeHash);
}

interface IConduit {
  enum ConduitItemType {
    NATIVE, // Unused
    ERC20,
    ERC721,
    ERC1155
  }

  struct ConduitTransfer {
    ConduitItemType itemType;
    address token;
    address from;
    address to;
    uint256 identifier;
    uint256 amount;
  }

  function execute(ConduitTransfer[] calldata transfers) external returns (bytes4 magicValue);
}
IReservoirV6_0_1.sol 12 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

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

  function execute(ExecutionInfo[] calldata executionInfos) external payable;
}
ReservoirApprovalProxy.sol 123 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

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

import {IConduit, IConduitController} from "../interfaces/IConduit.sol";
import {IReservoirV6_0_1} from "../interfaces/IReservoirV6_0_1.sol";

// Forked from:
// https://github.com/ProjectOpenSea/seaport/blob/b13939729001cb12f715d7b73422aafeca0bcd0d/contracts/helpers/TransferHelper.sol
contract ReservoirApprovalProxy is ReentrancyGuard {
  // --- Structs ---

  struct TransferHelperItem {
    IConduit.ConduitItemType itemType;
    address token;
    uint256 identifier;
    uint256 amount;
  }

  struct TransferHelperItemsWithRecipient {
    TransferHelperItem[] items;
    address recipient;
  }

  // --- Errors ---

  error ConduitExecutionFailed();
  error InvalidRecipient();

  // --- Fields ---

  IConduitController internal immutable _CONDUIT_CONTROLLER;
  bytes32 internal immutable _CONDUIT_CREATION_CODE_HASH;
  bytes32 internal immutable _CONDUIT_RUNTIME_CODE_HASH;

  IReservoirV6_0_1 internal immutable _ROUTER;

  // --- Constructor ---

  constructor(address conduitController, address router) {
    IConduitController controller = IConduitController(conduitController);
    (_CONDUIT_CREATION_CODE_HASH, _CONDUIT_RUNTIME_CODE_HASH) = controller.getConduitCodeHashes();

    _CONDUIT_CONTROLLER = controller;
    _ROUTER = IReservoirV6_0_1(router);
  }

  // --- Public methods ---

  function bulkTransferWithExecute(
    TransferHelperItemsWithRecipient[] calldata transfers,
    IReservoirV6_0_1.ExecutionInfo[] calldata executionInfos,
    bytes32 conduitKey
  ) external nonReentrant {
    uint256 numTransfers = transfers.length;

    address conduit = address(
      uint160(
        uint256(
          keccak256(
            abi.encodePacked(
              bytes1(0xff),
              address(_CONDUIT_CONTROLLER),
              conduitKey,
              _CONDUIT_CREATION_CODE_HASH
            )
          )
        )
      )
    );

    uint256 sumOfItemsAcrossAllTransfers;
    unchecked {
      for (uint256 i = 0; i < numTransfers; ++i) {
        TransferHelperItemsWithRecipient calldata transfer = transfers[i];
        sumOfItemsAcrossAllTransfers += transfer.items.length;
      }
    }

    IConduit.ConduitTransfer[] memory conduitTransfers = new IConduit.ConduitTransfer[](
      sumOfItemsAcrossAllTransfers
    );

    uint256 itemIndex;
    unchecked {
      for (uint256 i = 0; i < numTransfers; ++i) {
        TransferHelperItemsWithRecipient calldata transfer = transfers[i];
        TransferHelperItem[] calldata transferItems = transfer.items;

        _checkRecipientIsNotZeroAddress(transfer.recipient);

        uint256 numItemsInTransfer = transferItems.length;
        for (uint256 j = 0; j < numItemsInTransfer; ++j) {
          TransferHelperItem calldata item = transferItems[j];
          conduitTransfers[itemIndex] = IConduit.ConduitTransfer(
            item.itemType,
            item.token,
            msg.sender,
            transfer.recipient,
            item.identifier,
            item.amount
          );

          ++itemIndex;
        }
      }
    }

    bytes4 conduitMagicValue = IConduit(conduit).execute(conduitTransfers);
    if (conduitMagicValue != IConduit.execute.selector) {
      revert ConduitExecutionFailed();
    }

    _ROUTER.execute(executionInfos);
  }

  function _checkRecipientIsNotZeroAddress(address recipient) internal pure {
    if (recipient == address(0x0)) {
      revert InvalidRecipient();
    }
  }
}
ReentrancyGuard.sol 69 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

Write Contract 1 functions

These functions modify contract state and require a wallet transaction to execute.

bulkTransferWithExecute 0x3ac1f4af
tuple[] transfers
tuple[] executionInfos
bytes32 conduitKey

Recent Transactions

No transactions found for this address