Contracts
TSMRegistrar

Solidity API

TSMRegistrar

Contract that coordinates adding a new project for a TSM. Each TSM has their own TSMRegistrar which is associated with a .ers subnode in the ERS registry ([tsm].ers). When adding a new project a subnode under the tsm.ers sub- domain is added ([projectName].tsm.ers) and the project is enrolled in the ChipRegistry.

ProjectAdded

event ProjectAdded(address projectRegistrar, bytes32 projectRootNode, bytes32 merkleRoot, address projectPublicKey, address transferPolicy, string projectClaimDataUri)

RegistrarInitialized

event RegistrarInitialized(bytes32 rootNode)

chipRegistry

contract IChipRegistry chipRegistry

ers

contract IERS ers

tsmRegistry

contract ITSMRegistry tsmRegistry

initialized

bool initialized

rootNode

bytes32 rootNode

projects

address[] projects

constructor

constructor(address _owner, contract IChipRegistry _chipRegistry, contract IERS _ers, contract ITSMRegistry _tsmRegistry) public

Constructor for TSMRegistrar. Sets the owner and ChipRegistry.

Parameters

NameTypeDescription
_owneraddressOwner of the TSMRegistrar. This address is responsible for adding new projects
_chipRegistrycontract IChipRegistryChipRegistry contract
_erscontract IERSERS registry
_tsmRegistrycontract ITSMRegistryTSMRegistry contract

initialize

function initialize(bytes32 _rootNode) external

ONLY TSM REGISTRY: Initialize TSMRegistrar contract with root node. Required due to order of operations during deploy.

Parameters

NameTypeDescription
_rootNodebytes32Root node of the TSM

addProject

function addProject(bytes32 _nameHash, contract IProjectRegistrar _projectRegistrar, bytes32 _merkleRoot, address _projectPublicKey, contract ITransferPolicy _transferPolicy, bytes _ownershipProof, string _projectClaimDataUri) external

ONLY OWNER: Add a new project to the TSM. Creates a new subnode in the ENS registry and adds the project to the ChipRegistry. TSMRegistrar's DO NOT have the ability to overwrite their subnodes in ERS, hence if a _nameHash is already taken, this function will revert. Ownership proof is checked in the ChipRegistry.

Parameters

NameTypeDescription
_nameHashbytes32Namehash of the project
_projectRegistrarcontract IProjectRegistrarProjectRegistrar contract
_merkleRootbytes32Merkle root of the project's chip ownership
_projectPublicKeyaddressPublic key of the project
_transferPolicycontract ITransferPolicyTransfer policy of the project
_ownershipProofbytesSigned hash of the _projectRegistrar address by the _projectPublicKey
_projectClaimDataUristringURI pointing to location of off-chain data required to claim chips

getProjects

function getProjects() external view returns (address[])