Contracts
ManufacturerRegistry

Solidity API

ManufacturerRegistry

Registry for tracking and maintaining relevant info for Manufacturers. In order to make chips valid for the protocol, manufacturers must register their chips in enrollments. Each enrollment will be assigned an id, which must be referenced when adding chips to the registry.

ManufacturerAdded

event ManufacturerAdded(bytes32 manufacturerId, address owner)

ManufacturerRemoved

event ManufacturerRemoved(bytes32 manufacturerId)

EnrollmentAdded

event EnrollmentAdded(bytes32 manufacturerId, bytes32 enrollmentId, address manufacturerCertSigner, address authModel, string chipValidationDataUri, string bootloaderApp, string chipModel)

ManufacturerOwnerUpdated

event ManufacturerOwnerUpdated(bytes32 manufacturerId, address newOwner)

EnrollmentInfo

struct EnrollmentInfo {
  uint256 manufacturerId;
  address manufacturerCertSigner;
  address authModel;
  string chipValidationDataUri;
  string bootloaderApp;
  string chipModel;
}

ManufacturerInfo

struct ManufacturerInfo {
  address owner;
  bool registered;
  bytes32[] enrollments;
  uint256 nonce;
}

onlyManufacturer

modifier onlyManufacturer(bytes32 _manufacturerId)

enrollments

mapping(bytes32 => struct ManufacturerRegistry.EnrollmentInfo) enrollments

manufacturers

mapping(bytes32 => struct ManufacturerRegistry.ManufacturerInfo) manufacturers

constructor

constructor(address _governance) public

Constructor for ManufacturerRegistry. Sets owner to governance address.

Parameters

NameTypeDescription
_governanceaddressAddress of governance

addChipEnrollment

function addChipEnrollment(bytes32 _manufacturerId, address _certSigner, address _authModel, string _chipValidationDataUri, string _bootloaderApp, string _chipModel) external returns (bytes32 enrollmentId)

ONLY MANUFACTURER: Adds a new enrollment for an active manufacturer. Enrollment is assigned an id which is returned. Only owner address associated with _manufacturerId can call this function.

Parameters

NameTypeDescription
_manufacturerIdbytes32Bytes32 identifier for manufacturer (i.e. could be hash of manufacturer name)
_certSigneraddressAddress of certificate signer for this enrollment
_authModeladdressAddress of contract that implements example signature validation for a chip
_chipValidationDataUristringURI pointing to location of off-chain data required to validate chip is part of manufacturer enrollment
_bootloaderAppstringBootloader app for this enrollment
_chipModelstringChip model for this enrollment

Return Values

NameTypeDescription
enrollmentIdbytes32Id of enrollment

addManufacturer

function addManufacturer(bytes32 _manufacturerId, address _owner) external

ONLY OWNER: Registers a new manufacturer. Manufacturer is marked as registered forever once added.

Parameters

NameTypeDescription
_manufacturerIdbytes32Bytes32 identifier for manufacturer (i.e. could be hash of manufacturer name)
_owneraddressAddress of Perp Vault contract

removeManufacturer

function removeManufacturer(bytes32 _manufacturerId) external

ONLY OWNER: Removes an active manufacturer, putting their history in read-only mode.

Parameters

NameTypeDescription
_manufacturerIdbytes32Bytes32 identifier for manufacturer (i.e. could be hash of manufacturer name)

updateManufacturerOwner

function updateManufacturerOwner(bytes32 _manufacturerId, address _newOwner) external

ONLY MANUFACTURER: Updates the owner address for a manufacturer.

Parameters

NameTypeDescription
_manufacturerIdbytes32Bytes32 identifier for manufacturer
_newOwneraddressAddress of new owner

isEnrolledChip

function isEnrolledChip(bytes32 _enrollmentId, address _chipId, bytes calldata _manufacturerCertificate, bytes calldata _payload) external view returns (bool)

Validate that _chipId is included in the enrollment.

Parameters

NameTypeDescription
_enrollmentIdbytes32Bytes32 identifier of the manufacturer enrollment
_chipIdaddressPublic key associated with the chip
_manufacturerCertificatebytesManufacturer certificate for the chip
_payloadbytesAdditional data required for verification

Return Values

NameTypeDescription
[0]boolBool indicating whether the chip is valid

getManufacturerInfo

function getManufacturerInfo(bytes32 _manufacturerId) external view returns (struct ManufacturerRegistry.ManufacturerInfo)

getEnrollmentInfo

function getEnrollmentInfo(bytes32 _enrollmentId) public view returns (struct ManufacturerRegistry.EnrollmentInfo)

getEnrollmentBootloaderApp

function getEnrollmentBootloaderApp(bytes32 _enrollmentId) external view returns (string)