Contracts
Project Registrars
PBTSimpleProjectRegistrar

Solidity API

PBTSimpleProjectRegistrar

Base contract for ProjectRegistrars. Contains common functionality for all ProjectRegistrars including setting the root node and claiming chips.

ProjectChipAddition

struct ProjectChipAddition {
  address chipId;
  address chipOwner;
  bytes32 nameHash;
  IChipRegistry.ManufacturerValidation manufacturerValidation;
  bytes custodyProof;
}

Constructor

constructor(
  IChipRegistry _chipRegistry, 
  IERS _ers, 
  IDeveloperRegistrar _developerRegistrar,
  string memory _name,
  string memory _symbol,
  string memory _baseURI,
  uint256 _maxBlockWindow,
  ITransferPolicy _transferPolicy
)

Constructor for PBTSimpleProjectRegistrar.

Parameters

NameTypeDescription
_chipRegistryIChipRegistryThe chip registry of the ERS system being used
_ersIERSThe ERS registry of the ERS system being used
_developerRegistrarIDeveloperRegistrarThe DeveloperRegistrar that made this project
_namestringThe name of the custom PBT token
_symbolstringThe symbol of the custom PBT token
_baseURIstringThe base URI for the PBT tokens
_maxBlockWindowuint256Maximum block window for transfers
_transferPolicyITransferPolicyThe transfer policy used by the project

setTransferPolicy

function setTransferPolicy(ITransferPolicy _newPolicy) public onlyOwner()

Owner sets the transfer policy for PBT.

Parameters

NameTypeDescription
_newPolicyITransferPolicyThe address of the new transfer policy. Zero address disables transfers.

setBaseURI

function setBaseURI(string memory updatedBaseURI) public onlyOwner()

ONLY OWNER: Allows the contract owner to update the base URI for the PBT tokens.

Parameters

NameTypeDescription
updatedBaseURIstringThe new base URI to set for the tokens

transferToken

function transferToken(
  address to,
  address chipId,
  bytes calldata signatureFromChip,
  uint256 blockNumberUsedInSig,
  bool useSafeTransferFrom,
  bytes calldata payload
) public override(PBTSimple) returns (uint256 tokenId)

Allow a user to transfer a chip to a new owner. New owner must submit the transaction. Uses ChipPBT logic, which calls TransferPolicy to execute the transfer of the PBT and chip, updating the chip's ERS node to keep data consistency.

Parameters

NameTypeDescription
toaddressThe address of the new chip owner
chipIdaddressChip ID (address) of chip being transferred
signatureFromChipbytesSignature from the chip being transferred
blockNumberUsedInSiguint256Block number used in the signature
useSafeTransferFromboolIndicates whether to use safeTransferFrom or transferFrom
payloadbytesEncoded payload containing additional data required for the transfer

Return Values

NameTypeDescription
tokenIduint256The token ID of the transferred chip

addChips

function addChips(ProjectChipAddition[] calldata _chips) external onlyOwner()

ONLY OWNER: Allows the project manager to add chips to the project.

Parameters

NameTypeDescription
_chipsProjectChipAddition[]Array of chip information required for claiming chips

supportsInterface

function supportsInterface(bytes4 _interfaceId) public view override(BaseProjectRegistrar, PBTSimple) returns (bool)

Returns true if the contract supports the given interface ID.

Parameters

NameTypeDescription
_interfaceIdbytes4The interface ID to check for

Return Values

NameTypeDescription
[0]boolTrue if the contract supports the given interface ID