Contracts
PBT
IPBT

Solidity API

IPBT

Interface for PBTs (Physical Backed Tokens). NFTs that are backed by a physical asset, through a chip embedded in the physical asset.

tokenIdFor

function tokenIdFor(address chipId) external view returns (uint256 tokenId)

Returns the ERC-721 tokenId for a given chip address. Reverts if chipId has not been paired to a tokenId. For minimalism, this will NOT revert if the tokenId does not exist. If there is a need to check for token existence, external contracts can call ERC721.ownerOf(uint256 tokenId) and check if it passes or reverts.

Parameters

NameTypeDescription
chipIdaddressThe address for the chip embedded in the physical item (computed from the chip's public key)

Return Values

NameTypeDescription
tokenIduint256The ERC-721 token ID

isChipSignatureForToken

function isChipSignatureForToken(uint256 tokenId, bytes calldata data, bytes calldata signature) external view returns (bool)

Returns true if signature is signed by the chip assigned to tokenId, else false. Reverts if tokenId has not been paired to a chip. For minimalism, this will NOT revert if the tokenId does not exist.

Parameters

NameTypeDescription
tokenIduint256ERC-721 tokenId
databytesArbitrary bytes string that is signed by the chip to produce signature
signaturebytesEIP-191 signature by the chip to check

Return Values

NameTypeDescription
[0]boolTrue if signature is valid for the chip assigned to the token

transferTokenWithChip

function transferTokenWithChip(bytes calldata signature, uint256 blockNumberUsedInSig, bool useSafeTransfer, bytes calldata payload) external returns (uint256)

Transfers the token into the address. Returns the tokenId transferred.

Parameters

NameTypeDescription
signaturebytesEIP-191 signature by the chip
blockNumberUsedInSiguint256The block number when the signature was created, to ensure recent signature
useSafeTransferboolWhether to use safe transfer (calls onERC721Received on receiver if it's a contract)
payloadbytesAdditional data to pass with the transfer

Return Values

NameTypeDescription
[0]uint256The token ID that was transferred