APE Price: $1.18 (-6.43%)

Contract

0xe4A296f368BDb56cD1397aDcd18e17399E64FFc0

Overview

APE Balance

Apechain LogoApechain LogoApechain Logo0 APE

APE Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ReservoirApprovalProxy

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 4 : ReservoirApprovalProxy.sol
// 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();
    }
  }
}

File 2 of 4 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

File 3 of 4 : IConduit.sol
// 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);
}

File 4 of 4 : IReservoirV6_0_1.sol
// 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;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"conduitController","type":"address"},{"internalType":"address","name":"router","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ConduitExecutionFailed","type":"error"},{"inputs":[],"name":"InvalidRecipient","type":"error"},{"inputs":[{"components":[{"components":[{"internalType":"enum IConduit.ConduitItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifier","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"internalType":"struct ReservoirApprovalProxy.TransferHelperItem[]","name":"items","type":"tuple[]"},{"internalType":"address","name":"recipient","type":"address"}],"internalType":"struct ReservoirApprovalProxy.TransferHelperItemsWithRecipient[]","name":"transfers","type":"tuple[]"},{"components":[{"internalType":"address","name":"module","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"value","type":"uint256"}],"internalType":"struct IReservoirV6_0_1.ExecutionInfo[]","name":"executionInfos","type":"tuple[]"},{"internalType":"bytes32","name":"conduitKey","type":"bytes32"}],"name":"bulkTransferWithExecute","outputs":[],"stateMutability":"nonpayable","type":"function"}]

610100604090808252346100fd57818161092a80380380916100218285610102565b8339810103126100fd5761004060206100398361013b565b920161013b565b600160009081558351630a96ad3960e01b81526001600160a01b0393841691908581600481865afa9081156100f3578280926100b9575b505060c05260a0526080521660e052516107da908161015082396080518160ad015260a0518160df015260c05181505060e0518181816101ea015261025f0152f35b915091508582813d83116100ec575b6100d28183610102565b810103126100e95750602081519101513880610077565b80fd5b503d6100c8565b86513d84823e3d90fd5b600080fd5b601f909101601f19168101906001600160401b0382119082101761012557604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b03821682036100fd5756fe608080604052600436101561001357600080fd5b600090813560e01c6374afcbe61461002a57600080fd5b3461039f57606036600319011261039f5760043567ffffffffffffffff81116106685761005b90369060040161066c565b60249291923567ffffffffffffffff81116106645761007e90369060040161066c565b93909260028654146106225750600285556040516020810160ff60f81b81526bffffffffffffffffffffffff197f000000000000000000000000000000000000000000000000000000000000000060601b16602183015260443560358301527f00000000000000000000000000000000000000000000000000000000000000006055830152605582526080820182811067ffffffffffffffff82111761060e576040529051902085926001600160a01b03909116918391825b8181106105e3575061016161014b84610764565b9361015960405195866106d4565b808552610764565b855b601f198201811061059d5750508490855b81811061048b5750505050604051928391632671a55160e11b83526024830160206004850152815180915260206044850192019083905b808210610407575050506020939183809203925af19081156103fc5784916103b5575b506001600160e01b03191663598e5aaf60e11b016103a35782907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163b1561039f5760405163760f2a0b60e01b815260206004820152602481018490529283916044600583901b84018101929085908501835b8383106102d357505050918390039150829050837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165af180156102c85761029c575b506001815580f35b67ffffffffffffffff81116102b45760405238610294565b634e487b7160e01b82526041600452602482fd5b6040513d84823e3d90fd5b919395509193604319888203018352853590605e198336030182121561039b57828201356001600160a01b03811690819003610397578152601e1983830136030160208484010135121561039b5782820160208101350167ffffffffffffffff8135116103975780353603602082011361039757608082602093926040876001978e6060898099015284356060870152843588860188880137868535870101520101356040830152601f801991350116010197019301930190928795949293610249565b8880fd5b8780fd5b5080fd5b6040516340e28b9b60e11b8152600490fd5b90506020813d6020116103f4575b816103d0602093836106d4565b810103126103f057516001600160e01b0319811681036103f057386101ce565b8380fd5b3d91506103c3565b6040513d86823e3d90fd5b9291945092508351805160048110156104775782526020818101516001600160a01b0390811682850152604080840151821690850152606080840151909116908401526080808301519084015260a0918201519183019190915286948a9460c090930193910191600101906101ab565b634e487b7160e01b8b52602160045260248bfd5b90919293955061049c8183866106f6565b6104a6818061072e565b916001600160a01b036104bb6020830161077c565b161561058b5791908b925b8284106104df5750505050600101908895939291610174565b9091929560048760071b8401351015610587576001818861057083948e61050d60208560071b8b010161077c565b61051960208a0161077c565b9060405195610527876106a2565b60071b8b01358652878060a01b03166020860152336040860152868060a01b0316606085015260408d60071b8a010135608085015260608d60071b8a01013560a0850152610790565b5261057b818d610790565b500196019291906104c6565b8c80fd5b604051634e46966960e11b8152600490fd5b60209192939496506040516105b1816106a2565b8a81528a838201528a60408201528a60608201528a60808201528a60a082015282828901015201908895939291610163565b945090916001906105fe6105f88785876106f6565b8061072e565b9190500194019087949291610137565b634e487b7160e01b88526041600452602488fd5b62461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b8480fd5b8280fd5b9181601f8401121561069d5782359167ffffffffffffffff831161069d576020808501948460051b01011161069d57565b600080fd5b60c0810190811067ffffffffffffffff8211176106be57604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff8211176106be57604052565b91908110156107185760051b81013590603e198136030182121561069d570190565b634e487b7160e01b600052603260045260246000fd5b903590601e198136030182121561069d570180359067ffffffffffffffff821161069d57602001918160071b3603831361069d57565b67ffffffffffffffff81116106be5760051b60200190565b356001600160a01b038116810361069d5790565b80518210156107185760209160051b01019056fea2646970667358221220bc071bde7983d372b598c76ab5367a34b470fde3637ed5f0375a3fe7e930ec2f64736f6c6343000811003300000000000000000000000000000000f9490004c11cef243f5400493c00ad6300000000000000000000000074acccde5e3ea9fcc8656b65d1373be3f355b9bf

Deployed Bytecode

0x608080604052600436101561001357600080fd5b600090813560e01c6374afcbe61461002a57600080fd5b3461039f57606036600319011261039f5760043567ffffffffffffffff81116106685761005b90369060040161066c565b60249291923567ffffffffffffffff81116106645761007e90369060040161066c565b93909260028654146106225750600285556040516020810160ff60f81b81526bffffffffffffffffffffffff197f00000000000000000000000000000000f9490004c11cef243f5400493c00ad6360601b16602183015260443560358301527f023d904f2503c37127200ca07b976c3a53cc562623f67023115bf311f58050596055830152605582526080820182811067ffffffffffffffff82111761060e576040529051902085926001600160a01b03909116918391825b8181106105e3575061016161014b84610764565b9361015960405195866106d4565b808552610764565b855b601f198201811061059d5750508490855b81811061048b5750505050604051928391632671a55160e11b83526024830160206004850152815180915260206044850192019083905b808210610407575050506020939183809203925af19081156103fc5784916103b5575b506001600160e01b03191663598e5aaf60e11b016103a35782907f00000000000000000000000074acccde5e3ea9fcc8656b65d1373be3f355b9bf6001600160a01b03163b1561039f5760405163760f2a0b60e01b815260206004820152602481018490529283916044600583901b84018101929085908501835b8383106102d357505050918390039150829050837f00000000000000000000000074acccde5e3ea9fcc8656b65d1373be3f355b9bf6001600160a01b03165af180156102c85761029c575b506001815580f35b67ffffffffffffffff81116102b45760405238610294565b634e487b7160e01b82526041600452602482fd5b6040513d84823e3d90fd5b919395509193604319888203018352853590605e198336030182121561039b57828201356001600160a01b03811690819003610397578152601e1983830136030160208484010135121561039b5782820160208101350167ffffffffffffffff8135116103975780353603602082011361039757608082602093926040876001978e6060898099015284356060870152843588860188880137868535870101520101356040830152601f801991350116010197019301930190928795949293610249565b8880fd5b8780fd5b5080fd5b6040516340e28b9b60e11b8152600490fd5b90506020813d6020116103f4575b816103d0602093836106d4565b810103126103f057516001600160e01b0319811681036103f057386101ce565b8380fd5b3d91506103c3565b6040513d86823e3d90fd5b9291945092508351805160048110156104775782526020818101516001600160a01b0390811682850152604080840151821690850152606080840151909116908401526080808301519084015260a0918201519183019190915286948a9460c090930193910191600101906101ab565b634e487b7160e01b8b52602160045260248bfd5b90919293955061049c8183866106f6565b6104a6818061072e565b916001600160a01b036104bb6020830161077c565b161561058b5791908b925b8284106104df5750505050600101908895939291610174565b9091929560048760071b8401351015610587576001818861057083948e61050d60208560071b8b010161077c565b61051960208a0161077c565b9060405195610527876106a2565b60071b8b01358652878060a01b03166020860152336040860152868060a01b0316606085015260408d60071b8a010135608085015260608d60071b8a01013560a0850152610790565b5261057b818d610790565b500196019291906104c6565b8c80fd5b604051634e46966960e11b8152600490fd5b60209192939496506040516105b1816106a2565b8a81528a838201528a60408201528a60608201528a60808201528a60a082015282828901015201908895939291610163565b945090916001906105fe6105f88785876106f6565b8061072e565b9190500194019087949291610137565b634e487b7160e01b88526041600452602488fd5b62461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606490fd5b8480fd5b8280fd5b9181601f8401121561069d5782359167ffffffffffffffff831161069d576020808501948460051b01011161069d57565b600080fd5b60c0810190811067ffffffffffffffff8211176106be57604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff8211176106be57604052565b91908110156107185760051b81013590603e198136030182121561069d570190565b634e487b7160e01b600052603260045260246000fd5b903590601e198136030182121561069d570180359067ffffffffffffffff821161069d57602001918160071b3603831361069d57565b67ffffffffffffffff81116106be5760051b60200190565b356001600160a01b038116810361069d5790565b80518210156107185760209160051b01019056fea2646970667358221220bc071bde7983d372b598c76ab5367a34b470fde3637ed5f0375a3fe7e930ec2f64736f6c63430008110033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000f9490004c11cef243f5400493c00ad6300000000000000000000000074acccde5e3ea9fcc8656b65d1373be3f355b9bf

-----Decoded View---------------
Arg [0] : conduitController (address): 0x00000000F9490004C11Cef243f5400493c00Ad63
Arg [1] : router (address): 0x74ACCcDe5e3Ea9Fcc8656B65d1373Be3f355b9Bf

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000f9490004c11cef243f5400493c00ad63
Arg [1] : 00000000000000000000000074acccde5e3ea9fcc8656b65d1373be3f355b9bf


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.