Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0xD75d2EeF7Fe65Bf9f46D7ef0b21EdED98cB0a3A4
Balance 0 ETH
Nonce 1
Code Size 4849 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

4849 bytes
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80638b79543c1161005b5780638b79543c14610119578063ad007d6314610140578063c548f30914610167578063d9833b321461019957600080fd5b80632b5b94ad1461008d57806330abe987146100a257806349491987146100cb5780637d73b231146100eb575b600080fd5b6100a061009b366004610cad565b6101c0565b005b6100b56100b0366004610dad565b610348565b6040516100c29190610e6e565b60405180910390f35b6100de6100d9366004610dad565b61042b565b6040516100c29190610e88565b6101016e0c2e074ec69a0dfb2997ba6c7d2e1e81565b6040516001600160a01b0390911681526020016100c2565b6101017f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d381565b6101017f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb81565b6100de604051806040016040528060138152602001721a9d5a58d9589bde17dc1c9bda9958dd17da59606a1b81525081565b6101017f000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb681565b6040516331a9108f60e11b8152600481018390527f000000000000000000000000d8b4359143eda5b2d763e127ed27c77addbc47d36001600160a01b031690636352211e90602401602060405180830381865afa158015610225573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102499190610e9b565b82601361025783838361074d565b8351600081900361027b576040516314124ae160e31b815260040160405180910390fd5b60005b818110156102c95785818151811061029857610298610ec4565b6020026020010151516000036102c157604051630186fe0d60e51b815260040160405180910390fd5b60010161027e565b5060008681526020818152604090912086516102e792880190610b55565b506102f1856108cb565b6040516102fe9190610eda565b6040518091039020867f2f08b921e66e530e39c2a5a6a1d27d9967e793a553c83bfaf3cb47433021a14c8733604051610338929190610ef6565b60405180910390a3505050505050565b600081815260208181526040808320805482518185028101850190935280835260609492939192909184015b8282101561042057838290600052602060002001805461039390610f20565b80601f01602080910402602001604051908101604052809291908181526020018280546103bf90610f20565b801561040c5780601f106103e15761010080835404028352916020019161040c565b820191906000526020600020905b8154815290600101906020018083116103ef57829003601f168201915b505050505081526020019060010190610374565b505050509050919050565b600081815260208181526040808320805482518185028101850190935280835260609493849084015b8282101561050057838290600052602060002001805461047390610f20565b80601f016020809104026020016040519081016040528092919081815260200182805461049f90610f20565b80156104ec5780601f106104c1576101008083540402835291602001916104ec565b820191906000526020600020905b8154815290600101906020018083116104cf57829003601f168201915b505050505081526020019060010190610454565b50505050905080516000036105bd576040516330abe98760e01b8152600481018490527f000000000000000000000000e3c01e9fd2a1dcc6edf0b1058b5757138ef9ffb66001600160a01b0316906330abe98790602401600060405180830381865afa158015610574573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261059c9190810190610f9f565b905080516000036105bd575050604080516020810190915260008152919050565b60006105c88261095a565b604051630178b8bf60e01b8152600481018290529091506000906e0c2e074ec69a0dfb2997ba6c7d2e1e90630178b8bf90602401602060405180830381865afa158015610619573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061063d9190610e9b565b90506001600160a01b0381166106655750506040805160208101909152600081529392505050565b60408051808201825260138152721a9d5a58d9589bde17dc1c9bda9958dd17da59606a1b60208201529051631674750f60e21b81526000916001600160a01b038416916359d1d43c916106bd91879190600401611050565b600060405180830381865afa1580156106da573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526107029190810190611069565b905061070d86610a4c565b8051906020012081805190602001201461073a575050604080516020810190915260008152949350505050565b610743846108cb565b9695505050505050565b336001600160a01b03841614801590610801575060405163c161c93f60e01b81523360048201526001600160a01b03848116602483015260448201849052606482018390527f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb169063c161c93f90608401602060405180830381865afa1580156107db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ff919061109e565b155b80156108a8575060405163c161c93f60e01b81523360048201526001600160a01b03848116602483015260006044830152606482018390527f0000000000000000000000006f3c5afca0c9edf3926ef2ddf17c8ae6391afefb169063c161c93f90608401602060405180830381865afa158015610882573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a6919061109e565b155b156108c65760405163075fd2b160e01b815260040160405180910390fd5b505050565b805160609060015b8181116109535782846108e683856110d6565b815181106108f6576108f6610ec4565b602002602001015160405160200161090f9291906110ef565b60405160208183030381529060405292508181101561094b5782604051602001610939919061111e565b60405160208183030381529060405292505b6001016108d3565b5050919050565b60008060405160200161097690620cae8d60eb1b815260030190565b604051602081830303815290604052805190602001206040516020016109a6929190918252602082015260400190565b60405160208183030381529060405280519060200120905060008251905060005b8181101561095357828482815181106109e2576109e2610ec4565b60200260200101516040516020016109fa9190610eda565b60405160208183030381529060405280519060200120604051602001610a2a929190918252602082015260400190565b60408051601f19818403018152919052805160209091012092506001016109c7565b606081600003610a735750506040805180820190915260018152600360fc1b602082015290565b8160005b8115610a9d5780610a8781611143565b9150610a969050600a83611172565b9150610a77565b60008167ffffffffffffffff811115610ab857610ab8610c1a565b6040519080825280601f01601f191660200182016040528015610ae2576020820181803683370190505b5090505b8415610b4d57610af76001836110d6565b9150610b04600a86611186565b610b0f90603061119a565b60f81b818381518110610b2457610b24610ec4565b60200101906001600160f81b031916908160001a905350610b46600a86611172565b9450610ae6565b949350505050565b828054828255906000526020600020908101928215610b9b579160200282015b82811115610b9b5782518290610b8b90826111fb565b5091602001919060010190610b75565b50610ba7929150610bab565b5090565b80821115610ba7576000610bbf8282610bc8565b50600101610bab565b508054610bd490610f20565b6000825580601f10610be4575050565b601f016020900490600052602060002090810190610c029190610c05565b50565b5b80821115610ba75760008155600101610c06565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715610c5957610c59610c1a565b604052919050565b600067ffffffffffffffff821115610c7b57610c7b610c1a565b5060051b60200190565b600067ffffffffffffffff821115610c9f57610c9f610c1a565b50601f01601f191660200190565b6000806040808486031215610cc157600080fd5b8335925060208085013567ffffffffffffffff80821115610ce157600080fd5b818701915087601f830112610cf557600080fd5b8135610d08610d0382610c61565b610c30565b81815260059190911b8301840190848101908a831115610d2757600080fd5b8585015b83811015610d9b57803585811115610d435760008081fd5b8601603f81018d13610d555760008081fd5b87810135610d65610d0382610c85565b8181528e8b838501011115610d7a5760008081fd5b818b84018b83013760009181018a0191909152845250918601918601610d2b565b50809750505050505050509250929050565b600060208284031215610dbf57600080fd5b5035919050565b60005b83811015610de1578181015183820152602001610dc9565b50506000910152565b60008151808452610e02816020860160208601610dc6565b601f01601f19169290920160200192915050565b600082825180855260208086019550808260051b84010181860160005b84811015610e6157601f19868403018952610e4f838351610dea565b98840198925090830190600101610e33565b5090979650505050505050565b602081526000610e816020830184610e16565b9392505050565b602081526000610e816020830184610dea565b600060208284031215610ead57600080fd5b81516001600160a01b0381168114610e8157600080fd5b634e487b7160e01b600052603260045260246000fd5b60008251610eec818460208701610dc6565b9190910192915050565b604081526000610f096040830185610e16565b905060018060a01b03831660208301529392505050565b600181811c90821680610f3457607f821691505b602082108103610f5457634e487b7160e01b600052602260045260246000fd5b50919050565b600082601f830112610f6b57600080fd5b8151610f79610d0382610c85565b818152846020838601011115610f8e57600080fd5b610b4d826020830160208701610dc6565b60006020808385031215610fb257600080fd5b825167ffffffffffffffff80821115610fca57600080fd5b818501915085601f830112610fde57600080fd5b8151610fec610d0382610c61565b81815260059190911b8301840190848101908883111561100b57600080fd5b8585015b83811015611043578051858111156110275760008081fd5b6110358b89838a0101610f5a565b84525091860191860161100f565b5098975050505050505050565b828152604060208201526000610b4d6040830184610dea565b60006020828403121561107b57600080fd5b815167ffffffffffffffff81111561109257600080fd5b610b4d84828501610f5a565b6000602082840312156110b057600080fd5b81518015158114610e8157600080fd5b634e487b7160e01b600052601160045260246000fd5b818103818111156110e9576110e96110c0565b92915050565b60008351611101818460208801610dc6565b835190830190611115818360208801610dc6565b01949350505050565b60008251611130818460208701610dc6565b601760f91b920191825250600101919050565b600060018201611155576111556110c0565b5060010190565b634e487b7160e01b600052601260045260246000fd5b6000826111815761118161115c565b500490565b6000826111955761119561115c565b500690565b808201808211156110e9576110e96110c0565b601f8211156108c657600081815260208120601f850160051c810160208610156111d45750805b601f850160051c820191505b818110156111f3578281556001016111e0565b505050505050565b815167ffffffffffffffff81111561121557611215610c1a565b611229816112238454610f20565b846111ad565b602080601f83116001811461125e57600084156112465750858301515b600019600386901b1c1916600185901b1785556111f3565b600085815260208120601f198616915b8281101561128d5788860151825594840194600190910190840161126e565b50858210156112ab5787850151600019600388901b60f8161c191681555b5050505050600190811b0190555056fea26469706673582212206b5d832658cbd393fc3e01826739b06671e949a1ba66e37e18e55cfb216e196864736f6c63430008100033

Verified Source Code Partial Match

Compiler: v0.8.16+commit.07a7930e EVM: london Optimization: Yes (200 runs)
IJBTokenUriResolver.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IJBTokenUriResolver {
  function getUri(uint256 _projectId) external view returns (string memory tokenUri);
}
JBProjectMetadata.sol 11 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/** 
  @member content The metadata content.
  @member domain The domain within which the metadata applies.
*/
struct JBProjectMetadata {
  string content;
  uint256 domain;
}
JBProjectHandles.sol 269 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import '@ensdomains/ens-contracts/contracts/registry/ENS.sol'; // This is an interface...
import '@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol';
import '@jbx-protocol/juice-contracts-v3/contracts/abstract/JBOperatable.sol';
import '@openzeppelin/contracts/interfaces/IERC721.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import './interfaces/IJBProjectHandles.sol';
import './libraries/JBOperations2.sol';

/** 
  @title 
  JBProjectHandles

  @author 
  peri, jango, drgorilla

  @notice 
  Manages reverse records that point from JB project IDs to ENS nodes. If the reverse record of a project ID is pointed to an ENS node with a TXT record matching the ID of that project, then the ENS node will be considered the "handle" for that project.

  @dev
  Adheres to -
  IJBProjectHandles: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.

  @dev
  Inherits from -
  JBOperatable: Several functions in this contract can only be accessed by a project owner, or an address that has been preconfifigured to be an operator of the project.
*/
contract JBProjectHandles is IJBProjectHandles, JBOperatable {
  //*********************************************************************//
  // --------------------------- custom errors ------------------------- //
  //*********************************************************************//
  error EMPTY_NAME_PART();
  error NO_PARTS();

  //*********************************************************************//
  // --------------------- internal stored properties ------------------ //
  //*********************************************************************//

  /** 
    @notice
    Mapping of project ID to an array of strings that make up an ENS name and its subdomains.

    @dev
    ["jbx", "dao", "foo"] represents foo.dao.jbx.eth.

    _projectId The ID of the project to get an ENS name for.
  */
  mapping(uint256 => string[]) internal _ensNamePartsOf;

  //*********************************************************************//
  // ---------------- public constant stored properties ---------------- //
  //*********************************************************************//

  /** 
    @notice
    The key of the ENS text record.
  */
  string public constant override TEXT_KEY = 'juicebox_project_id';

  //*********************************************************************//
  // --------------- public immutable stored properties ---------------- //
  //*********************************************************************//

  /** 
    @notice
    A contract which mints ERC-721's that represent project ownership and transfers.
  */
  IJBProjects public immutable override projects;

  /** 
    @notice
    The previous JBProjectHandles version, to not loose previously set handles
  */
  IJBProjectHandles public immutable oldJbProjectHandles;

  /** 
    @notice
    The ENS registry contract address.

    @dev
    Same on every network
  */
  ENS public constant ensRegistry = ENS(0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e);

  //*********************************************************************//
  // ------------------------- external views -------------------------- //
  //*********************************************************************//

  /** 
    @notice 
    Returns the handle for a project.

    @dev 
    Requires a TXT record for the `TEXT_KEY` that matches the `_projectId`.
    As some handles were set in the previous version, try to retrieve it too
    (this version takes precedence on the previous version)

    @param _projectId The ID of the project to get the handle of.

    @return The project's handle.
  */
  function handleOf(uint256 _projectId) external view override returns (string memory) {
    // Get a reference to the project's ENS name parts.
    string[] memory _ensNameParts = _ensNamePartsOf[_projectId];

    // Is the ENS not set in this contract?
    if (_ensNameParts.length == 0) {
          // Retrieve a handle potentially stored in the previous JbProjectHandle contract
          _ensNameParts = oldJbProjectHandles.ensNamePartsOf(_projectId);

          // Return an empty string if no ENS set in both versions    
          if(_ensNameParts.length == 0) return '';
    }

    // Compute the hash of the handle
    bytes32 _hashedName = _namehash(_ensNameParts);

    // Get the resolver for this handle, returns address(0) if non-existing
    address textResolver = ensRegistry.resolver(_hashedName);

    // If the handle is not a registered ENS, return empty string
    if(textResolver == address(0)) return '';

    // Find the projectId that the text record of the ENS name is mapped to.
    string memory textRecordProjectId = ITextResolver(textResolver).text(_hashedName, TEXT_KEY);

    // Return empty string if text record from ENS name doesn't match projectId.
    if (keccak256(bytes(textRecordProjectId)) != keccak256(bytes(Strings.toString(_projectId))))
      return '';

    // Format the handle from the name parts.
    return _formatHandle(_ensNameParts);
  }

  /** 
    @notice 
    The parts of the stored ENS name of a project.

    @param _projectId The ID of the project to get the ENS name of.

    @return The parts of the ENS name parts of a project.
  */
  function ensNamePartsOf(uint256 _projectId) external view override returns (string[] memory) {
    return _ensNamePartsOf[_projectId];
  }

  //*********************************************************************//
  // ---------------------------- constructor -------------------------- //
  //*********************************************************************//

  /** 
    @param _projects A contract which mints ERC-721's that represent project ownership and transfers.
    @param _operatorStore A contract storing operator assignments.
  */
  constructor(
    IJBProjects _projects,
    IJBOperatorStore _operatorStore,
    IJBProjectHandles _oldJbProjectHandles
  ) JBOperatable(_operatorStore) {
    projects = _projects;
    oldJbProjectHandles = _oldJbProjectHandles;
  }

  //*********************************************************************//
  // --------------------- external transactions ----------------------- //
  //*********************************************************************//

  /** 
    @notice 
    Associate an ENS name with a project.

    @dev
    ["jbx", "dao", "foo"] represents foo.dao.jbx.eth.

    @dev
    Only a project's owner or a designated operator can set its ENS name parts.

    @param _projectId The ID of the project to set an ENS handle for.
    @param _parts The parts of the ENS domain to use as the project handle, excluding the trailing .eth.
  */
  function setEnsNamePartsFor(uint256 _projectId, string[] memory _parts)
    external
    override
    requirePermission(projects.ownerOf(_projectId), _projectId, JBOperations2.SET_ENS_NAME_FOR)
  {
    // Get a reference to the number of parts are in the ENS name.
    uint256 _partsLength = _parts.length;

    // Make sure there are ens name parts.
    if (_parts.length == 0) revert NO_PARTS();

    // Make sure no provided parts are empty.
    for (uint256 _i = 0; _i < _partsLength; ) {
      if (bytes(_parts[_i]).length == 0) revert EMPTY_NAME_PART();
      unchecked {
        ++_i;
      }
    }

    // Store the parts.
    _ensNamePartsOf[_projectId] = _parts;

    emit SetEnsNameParts(_projectId, _formatHandle(_parts), _parts, msg.sender);
  }

  //*********************************************************************//
  // ------------------------ internal functions ----------------------- //
  //*********************************************************************//

  /** 
    @notice 
    Formats ENS name parts into a handle.

    @param _ensNameParts The ENS name parts to format into a handle.

    @return _handle The formatted ENS handle.
  */
  function _formatHandle(string[] memory _ensNameParts)
    internal
    pure
    returns (string memory _handle)
  {
    // Get a reference to the number of parts are in the ENS name.
    uint256 _partsLength = _ensNameParts.length;

    // Concatenate each name part.
    for (uint256 _i = 1; _i <= _partsLength; ) {
      _handle = string(abi.encodePacked(_handle, _ensNameParts[_partsLength - _i]));

      // Add a dot if this part isn't the last.
      if (_i < _partsLength) _handle = string(abi.encodePacked(_handle, '.'));

      unchecked {
        ++_i;
      }
    }
  }

  /** 
    @notice 
    Returns a namehash for an ENS name.

    @dev 
    See https://eips.ethereum.org/EIPS/eip-137.

    @param _ensNameParts The parts of an ENS name to hash.

    @return namehash The namehash for an ENS name parts.
  */
  function _namehash(string[] memory _ensNameParts) internal pure returns (bytes32 namehash) {
    // Hash the trailing "eth" suffix.
    namehash = keccak256(abi.encodePacked(namehash, keccak256(abi.encodePacked('eth'))));

    // Get a reference to the number of parts are in the ENS name.
    uint256 _nameLength = _ensNameParts.length;

    // Hash each part.
    for (uint256 _i = 0; _i < _nameLength; ) {
      namehash = keccak256(
        abi.encodePacked(namehash, keccak256(abi.encodePacked(_ensNameParts[_i])))
      );
      unchecked {
        ++_i;
      }
    }
  }
}
IJBProjectHandles.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import '@ensdomains/ens-contracts/contracts/resolvers/profiles/ITextResolver.sol';
import '@jbx-protocol/juice-contracts-v3/contracts/interfaces/IJBProjects.sol';

interface IJBProjectHandles {
  event SetEnsNameParts(
    uint256 indexed projectId,
    string indexed handle,
    string[] parts,
    address caller
  );

  function setEnsNamePartsFor(uint256 _projectId, string[] memory _parts) external;

  function ensNamePartsOf(uint256 _projectId) external view returns (string[] memory);

  function TEXT_KEY() external view returns (string memory);

  function projects() external view returns (IJBProjects);

  function handleOf(uint256 _projectId) external view returns (string memory);
}
JBOperations2.sol 6 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

library JBOperations2 {
  uint256 public constant SET_ENS_NAME_FOR = 19;
}
IJBProjects.sol 36 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import './../structs/JBProjectMetadata.sol';
import './IJBTokenUriResolver.sol';

interface IJBProjects is IERC721 {
  event Create(
    uint256 indexed projectId,
    address indexed owner,
    JBProjectMetadata metadata,
    address caller
  );

  event SetMetadata(uint256 indexed projectId, JBProjectMetadata metadata, address caller);

  event SetTokenUriResolver(IJBTokenUriResolver indexed resolver, address caller);

  function count() external view returns (uint256);

  function metadataContentOf(uint256 _projectId, uint256 _domain)
    external
    view
    returns (string memory);

  function tokenUriResolver() external view returns (IJBTokenUriResolver);

  function createFor(address _owner, JBProjectMetadata calldata _metadata)
    external
    returns (uint256 projectId);

  function setMetadataOf(uint256 _projectId, JBProjectMetadata calldata _metadata) external;

  function setTokenUriResolver(IJBTokenUriResolver _newResolver) external;
}
JBOperatable.sol 127 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;

import './../interfaces/IJBOperatable.sol';

/** 
  @notice
  Modifiers to allow access to functions based on the message sender's operator status.

  @dev
  Adheres to -
  IJBOperatable: General interface for the methods in this contract that interact with the blockchain's state according to the protocol's rules.
*/
abstract contract JBOperatable is IJBOperatable {
  //*********************************************************************//
  // --------------------------- custom errors -------------------------- //
  //*********************************************************************//
  error UNAUTHORIZED();

  //*********************************************************************//
  // ---------------------------- modifiers ---------------------------- //
  //*********************************************************************//

  /** 
    @notice
    Only allows the speficied account or an operator of the account to proceed. 

    @param _account The account to check for.
    @param _domain The domain namespace to look for an operator within. 
    @param _permissionIndex The index of the permission to check for. 
  */
  modifier requirePermission(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex
  ) {
    _requirePermission(_account, _domain, _permissionIndex);
    _;
  }

  /** 
    @notice
    Only allows the speficied account, an operator of the account to proceed, or a truthy override flag. 

    @param _account The account to check for.
    @param _domain The domain namespace to look for an operator within. 
    @param _permissionIndex The index of the permission to check for. 
    @param _override A condition to force allowance for.
  */
  modifier requirePermissionAllowingOverride(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex,
    bool _override
  ) {
    _requirePermissionAllowingOverride(_account, _domain, _permissionIndex, _override);
    _;
  }

  //*********************************************************************//
  // ---------------- public immutable stored properties --------------- //
  //*********************************************************************//

  /** 
    @notice 
    A contract storing operator assignments.
  */
  IJBOperatorStore public immutable override operatorStore;

  //*********************************************************************//
  // -------------------------- constructor ---------------------------- //
  //*********************************************************************//

  /** 
    @param _operatorStore A contract storing operator assignments.
  */
  constructor(IJBOperatorStore _operatorStore) {
    operatorStore = _operatorStore;
  }

  //*********************************************************************//
  // -------------------------- internal views ------------------------- //
  //*********************************************************************//

  /** 
    @notice
    Require the message sender is either the account or has the specified permission.

    @param _account The account to allow.
    @param _domain The domain namespace within which the permission index will be checked.
    @param _permissionIndex The permission index that an operator must have within the specified domain to be allowed.
  */
  function _requirePermission(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex
  ) internal view {
    if (
      msg.sender != _account &&
      !operatorStore.hasPermission(msg.sender, _account, _domain, _permissionIndex) &&
      !operatorStore.hasPermission(msg.sender, _account, 0, _permissionIndex)
    ) revert UNAUTHORIZED();
  }

  /** 
    @notice
    Require the message sender is either the account, has the specified permission, or the override condition is true.

    @param _account The account to allow.
    @param _domain The domain namespace within which the permission index will be checked.
    @param _domain The permission index that an operator must have within the specified domain to be allowed.
    @param _override The override condition to allow.
  */
  function _requirePermissionAllowingOverride(
    address _account,
    uint256 _domain,
    uint256 _permissionIndex,
    bool _override
  ) internal view {
    if (
      !_override &&
      msg.sender != _account &&
      !operatorStore.hasPermission(msg.sender, _account, _domain, _permissionIndex) &&
      !operatorStore.hasPermission(msg.sender, _account, 0, _permissionIndex)
    ) revert UNAUTHORIZED();
  }
}
IERC721.sol 143 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}
Strings.sol 67 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}
IERC165.sol 25 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
ENS.sol 32 lines
pragma solidity >=0.8.4;

interface ENS {

    // Logged when the owner of a node assigns a new owner to a subnode.
    event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner);

    // Logged when the owner of a node transfers ownership to a new account.
    event Transfer(bytes32 indexed node, address owner);

    // Logged when the resolver for a node changes.
    event NewResolver(bytes32 indexed node, address resolver);

    // Logged when the TTL of a node changes
    event NewTTL(bytes32 indexed node, uint64 ttl);

    // Logged when an operator is added or removed.
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    function setRecord(bytes32 node, address owner, address resolver, uint64 ttl) external virtual;
    function setSubnodeRecord(bytes32 node, bytes32 label, address owner, address resolver, uint64 ttl) external virtual;
    function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external virtual returns(bytes32);
    function setResolver(bytes32 node, address resolver) external virtual;
    function setOwner(bytes32 node, address owner) external virtual;
    function setTTL(bytes32 node, uint64 ttl) external virtual;
    function setApprovalForAll(address operator, bool approved) external virtual;
    function owner(bytes32 node) external virtual view returns (address);
    function resolver(bytes32 node) external virtual view returns (address);
    function ttl(bytes32 node) external virtual view returns (uint64);
    function recordExists(bytes32 node) external virtual view returns (bool);
    function isApprovedForAll(address owner, address operator) external virtual view returns (bool);
}
ITextResolver.sol 14 lines
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface ITextResolver {
    event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);

    /**
     * Returns the text data associated with an ENS node and key.
     * @param node The ENS node to query.
     * @param key The text data key to query.
     * @return The associated text data.
     */
    function text(bytes32 node, string calldata key) external view returns (string memory);
}
IERC721.sol 6 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol)

pragma solidity ^0.8.0;

import "../token/ERC721/IERC721.sol";
IJBOperatable.sol 8 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './IJBOperatorStore.sol';

interface IJBOperatable {
  function operatorStore() external view returns (IJBOperatorStore);
}
IJBOperatorStore.sol 38 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import './../structs/JBOperatorData.sol';

interface IJBOperatorStore {
  event SetOperator(
    address indexed operator,
    address indexed account,
    uint256 indexed domain,
    uint256[] permissionIndexes,
    uint256 packed
  );

  function permissionsOf(
    address _operator,
    address _account,
    uint256 _domain
  ) external view returns (uint256);

  function hasPermission(
    address _operator,
    address _account,
    uint256 _domain,
    uint256 _permissionIndex
  ) external view returns (bool);

  function hasPermissions(
    address _operator,
    address _account,
    uint256 _domain,
    uint256[] calldata _permissionIndexes
  ) external view returns (bool);

  function setOperator(JBOperatorData calldata _operatorData) external;

  function setOperators(JBOperatorData[] calldata _operatorData) external;
}
JBOperatorData.sol 13 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/** 
  @member operator The address of the operator.
  @member domain The domain within which the operator is being given permissions. A domain of 0 is a wildcard domain, which gives an operator access to all domains.
  @member permissionIndexes The indexes of the permissions the operator is being given.
*/
struct JBOperatorData {
  address operator;
  uint256 domain;
  uint256[] permissionIndexes;
}

Read Contract

TEXT_KEY 0xc548f309 → string
ensNamePartsOf 0x30abe987 → string[]
ensRegistry 0x7d73b231 → address
handleOf 0x49491987 → string
oldJbProjectHandles 0xd9833b32 → address
operatorStore 0xad007d63 → address
projects 0x8b79543c → address

Write Contract 1 functions

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

setEnsNamePartsFor 0x2b5b94ad
uint256 _projectId
string[] _parts

Recent Transactions

No transactions found for this address