Contracts
ChipRegistry

Solidity API

ChipRegistry

Entrypoint for resolving chips added to ERS Protocol. Developers can enroll new projects into this registry by specifying a ProjectRegistrar to manage chip additions. Chip additions are forwarded from ProjectRegistrars that typically mint an ERC-721 compliant "token" of the chip to the claimant and other metadata associated with the chip is set. Any project looking to integrate ERS chips should get resolution information about chips from this address. Because chips are represented as tokens any physical chip transfers should also be completed on-chain in order to get full functionality for the chip.

ProjectEnrollmentAdded

event ProjectEnrollmentAdded(address indexed developerRegistrar, address indexed projectRegistrar, bytes32 nameHash, address servicesRegistry, bytes32 serviceId)

ProjectEnrollmentRemoved

event ProjectEnrollmentRemoved(address indexed developerRegistrar, address indexed projectRegistrar, bytes32 nameHash)

ChipAdded

event ChipAdded(address indexed chipId, address indexed projectRegistrar, bytes32 indexed manufacturerEnrollmentId, address owner, bytes32 serviceId, bytes32 ersNode, bool hasDeveloperCustodyProof)

MaxLockinPeriodUpdated

event MaxLockinPeriodUpdated(uint256 maxLockinPeriod)

MigrationSignerUpdated

event MigrationSignerUpdated(address migrationSigner)

RegistryInitialized

event RegistryInitialized(address ers, address developerRegistry)

ProjectInfo

struct ProjectInfo {
  bytes32 nameHash;
  IDeveloperRegistrar developerRegistrar;
  IServicesRegistry servicesRegistry;
  bool chipsAdded;
  bytes32 serviceId;
  uint256 lockinPeriod;
  uint256 creationTimestamp;
}

ChipInfo

struct ChipInfo {
  bytes32 nameHash;
  address projectRegistrar;
  bytes32 manufacturerEnrollmentId;
  bool chipEnrolled;
}

EIP712_SIGNATURE_DOMAIN

string public constant EIP712_SIGNATURE_DOMAIN

EIP712_SIGNATURE_VERSION

string public constant EIP712_SIGNATURE_VERSION

manufacturerRegistry

IManufacturerRegistry public immutable manufacturerRegistry

ers

IERS public ers

developerRegistry

IDeveloperRegistry public developerRegistry

initialized

bool public initialized

migrationSigner

address public migrationSigner

projectEnrollments

mapping(IProjectRegistrar => ProjectInfo) public projectEnrollments

chipEnrollments

mapping(address => ChipInfo) public chipEnrollments

maxLockinPeriod

uint256 public maxLockinPeriod

constructor

constructor(IManufacturerRegistry _manufacturerRegistry, uint256 _maxLockinPeriod, address _migrationSigner) public

Constructor for ChipRegistry

Parameters

NameTypeDescription
_manufacturerRegistrycontract IManufacturerRegistryAddress of the ManufacturerRegistry contract
_maxLockinPerioduint256The maximum amount of time a chip can be locked into a service for beyond the project's creation timestamp
_migrationSigneraddressAddress of the migration signer

addProjectEnrollment

function addProjectEnrollment(IProjectRegistrar _projectRegistrar, bytes32 _nameHash, IServicesRegistry _servicesRegistry, bytes32 _serviceId, uint256 _lockinPeriod) external

_ONLY Developer REGISTRAR: Enroll new project in ChipRegistry. This function is only callable by DeveloperRegistrars. In order to use this function the project must first sign a message of the _projectRegistrar address with the projectPublicKey's matching private key. This key MUST be the same key used to sign all the chip certificates for the project.

Parameters

NameTypeDescription
_projectRegistrarcontract IProjectRegistrarAddress of the ProjectRegistrar contract
_nameHashbytes32Label of the project's node in the ERS tree
_servicesRegistrycontract IServicesRegistryAddress of the ServicesRegistry contract
_serviceIdbytes32The serviceId of the project's preferred service
_lockinPerioduint256The amount of time a chip can be locked into a service for beyond the project's creation timestamp

addChip

function addChip(address _chipId, address _chipOwner, bytes32 _nameHash, IChipRegistry.ManufacturerValidation memory _manufacturerValidation, bytes memory _custodyProof) external

Allow a project to add chips. Enrollment allows the chip to resolve to the project's preferred service. Additionally, claiming creates a Physically-Bound Token representation of the chip.

Parameters

NameTypeDescription
_chipIdaddressChip ID (address)
_chipOwneraddressOwner of the chip
_nameHashbytes32Label of the node in the ERS tree
_manufacturerValidationstruct IChipRegistry.ManufacturerValidationStruct containing information for chip's inclusion in manufacturer's enrollment
_custodyProofbytesProof of chip custody by the developer

removeProjectEnrollment

function removeProjectEnrollment(IProjectRegistrar _projectRegistrar) external

ONLY Developer REGISTRAR: Remove project enrollment from ChipRegistry.

Parameters

NameTypeDescription
_projectRegistrarcontract IProjectRegistrarAddress of the ProjectRegistrar contract

setChipNodeOwner

function setChipNodeOwner(address _chipId, address _newOwner) external

Set the owner of a chip through its projectRegistrar.

Parameters

NameTypeDescription
_chipIdaddressThe chip public key
_newOwneraddressThe new owner of the chip

initialize

function initialize(IERS _ers, IDeveloperRegistry _developerRegistry) external

ONLY OWNER: Initialize ChipRegistry contract with ERS and Developer Registry addresses.

Parameters

NameTypeDescription
_erscontract IERSAddress of the ERS contract
_developerRegistrycontract IDeveloperRegistryAddress of the DeveloperRegistry contract

updateMaxLockinPeriod

function updateMaxLockinPeriod(uint256 _maxLockinPeriod) external

ONLY OWNER: Update the maximum amount of time a chip can be locked into a service for beyond the project's creation timestamp.

Parameters

NameTypeDescription
_maxLockinPerioduint256The new maximum amount of time a chip can be locked into a service for beyond the project's creation timestamp

updateMigrationSigner

function updateMigrationSigner(address _migrationSigner) external

ONLY OWNER: Update the migration signer address.

Parameters

NameTypeDescription
_migrationSigneraddressThe new migration signer address

resolveChip

function resolveChip(address _chipId) external view returns (IServicesRegistry.Record[] memory)

Return the primary service content.

Parameters

NameTypeDescription
_chipIdaddressThe chip public key

Return Values

NameTypeDescription
[0]IServicesRegistry.Record[]The content associated with the chip (if chip has been claimed already)

node

function node(address _chipId) public view returns (bytes32)

Get the chip's ERS node (function name follows ENS reverse registar naming conventions).

Parameters

NameTypeDescription
_chipIdaddressThe chip public key

Return Values

NameTypeDescription
[0]bytes32The ERS node of the chip

ownerOf

function ownerOf(address _chipId) public view returns (address)

Get the owner of a chip through its projectRegistrar.

Parameters

NameTypeDescription
_chipIdaddressThe chip public key

Return Values

NameTypeDescription
[0]addressThe owner of the chip

supportsInterface

function supportsInterface(bytes4 _interfaceId) public view returns (bool)

Check if the contract supports a specific interface.

Parameters

NameTypeDescription
_interfaceIdbytes4The interface ID to check for