It is responsible for managing the subscriptions, unlocking tokens, transferring URIs, setting subscription prices, and other necessary settings by the protocol.
Functions
setRegistryAddress
function setRegistryAddress(address _registry) external
Sets the address of the registry contract.
Parameters:
Name | Type | Description |
---|
_registry | address | The address of the registry contract to be set |
setRoyalty
function setRoyalty(uint256 _royalty) external;
Sets the royalty percentage for the subcription.
Parameters:
Name | Type | Description |
---|
_royalty | uint256 | The royalty percentage to be set. |
setControllerAddress
function setControllerAddress(address _controller) external
Sets the address of the controller contract for the collection.
Parameters:
Name | Type | Description |
---|
_controller | address | The address of the controller contract to be set |
setImportedContractsAddress
function setImportedContractsAddress(address _importedContracts) external
Sets the address of the controller contract for the collection.
Parameters:
Name | Type | Description |
---|
_importedContracts | address | The address of the imported contracts interface contract to be set |
setDefaultURI
function setDefaultURI(
uint256 _entityId,
string calldata _defaultURI
) external
Sets the default URI of an entity. It is used to place in the subscription slot when a token is subscribed for the first time.
Parameters:
Name | Type | Description |
---|
_entityId | uint256 | The ID of the entity to set the default URI for |
_defaultURI | address | The new default URI to be set |
setSubscriptionPrice
function setSubscriptionPrice(uint256 _entityId, uint256 _price) external
Sets the subscription price required to subscribe to an entity.
Parameters:
Name | Type | Description |
---|
_entityId | uint256 | The ID of the entity to set the default URI for |
_price | uint256 | The new subscription price to be set |
setSigner
function setSigner(uint256 _entityId, address _signer) external
Sets the signer address for an entity.
Parameters:
Name | Type | Description |
---|
_entityId | uint256 | The ID of the entity to set the default URI for |
_signer | uint256 | The new signer address to be set |
setCollection
function setCollection(
bool _free,
bool _external,
uint256 _entityId,
uint256 _templateId,
address _collectionAddress
) external
Sets the configuration for a collection.
Parameters:
Name | Type | Description |
---|
_free | bool | Indicating if the collection is free |
_external | bool | Indicating if the collection is external |
_entityId | uint256 | The ID of the entity the collection belongs to |
_templateId | uint256 | The ID of the template associated with the collection |
_collectionAddress | address | The address of the collection contract |
subscribeToEntity
function subscribeToEntity(
uint256 _tokenId,
address _tokenContract,
uint256 _subscriptionId,
bool _directUpdateEnabled
) external payable
Allows a user to subscribe to a collection by paying the subscription price. If true, direct update allows the entity to update the URI slot of the token without the user's approval.
Parameters:
Name | Type | Description |
---|
_tokenId | bool | The ID of the token being subscribed to |
_tokenContract | bool | The address of the token contract |
_subscriptionId | uint256 | The ID of the subscription being purchased |
_directUpdateEnabled | bool | Indicating if direct update is enabled |
subscribeToEntities
function subscribeToEntities(
uint256 _tokenId,
address _tokenContract,
uint256[] calldata _subscriptionIds,
bool[] calldata _directUpdateEnabled
) external payable
Allows a user to subscribe to a collection by paying the subscription price.If true, direct update allows the entity to update the URI slot of the token without the user's approval.
Parameters:
Name | Type | Description |
---|
_tokenId | bool | The ID of the token being subscribed to |
_tokenContract | bool | The address of the token contract |
_subscriptionIds | uint256[] | The ID of the subscription being purchased |
_directUpdateEnabled | bool[] | Indicating if direct update is enabled |
updateURISlot
function updateURISlot(bytes calldata _signature, bytes calldata _updateInfo) external
Makes a call to the mQuark contract to update the URI slot of a single token.
The function expects the update information to be encoded as bytes since token owners will have only one parameter instead of five separate parameters.
Parameters:
Name | Type | Description |
---|
_signature | bool | The ID of the token being subscribed to |
_updateInfo | bool | Encoded and hashed(SHA-256) data containing the following: |
Name | Type | Description |
---|
entity | address | Address of the entity that is responsible for the slot |
entityId | uint64 | ID of the entity |
tokenContract | address | Contract address of the given token |
tokenId | uint256 | Token ID |
updatedUri | string | The newly generated URI for the token |
directUpdateURISlot / directUpdateURISlots
function directUpdateURISlot(
bytes calldata _signature,
bytes calldata _updateInfo,
bool _isSlotURIUpdate,
) external
function directUpdateURISlots(
bytes[] calldata _signatures,
string[] calldata _updatedUris,
uint256[] calldata _tokenIds,
uint256 _entityId,
address _contractAddress,
bool _isSlotURIUpdate
) external
Subscribed Entity can make a call to the contract to update the URI slot of a single token.
The function expects the update information to be encoded as bytes since token owners will have only one parameter instead of five separate parameters.
Parameters:
Name | Type | Description |
---|
_signature | bool | The ID of the token being subscribed to |
_updateInfo | bool | Encoded and hashed(SHA-256) data containing the following: |
_isSlotURIUpdate | bool | Indicating if the update is for a slot URI or a token URI |
Name | Type | Description |
---|
entity | address | Address of the entity that is responsible for the slot |
entityId | uint64 | ID of the entity |
tokenContract | address | Contract address of the given token |
tokenId | uint256 | Token ID |
updatedUri | string | The newly generated URI for the token |
unlockToken
function unlockToken(uint256 _tokenId, address _tokenContract) external payable
Allows a user to unlock a token by paying the required fee.
Parameters:
Name | Type | Description |
---|
_tokenId | uint256 | The ID of the token to unlock |
_tokenContract | address | The contract address of the token |
transferTokenEntityURI
function transferTokenEntityURI(
SellOrder calldata seller,
BuyOrder calldata buyer,
bytes calldata sellerSignature,
bytes calldata buyerSignature
) external payable
Makes a call to mQuark to transfer an entity slot URI of a single token to another token's the same entity slot.
Parameters:
Name | Type | Description |
---|
seller | SellOrder | The struct containing the sell order details |
buyer | BuyOrder | The struct containing the buy order details |
sellerSignature | bytes | Signed data by the seller's wallet |
buyerSignature | bytes | Signed data by the buyer's wallet |
withdraw
function withdraw(
uint256 _entityId,
uint256 _amount
) external
Allows the owner of an entity to withdraw a certain amount of Ether from their entity's balance.
Parameters:
Name | Type | Description |
---|
_entityId | uint256 | The ID of the entity |
_amount | uint256 | The amount of Ether to withdraw |
withdrawProtocol
function withdrawProtocol(uint256 _amount) external
Allows the default admin role to withdraw a certain amount of Ether from the protocol balance.
Parameters:
Name | Type | Description |
---|
_amount | uint256 | The ID of the entity |
getCollection
function getCollection(
address _contractAddress
)
external
view
noDelegateCall
returns (uint256 entityId, uint256 templateId, bool free, bool isExternal, address collectionAddress)
Retrieves information about a collection based on its contract address.
Parameters:
Name | Type | Description |
---|
_contractAddress | _contractAddress | The contract address of the collection |
Return Values:
Name | Type | Description |
---|
entityId | uint256 | The ID of the entity associated with the collection |
templateId | uint256 | The ID of the template associated with the collection |
free | bool | Indicates if the collection is free |
isExternal | bool | Indicates if the collection is an external contract |
collectionAddress | address | The contract address of the collection |
getIsSubscribed
function getIsSubscribed(
uint256 _tokenId,
address _tokenContract,
uint64 _subscriptionId
) external view returns (bool)
Checks if a token is subscribed to a specific subscription ID.
Parameters:
Name | Type | Description |
---|
_tokenId | uint256 | The ID of the token |
_tokenContract | address | The contract address of the token |
_subscriptionId | uint64 | The ID of the subscription |
Return Values:
Type | Description |
---|
bool | true if the token is subscribed to the specified subscription ID, otherwise false |
getIsUnlocked
function getIsUnlocked(uint256 _tokenId, address _tokenContract) external view returns (bool)
Checks if a token is unlocked.
Parameters:
Name | Type | Description |
---|
_tokenId | uint256 | The ID of the token |
_tokenContract | address | The contract address of the token |
Return Values:
Type | Description |
---|
bool | true if the token is unlocked, otherwise false |
getEntityConfig
function getEntityConfig(
uint256 _entityId
)
external
view
returns (uint256 entityId, uint256 subscriptionPrice, string memory defaultURI, bool uriSet, address signer)
Retrieves the configuration of an entity.
Parameters:
Name | Type | Description |
---|
_entityId | uint256 | The ID of the entity |
Return Values:
Name | Type | Description |
---|
_entityId | uint256 | The ID of the entity |
subscriptionPrice | uint256 | The subscription price of the entity |
defaultURI | string | The default URI of the entity |
uriSet | bool | Indicates if the URI is set for the entity |
signer | address | The address of the signer for the entity |
getEntityBalance
function getEntityBalance(uint256 _entityId) external view returns (uint256)
Retrieves the balance of an entity.
Parameters:
Name | Type | Description |
---|
_entityId | uint256 | The ID of the entity |
Return Values:
Type | Description |
---|
uint256 | The balance of the entity |
getIsAddressRegisteredAsEntity
function getIsAddressRegisteredAsEntity(address _address) external view returns (bool)
Returns a boolean indicating whether an address is registered as an entity.
Parameters:
Name | Type | Description |
---|
_address | address | The address to check |
Return Values:
Type | Description |
---|
bool | A boolean indicating if the address is registered as an entity |
calculateBatchSubscriptionPrice
function calculateBatchSubscriptionPrice(uint256[] calldata _subscriptionIds) public view returns (uint256)
Calculates the total subscription price for a batch of subscription IDs.
Parameters:
Name | Type | Description |
---|
_subscriptionIds | uint256[] | The array of subscription IDs |
Return Values:
Type | Description |
---|
bool | The total subscription price |
Events
WithdrawProtocol
event WithdrawProtocol(address to, uint256 amount);
Emitted when protocol funds are withdrawn to a specified address.
Parameters:
Name | Type | Description |
---|
to | address | The address to which the funds are withdrawn. |
amount | address | The amount of funds withdrawn. |
Withdraw
event Withdraw(uint256 entityId, address to, uint256 amount);
Emitted when funds are withdrawn from an entity to a specified address.
Parameters:
Name | Type | Description |
---|
entityId | uint256 | The ID of the entity from which funds are withdrawn. |
to | address | The address to which the funds are withdrawn. |
amount | address | The amount of funds withdrawn. |
RoyaltySet
event RoyaltySet(uint256 royalty);
Emitted when the royalty percentage is set.
Parameters:
Name | Type | Description |
---|
royalty | uint256 | The new royalty percentage. |
RegistrySet
event RegistrySet(address registry);
Emitted when the registry contract address is set.
Parameters:
Name | Type | Description |
---|
registry | address | The address of the registry contract. |
ControllerSet
event ControllerSet(address controller);
Emitted when the controller contract address is set.
Parameters:
Name | Type | Description |
---|
controller | address | The address of the controller contract. |
Unlocked
event Unlocked(uint256 tokenId, address tokenContract, address to, uint256 amount);
Emitted when a token is unlocked.
Parameters:
Name | Type | Description |
---|
tokenId | uint256 | The ID of the unlocked token. |
tokenContract | address | The address of the token contract. |
to | address | The address to which the unlocked token is transferred. |
amount | uint256 | The amount of unlocked tokens transferred. |
URISlotUpdated
event URISlotUpdated(uint256 entityId, address tokenContract, uint256 tokenId, string updatedUri);
Emitted when the URI slot of a token is updated.
Parameters:
Name | Type | Description |
---|
entityId | uint256 | The ID of the entity associated with the token. |
tokenContract | address | The address of the token contract. |
tokenId | uint256 | The ID of the token whose URI slot is updated. |
updatedUri | string | The updated URI value. |
SubscribedBatch
event SubscribedBatch(
uint256 tokenId,
address tokenContract,
uint256[] subscriptionIds,
address to,
string[] defaultUris,
uint256 amount
);
Emitted when multiple subscriptions are made in batch.
Parameters:
Name | Type | Description |
---|
tokenId | uint256 | The ID of the token for which the subscriptions are made. |
tokenContract | address | The address of the token contract. |
subscriptionIds | uint256[] | The IDs of the subscriptions made. |
to | address | The address to which the token is subscribed. |
defaultUris | string[] | The default URIs associated with the subscriptions. |
amount | uint256 | The total amount paid for the subscriptions. |
Subscribed
event Subscribed(
uint256 tokenId,
address tokenContract,
uint256 subscriptionId,
address to,
string defaultUri,
uint256 amount
);
Emitted when a single subscription is made.
Parameters:
Name | Type | Description |
---|
tokenId | uint256 | The ID of the token for which the subscriptions are made. |
tokenContract | address | The address of the token contract. |
subscriptionId | uint64 | The ID of the subscription made. |
to | address | The address to which the token is subscribed. |
defaultUri | string | The default URI associated with the subscription. |
amount | uint256 | The total amount paid for the subscriptions. |
SubscriptionPriceSet
event SubscriptionPriceSet(uint256 entityId, uint256 price);
Emitted when the subscription price is set for an entity.
Parameters:
Name | Type | Description |
---|
entityId | uint256 | The ID of the entity for which the default URI is set. |
price | uint256 | The subscription price. |
DefaultURISet
event DefaultURISet(uint256 entityId, string defaultURI);
Emitted when the default URI is set for an entity.
Parameters:
Name | Type | Description |
---|
entityId | uint256 | The ID of the entity for which the default URI is set. |
defaultURI | string | The default URI. |
EntityInitialized
event EntityInitialized(address contractAddress, uint256 entityId, address signer, string defaultURI, uint256 price);
Emitted when an entity is initialized.
Parameters:
Name | Type | Description |
---|
contractAddress | address | The address of the entity contract. |
entityId | uint256 | The ID of the entity. |
signer | address | The address of the entity signer. |
defaultURI | string | The default URI associated with the entity. |
price | uint256 | The subscription price of the entity. |
TokenEntityUriTransferred
event TokenEntityUriTransferred(
address fromTokenContract,
uint256 fromTokenId,
address toTokenContract,
uint256 toTokenId,
uint256 entityId,
uint256 price,
string uri,
address from,
address to
);
Emitted when the entity URI of a token is transferred to another token.
Parameters:
Name | Type | Description |
---|
fromTokenContract | address | The address of the token contract from which the entity URI is transferred. |
fromTokenId | uint256 | The ID of the token from which the entity URI is transferred. |
toTokenContract | address | The address of the token contract to which the entity URI is transferred. |
toTokenId | uint256 | The ID of the token to which the entity URI is transferred. |
entityId | uint256 | The ID of the entity associated with the entity URI. |
price | uint256 | The price associated with the entity URI transfer. |
uri | string | The entity URI being transferred. |
from | address | The address from which the entity URI is transferred. |
to | address | The address to which the entity URI is transferred. |