Skip to the content.

The Immutable Product - authentic product distribution (CreatorToken.sol)

View Source: \contracts\CreatorToken.sol

↗ Extends: Initializable, OwnableUpgradeable, ERC721EnumerableUpgradeable, ERC721BurnableUpgradeable, ERC721URIStorageUpgradeable

CreatorToken

Token transfers use the ImmuteToken only

Structs

Release

struct Release {
 uint256 hash,
 uint256 version,
 uint256 parent
}

ReleaseInformation

struct ReleaseInformation {
 uint256 index,
 uint256 product,
 uint256 release,
 uint256 version,
 string fileURI,
 uint256 parent
}

Contract Members

Constants & Variables

//private members
mapping(uint256 => struct CreatorToken.Release) private Releases;
mapping(uint256 => uint256) private HashToRelease;
mapping(uint256 => mapping(uint256 => uint256)) private ReleasesNumberOf;
uint256 private AnonProductID;
contract StringCommon private commonInterface;
contract ImmutableEntity private entityInterface;
contract ImmutableProduct private productInterface;
string private __name;
string private __symbol;

//public members
uint256 public AnonFee;

Functions

initialize

Initialize the ImmutableProduct smart contract Called during first deployment only (not on upgrade) as this is an OpenZepellin upgradable contract

function initialize(address commonAddr, address entityAddr, address productAddr) public nonpayable initializer 

Arguments

Name Type Description
commonAddr address The StringCommon contract address
entityAddr address The ImmutableEntity token contract address
productAddr address The ImmutableProduct token contract address

creatorAnonFee

Retrieve fee to upgrade. Administrator only.

function creatorAnonFee(uint256 newFee) external nonpayable onlyOwner 

Arguments

Name Type Description
newFee uint256 the new anonymous use fee

anonFile

Anonymous file security (PoE without credentials) Entity and Product must exist.

function anonFile(uint256 newHash, string newFileUri, uint256 version) external payable

Arguments

Name Type Description
newHash uint256 The file SHA256 CRC hash
newFileUri string URI/name/reference of the file
version uint256 The version and flags of the file

creatorReleases

Create new release(s) of an existing product. Entity and Product must exist.

function creatorReleases(uint256[] productIndex, uint256[] newVersion, uint256[] newHash, string[] newFileUri, uint256[] parentHash) external nonpayable

Arguments

Name Type Description
productIndex uint256[] Array of product IDs of new release(s)
newVersion uint256[] Array of version, architecture and languages
newHash uint256[] Array of file SHA256 CRC hash
newFileUri string[] Array of valid URIs of the release binary
parentHash uint256[] Array of SHA256 CRC hash of parent contract

creatorReleaseDetails

Return version, URI and hash of existing product release. Entity, Product and Release must exist.

function creatorReleaseDetails(uint256 entityIndex, uint256 productIndex, uint256 releaseIndex) external view
returns(flags uint256, URI string, fileHash uint256, parentHash uint256)

Returns

flags , URI, fileHash and parentHash are return values.
flags The version, architecture and language(s)
URI The URI to the product release file
fileHash The SHA256 checksum hash of the file
parentHash The SHA256 checksum hash of the parent file

Arguments

Name Type Description
entityIndex uint256 The index of the entity owner of product
productIndex uint256 The product ID of the new release
releaseIndex uint256 The index of the product release

creatorReleaseHashDetails

Reverse lookup, return entity, product, URI of product release. Entity, Product and Release must exist.

function creatorReleaseHashDetails(uint256 fileHash) public view
returns(entity uint256, product uint256, release uint256, version uint256, URI string, parent uint256)

Returns

entity , product, release, version, URI and parent are return values.
entity The index of the entity owner of product
product The product ID of the release
release The release ID of the release
version The version, architecture and language(s)
URI The URI to the product release file parent The SHA256 checksum of ricarding parent file

Arguments

Name Type Description
fileHash uint256 The index of the product release

creatorParentOf

Return depth of ricardian parent relative to child The childHash and parentHash must exist as same product

function creatorParentOf(uint256 childHash, uint256 parentHash) public view
returns(uint256)

Returns

the child document depth compared to parent (> 0 is parent)

Arguments

Name Type Description
childHash uint256 SHA256 checksum hash of the child file
parentHash uint256 SHA256 checksum hash of the parent file

creatorHasChildOf

Determine if an address owns a client token of parent The clientAddress and parentHash must be valid

function creatorHasChildOf(address clientAddress, uint256 parentHash) public view
returns(uint256)

Returns

The child Ricardian depth to parent (> 0 has child)

Arguments

Name Type Description
clientAddress address Ethereum address of client
parentHash uint256 SHA256 checksum hash of the parent file

creatorAllReleaseDetails

Retrieve details for all product releases Status of empty arrays if none found.

function creatorAllReleaseDetails(uint256 entityIndex, uint256 productIndex) external view
returns(versions uint256[], URIs string[], hashes uint256[], parents uint256[])

Returns

versions , URIs, hashes, parents are array return values.
versions Array of version, architecture and language(s)
URIs Array of URI to the product release files
hashes Array of SHA256 checksum hash of the files
parents Aarray of SHA256 checksum hash of the parent files

Arguments

Name Type Description
entityIndex uint256 The index of the entity owner of product
productIndex uint256 The product ID of the new release

creatorReleasesNumberOf

Return the number of releases of a product Entity must exist.

function creatorReleasesNumberOf(uint256 entityIndex, uint256 productIndex) external view
returns(uint256)

Returns

the current number of products for the entity

Arguments

Name Type Description
entityIndex uint256 The index of the entity
productIndex uint256  

_beforeTokenTransfer

function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal nonpayable

Arguments

Name Type Description
from address  
to address  
tokenId uint256  

tokenURI

Look up the release URI from the token Id

function tokenURI(uint256 tokenId) public view
returns(string)

Returns

the file name and/or URI secured by this token

Arguments

Name Type Description
tokenId uint256 The unique token identifier

setTokenURI

Change the URI of the token Id Token must exist and caller must be owner or approved

function setTokenURI(uint256 tokenId, string _tokenURI) public nonpayable

Arguments

Name Type Description
tokenId uint256 The unique token identifier
_tokenURI string The NFT’s new associated URI/URL for this token

_burn

Burn a product file release. Not public, called internally. msg.sender must be the token owner.

function _burn(uint256 tokenId) internal nonpayable

Arguments

Name Type Description
tokenId uint256 The tokenId to burn

supportsInterface

Return the type of supported ERC interfaces

function supportsInterface(bytes4 interfaceId) public view
returns(bool)

Returns

TRUE (1) if supported, FALSE (0) otherwise

Arguments

Name Type Description
interfaceId bytes4 The interface desired

name

Retrieve the token name

function name() public view
returns(string)

Returns

Return the token name as a string

Arguments

| Name | Type | Description | | ————- |————- | —–|

symbol

Retrieve the token symbol

function symbol() public view
returns(string)

Returns

Return the token symbol as a string

Arguments

| Name | Type | Description | | ————- |————- | —–|

Contracts