Manufacturer

Address: 0x12B870fB7822ec80AF5E66e7CD19379347dE70DF

This contract represents the manufacturer of a vehicle or of an aftermarket device. A manufacturer is always a root node (no parent node), from which all other nodes derive directly or indirectly.

Because of the relevance of what a root represents, there are only two possible owner types: an admin of the system or a controller, which is also set by an admin. Although the system allows a controller to own only a single manufacturer node, in the early stages of the DIMO identity, all manufacturer nodes will be minted and owned by an admin. In the future, the ownership of those nodes will be transferred to the right controller.

Since many nodes will be created at once, an admin can invoke the following function to perform a batch mint:

function mintManufacturerBatch(address _owner, string[] calldata names)
        external
        onlyRole(DEFAULT_ADMIN_ROLE)

ManufacturerID (License)

The holder of the ManufacturerID license can create devices within the smart contract, update attributes of their devices, perform OTAs. See License for more.

Controllers

Unless an administrator, controllers can only own a single manufacturer node and, consequently, a single manufacturer ID.

To prevent a controller from possessing more than one node, we keep track of minted nodes by controller and restrict transfers in the ManufacturerId contract. When any transfer function is invoked in the NFT contract, an external call is made to the Manufacturer node through the function setManufacturerMinted to verify if the recipient is allowed to possess a manufacturer node and, then, to set the recipient as "already minted".

Duplication

Besides the NFT ID, the Manufacturer nodes also have a mandatory name associated with them. In order to prevent duplicated nodes, two mappings are employed to verify existing data before minting:

// Manufacturer name => Manufacturer Id
mapping(string => uint256) manufacturerNameToNodeId;

// Manufacturer Id => Manufacturer name
mapping(uint256 => string) nodeIdToManufacturerName;

Whenever a new Manufacturer node is about to be created, the new manufacturer name is verified against the existing ones to ensure the new name is not associated with an ID. It also facilitates external interfaces to query the names and IDs of the nodes.

Last updated