Contracts
ArxProjectEnrollmentManager

Solidity API

ArxProjectEnrollmentManager

Smart contract that handles deployment of new Project Registrar contracts for new TSM projects. This should be set as the owner of the TSM Registrar contract before adding any new projects.

ProjectRegistrarDeployed

event ProjectRegistrarDeployed(address projectRegistrar, address owner)

NewTransferPolicySet

event NewTransferPolicySet(contract ITransferPolicy transferPolicy)

NewMaxBlockWindowSet

event NewMaxBlockWindowSet(uint256 maxBlockWindow)

chipRegistry

contract IChipRegistry chipRegistry

tsmRegistrar

contract ITSMRegistrar tsmRegistrar

ers

contract IERS ers

manufacturerRegistry

contract IManufacturerRegistry manufacturerRegistry

transferPolicy

contract ITransferPolicy transferPolicy

maxBlockWindow

uint256 maxBlockWindow

constructor

constructor(contract IChipRegistry _chipRegistry, contract ITSMRegistrar _tsmRegistrar, contract IERS _ers, contract IManufacturerRegistry _manufacturerRegistry, contract ITransferPolicy _transferPolicy, uint256 _maxBlockWindow) public

Parameters

NameTypeDescription
_chipRegistrycontract IChipRegistryThe Chip Registry contract of the ERS system
_tsmRegistrarcontract ITSMRegistrarThe TSM Registrar contract of the ERS system
_erscontract IERSThe ERS Registry contract of the ERS system
_manufacturerRegistrycontract IManufacturerRegistryThe Manufacturer Registry contract of the ERS system
_transferPolicycontract ITransferPolicyThe transfer policy contract for the project being deployed
_maxBlockWindowuint256The maximum amount of blocks a signature used for updating chip table is valid for passed to all ProjectRegistrar contracts deployed by this contract

addProject

function addProject(address _projectManager, string _projectClaimDataUri, bytes32 _nameHash, bytes32 _merkleRoot, address _projectPublicKey, address _provingChip, struct IChipRegistry.TSMMerkleInfo _tsmMerkleInfo, struct IChipRegistry.ManufacturerValidation _manufacturerValidation, bytes _chipOwnershipProof, bytes _projectOwnershipProof) public

Adds a new TSM's project to the ERS system by deploying the ProjectRegistrar contract via CREATE2 and registering it to the TSM Registrar. We use CREATE2 because we need the projectManager to provide proof of ownership by signing a hash of the projectRegistrar address with the projectPublicKey. This is not possible unless we know the address ahead of time, hence we use CREATE2 which allows us to know the address.

Parameters

NameTypeDescription
_projectManageraddressThe address that will be set as the owner of the project registrar contract
_projectClaimDataUristringURI pointing to location of off-chain data required to claim chips
_nameHashbytes32Keccak256 hash of the human-readable name for the chip being claimed
_merkleRootbytes32Merkle root of the TSM Merkle Tree made up of the chips enrolled to this project
_projectPublicKeyaddressPublic key used in the generation of the TSM certificates
_provingChipaddress
_tsmMerkleInfostruct IChipRegistry.TSMMerkleInfo
_manufacturerValidationstruct IChipRegistry.ManufacturerValidation
_chipOwnershipProofbytes
_projectOwnershipProofbytesSigned hash of the _projectRegistrar address by the _projectPublicKey

setTransferPolicy

function setTransferPolicy(contract ITransferPolicy _transferPolicy) external

Sets the transfer policy for all projects deployed by this contract

Parameters

NameTypeDescription
_transferPolicycontract ITransferPolicyThe new transfer policy contract

setMaxBlockWindow

function setMaxBlockWindow(uint256 _maxBlockWindow) external

Sets the max block window for all projects deployed by this contract. Max block window used to validate ownership signatures for chip claims made through ProjectRegistrar.

Parameters

NameTypeDescription
_maxBlockWindowuint256The new max block window

_isNotZeroAddress

function _isNotZeroAddress(address _address) internal pure returns (bool)

Returns true if passed address is not the zero address

Parameters

NameTypeDescription
_addressaddressThe address to check

_validateOwnershipAndTreeInclusion

function _validateOwnershipAndTreeInclusion(address _provingChip, bytes _chipOwnershipProof, bytes32 _merkleRoot, struct IChipRegistry.TSMMerkleInfo _tsmMerkleInfo, struct IChipRegistry.ManufacturerValidation _manufacturerValidation) internal view

Validates that the chip used as proof of ownership is in possesion of the msg.sender, is included in the project merkle root, AND is a chip that's been enrolled in the ManufacturerRegistry.

Parameters

NameTypeDescription
_provingChipaddressThe chip used as proof of ownership
_chipOwnershipProofbytesThe signature of the chip owner over the hash of the chainId and msg.sender
_merkleRootbytes32The merkle root of the project
_tsmMerkleInfostruct IChipRegistry.TSMMerkleInfoThe TSM Merkle Info of the chip
_manufacturerValidationstruct IChipRegistry.ManufacturerValidationManufacturer Validation info for the chip

_deployProjectRegistrarAndAddProject

function _deployProjectRegistrarAndAddProject(address _projectManager, bytes32 _merkleRoot, bytes32 _nameHash, address _projectPublicKey, bytes _projectOwnershipProof, string _projectClaimDataUri) internal

Deploys a new ProjectRegistrar contract via CREATE2 and registers it to the TSM Registrar

Parameters

NameTypeDescription
_projectManageraddressThe address that will be set as the owner of the project registrar contract
_merkleRootbytes32Merkle root of the TSM Merkle Tree made up of the chips enrolled to this project
_nameHashbytes32Keccak256 hash of the human-readable name for the chip being claimed
_projectPublicKeyaddressPublic key used in the generation of the TSM certificates
_projectOwnershipProofbytesSigned hash of the _projectRegistrar address by the _projectPublicKey
_projectClaimDataUristringURI pointing to location of off-chain data required to claim chips