ActivateToken.sol
View Source: \contracts\ActivateToken.sol
↗ Extends: Initializable, OwnableUpgradeable, ERC721EnumerableUpgradeable, ERC721BurnableUpgradeable
ActivateToken
Contract Members
Constants & Variables
mapping(uint256 => uint256) private ActivateIdToTokenId;
mapping(uint256 => uint256) private TokenIdToActivateId;
mapping(uint64 => uint64) private NumberOfActivations;
mapping(uint256 => uint256) private TokenIdToRicardianParent;
contract ProductActivate private activateInterface;
contract CreatorToken private creatorInterface;
contract ImmutableEntity private entityInterface;
contract StringCommon private commonInterface;
Functions
- initialize(address commonContractAddr, address entityContractAddr)
- restrictToken(address activateAddress, address creatorAddress)
- burn(uint256 tokenId)
- mint(address sender, uint256 entityIndex, uint256 productIndex, uint256 licenseHash, uint256 licenseValue, uint256 ricardianParent)
- activateOwner(address newOwner)
- activateTokenMoveHash(uint256 tokenId, uint256 newHash, uint256 oldHash)
- activateIdToTokenId(uint256 licenseHash)
- tokenIdToActivateId(uint256 tokenId)
- activateStatus(uint256 entityIndex, uint256 productIndex, uint256 licenseHash)
- activateAllDetailsForAddress(address entityAddress)
- activateAllDetails(uint256 entityIndex)
- activateAllForSaleTokenDetails()
- _beforeTokenTransfer(address from, address to, uint256 tokenId)
- supportsInterface(bytes4 interfaceId)
initialize
Initialize the activate token smart contract Called during first deployment only (not on upgrade) as this is an OpenZepellin upgradable contract
function initialize(address commonContractAddr, address entityContractAddr) public nonpayable initializer
Arguments
Name | Type | Description |
---|---|---|
commonContractAddr | address | The StringCommon contract address |
entityContractAddr | address | The ImmutableEntity token contract address |
restrictToken
Restrict the token to the activate contract Called once after deployment to initialize Ecosystem. msg.sender must be contract owner
function restrictToken(address activateAddress, address creatorAddress) public nonpayable onlyOwner
Arguments
Name | Type | Description |
---|---|---|
activateAddress | address | The ProductActivate contract address |
creatorAddress | address | The Creator token contract address |
burn
Burn a product activation license. Not public, called internally. msg.sender must be the token owner.
function burn(uint256 tokenId) public nonpayable
Arguments
Name | Type | Description |
---|---|---|
tokenId | uint256 | The tokenId to burn |
mint
Create a product activation license. Public but internal. msg.sender must be product activate contract
function mint(address sender, uint256 entityIndex, uint256 productIndex, uint256 licenseHash, uint256 licenseValue, uint256 ricardianParent) public nonpayable
returns(uint256)
Returns
tokenId The resulting new unique token identifier
Arguments
Name | Type | Description |
---|---|---|
sender | address | |
entityIndex | uint256 | The local entity index of the license |
productIndex | uint256 | The specific ID of the product |
licenseHash | uint256 | The external license activation hash |
licenseValue | uint256 | The activation value and flags (192 bits) |
ricardianParent | uint256 | The Ricardian contract parent (if required) |
activateOwner
Change owner for all activate tokens (activations) Not public, called internally. msg.sender is the license owner.
function activateOwner(address newOwner) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
newOwner | address | The new owner to receive transfer of tokens |
activateTokenMoveHash
Change activation identifier for an activate token Caller must be the ProductActivate contract.
function activateTokenMoveHash(uint256 tokenId, uint256 newHash, uint256 oldHash) external nonpayable
Arguments
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token identifier to move |
newHash | uint256 | The new activation hash/identifier |
oldHash | uint256 | The previous activation hash/identifier |
activateIdToTokenId
Find token identifier associated with activation hash
function activateIdToTokenId(uint256 licenseHash) external view
returns(uint256)
Returns
the tokenId value
Arguments
Name | Type | Description |
---|---|---|
licenseHash | uint256 | the external unique identifier |
tokenIdToActivateId
Find activation hash associated with token identifier
function tokenIdToActivateId(uint256 tokenId) external view
returns(uint256)
Returns
the license hash/unique activation identifier
Arguments
Name | Type | Description |
---|---|---|
tokenId | uint256 | is the unique token identifier |
activateStatus
Find end user activation value and expiration for product Entity and product must be valid.
function activateStatus(uint256 entityIndex, uint256 productIndex, uint256 licenseHash) external view
returns(value uint256, price uint256)
Returns
value (with flags) and price of the activation.
value The activation value (flags, expiration, value)
price The price in tokens if offered for resale
Arguments
Name | Type | Description |
---|---|---|
entityIndex | uint256 | The entity the product license is for |
productIndex | uint256 | The specific ID of the product |
licenseHash | uint256 | the external unique identifier to activate |
activateAllDetailsForAddress
Find all license activation details for an address
function activateAllDetailsForAddress(address entityAddress) public view
returns(entities uint256[], products uint256[], hashes uint256[], values uint256[], prices uint256[])
Returns
entities , products, hashes, values and prices as arrays.
entities Array of entity ids of product
products Array of product ids of product
hashes Array of activation identifiers
values Array of token values
prices Array of price in tokens if for resale
Arguments
Name | Type | Description |
---|---|---|
entityAddress | address | The address that owns the activations |
activateAllDetails
Find all license activation details for an entity Entity must be valid.
function activateAllDetails(uint256 entityIndex) external view
returns(entities uint256[], products uint256[], hashes uint256[], values uint256[], prices uint256[])
Returns
entities , products, hashes, values and prices as arrays.
entities Array of entity ids of product
products Array of product ids of product
hashes Array of activation identifiers
values Array of token values (flags, expiration)
prices Array of price in tokens if for resale
Arguments
Name | Type | Description |
---|---|---|
entityIndex | uint256 | The entity to return activations for |
activateAllForSaleTokenDetails
Return all license activations for sale in the ecosystem When this exceeds available return size index will be added
function activateAllForSaleTokenDetails() external view
returns(entities uint256[], products uint256[], hashes uint256[], values uint256[], prices uint256[])
Returns
entities , products, hashes, values and prices as arrays.
entities Array of entity ids of product
products Array of product ids of product
hashes Array of activation identifiers
values Array of token values (flags, expiration)
prices Array of price in tokens if for resale
Arguments
| Name | Type | Description | | ————- |————- | —–|
_beforeTokenTransfer
Perform validity check before transfer of token allowed. Called internally before any token transfer and used to enforce resale rights and Ricardian contract agreement requirements, even when using third party exchanges.
function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal nonpayable
Arguments
Name | Type | Description |
---|---|---|
from | address | The token origin address |
to | address | The token destination address |
tokenId | uint256 | The token intended for transfer |
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 |
Contracts
- ActivateToken
- AddressUpgradeable
- ContextUpgradeable
- CreatorToken
- CustomToken
- ERC165Upgradeable
- ERC20Upgradeable
- ERC721BurnableUpgradeable
- ERC721EnumerableUpgradeable
- ERC721Upgradeable
- ERC721URIStorageUpgradeable
- IERC165Upgradeable
- IERC20MetadataUpgradeable
- IERC20Upgradeable
- IERC721EnumerableUpgradeable
- IERC721MetadataUpgradeable
- IERC721ReceiverUpgradeable
- IERC721Upgradeable
- ImmutableEntity
- ImmutableProduct
- Initializable
- Migrations
- OwnableUpgradeable
- ProductActivate
- StringCommon
- StringsUpgradeable