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
Name | Type | Description |
---|---|---|
_chipRegistry | contract IChipRegistry | The Chip Registry contract of the ERS system |
_tsmRegistrar | contract ITSMRegistrar | The TSM Registrar contract of the ERS system |
_ers | contract IERS | The ERS Registry contract of the ERS system |
_manufacturerRegistry | contract IManufacturerRegistry | The Manufacturer Registry contract of the ERS system |
_transferPolicy | contract ITransferPolicy | The transfer policy contract for the project being deployed |
_maxBlockWindow | uint256 | The 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
Name | Type | Description |
---|---|---|
_projectManager | address | The address that will be set as the owner of the project registrar contract |
_projectClaimDataUri | string | URI pointing to location of off-chain data required to claim chips |
_nameHash | bytes32 | Keccak256 hash of the human-readable name for the chip being claimed |
_merkleRoot | bytes32 | Merkle root of the TSM Merkle Tree made up of the chips enrolled to this project |
_projectPublicKey | address | Public key used in the generation of the TSM certificates |
_provingChip | address | |
_tsmMerkleInfo | struct IChipRegistry.TSMMerkleInfo | |
_manufacturerValidation | struct IChipRegistry.ManufacturerValidation | |
_chipOwnershipProof | bytes | |
_projectOwnershipProof | bytes | Signed 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
Name | Type | Description |
---|---|---|
_transferPolicy | contract ITransferPolicy | The 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
Name | Type | Description |
---|---|---|
_maxBlockWindow | uint256 | The new max block window |
_isNotZeroAddress
function _isNotZeroAddress(address _address) internal pure returns (bool)
Returns true if passed address is not the zero address
Parameters
Name | Type | Description |
---|---|---|
_address | address | The 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
Name | Type | Description |
---|---|---|
_provingChip | address | The chip used as proof of ownership |
_chipOwnershipProof | bytes | The signature of the chip owner over the hash of the chainId and msg.sender |
_merkleRoot | bytes32 | The merkle root of the project |
_tsmMerkleInfo | struct IChipRegistry.TSMMerkleInfo | The TSM Merkle Info of the chip |
_manufacturerValidation | struct IChipRegistry.ManufacturerValidation | Manufacturer 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
Name | Type | Description |
---|---|---|
_projectManager | address | The address that will be set as the owner of the project registrar contract |
_merkleRoot | bytes32 | Merkle root of the TSM Merkle Tree made up of the chips enrolled to this project |
_nameHash | bytes32 | Keccak256 hash of the human-readable name for the chip being claimed |
_projectPublicKey | address | Public key used in the generation of the TSM certificates |
_projectOwnershipProof | bytes | Signed hash of the _projectRegistrar address by the _projectPublicKey |
_projectClaimDataUri | string | URI pointing to location of off-chain data required to claim chips |