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
Name | Type | Description |
---|---|---|
_manufacturerRegistry | contract IManufacturerRegistry | Address of the ManufacturerRegistry contract |
_maxLockinPeriod | uint256 | The maximum amount of time a chip can be locked into a service for beyond the project's creation timestamp |
_migrationSigner | address | Address 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
Name | Type | Description |
---|---|---|
_projectRegistrar | contract IProjectRegistrar | Address of the ProjectRegistrar contract |
_nameHash | bytes32 | Label of the project's node in the ERS tree |
_servicesRegistry | contract IServicesRegistry | Address of the ServicesRegistry contract |
_serviceId | bytes32 | The serviceId of the project's preferred service |
_lockinPeriod | uint256 | The 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
Name | Type | Description |
---|---|---|
_chipId | address | Chip ID (address) |
_chipOwner | address | Owner of the chip |
_nameHash | bytes32 | Label of the node in the ERS tree |
_manufacturerValidation | struct IChipRegistry.ManufacturerValidation | Struct containing information for chip's inclusion in manufacturer's enrollment |
_custodyProof | bytes | Proof of chip custody by the developer |
removeProjectEnrollment
function removeProjectEnrollment(IProjectRegistrar _projectRegistrar) external
ONLY Developer REGISTRAR: Remove project enrollment from ChipRegistry.
Parameters
Name | Type | Description |
---|---|---|
_projectRegistrar | contract IProjectRegistrar | Address of the ProjectRegistrar contract |
setChipNodeOwner
function setChipNodeOwner(address _chipId, address _newOwner) external
Set the owner of a chip through its projectRegistrar.
Parameters
Name | Type | Description |
---|---|---|
_chipId | address | The chip public key |
_newOwner | address | The 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
Name | Type | Description |
---|---|---|
_ers | contract IERS | Address of the ERS contract |
_developerRegistry | contract IDeveloperRegistry | Address 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
Name | Type | Description |
---|---|---|
_maxLockinPeriod | uint256 | The 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
Name | Type | Description |
---|---|---|
_migrationSigner | address | The new migration signer address |
resolveChip
function resolveChip(address _chipId) external view returns (IServicesRegistry.Record[] memory)
Return the primary service content.
Parameters
Name | Type | Description |
---|---|---|
_chipId | address | The chip public key |
Return Values
Name | Type | Description |
---|---|---|
[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
Name | Type | Description |
---|---|---|
_chipId | address | The chip public key |
Return Values
Name | Type | Description |
---|---|---|
[0] | bytes32 | The ERS node of the chip |
ownerOf
function ownerOf(address _chipId) public view returns (address)
Get the owner of a chip through its projectRegistrar.
Parameters
Name | Type | Description |
---|---|---|
_chipId | address | The chip public key |
Return Values
Name | Type | Description |
---|---|---|
[0] | address | The owner of the chip |
supportsInterface
function supportsInterface(bytes4 _interfaceId) public view returns (bool)
Check if the contract supports a specific interface.
Parameters
Name | Type | Description |
---|---|---|
_interfaceId | bytes4 | The interface ID to check for |