mQuarkEntity
Allows entities to create their collections and keeps track of them. In addition to that, it allows entities to import their external ERC721 collections to the protocol.
Functions
createCollection
function createCollection(
CollectionParams memory _collectionParams,
bool _isDynamicUri,
uint8 _ERCimplementation,
bytes32 _merkelRoot
) external returns (address _instance);
Deploys a new collection instance.
Parameters:
Name | Type | Description |
---|---|---|
_collectionParams | CollectionParams | The parameters for the collection. |
_isDynamicUri | bool | Flag indicating if the collection has dynamic URIs. |
_ERCimplementation | uint8 | The implementation ID of the ERC contract. |
_merkelRoot | bytes32 | The Merkel root of the collection if it is whitelisted. |
CollectionParams Struct
Name | Type | Description |
---|---|---|
templateId | uint256 | The ID of the template associated with the collection |
collectionURIs | string[] | The URIs associated with the collection |
totalSupply | uint256 | The total supply of tokens in the collection |
mintPrice | uint256 | The price of minting a token in the collection |
mintPerAccountLimit | uint8 | The maximum number of tokens that can be minted per wallet |
name | string | The name of the collection |
symbol | string | The symbol of the collection |
verifier | address | The address of the verifier contract |
isWhitelisted | bool | A flag indicating if the collection is whitelisted |
- If the isWhitelisted is set to false, the collection will not be whitelisted and _merkleRoot will be ignored.
- If isDynamicUri set to true provided URIs will be ignored
Return Values:
Name | Type | Description |
---|---|---|
_instance | address | The address of the new collection instance. |
importExternalCollection
function importExternalCollection(uint256 _templateId, address _collectionAddress) external
Imports an external collection into the system. It enables the imported collection NFTs to use the subscription feature.
- The external collection must be ERC721 compliant.
- The collection must be owned by the entity.
Parameters:
Name | Type | Description |
---|---|---|
_templateId | uint256 | The template ID of the collection. |
_collectionAddress | address | The address of the external collection contract. |
transferOwnershipOfCollection
function transferOwnershipOfCollection(address _newOwner, uint64 _collectionId) external
Transfers ownership of a collection to a new owner.
- Only the owner can call this function.
Parameters:
Name | Type | Description |
---|---|---|
_newOwner | address | The address of the new owner. |
_collectionId | uint64 | The ID of the collection. |
collectFunds
function collectFunds(uint64[] calldata _ids) external
Collects funds from multiple collections.
Parameters:
Name | Type | Description |
---|---|---|
_ids | uint64[] | The IDs of the collections to collect funds from. |
withdraw
function withdraw() external
Withdraws the accumulated balance from the contract.
getCollectionAddress
function getCollectionAddress(uint64 collectionId) external view returns (address)
Retrieves the address of a collection given its ID.
Return Values:
Type | Description |
---|---|
address | The address of the collection. |
getLastCollectionId
function getLastCollectionId() external view returns (uint64)
Retrieves the ID of the last collection created.
Return Values:
Type | Description |
---|---|
uint64 | The ID of the last collection. |
getBalance
function getBalance() external view returns (uint256)
Retrieves the Ether balance of the contract.
Return Values:
Type | Description |
---|---|
uint256 | The current balance of the contract in wei. |
getEntityInfo
function getEntityInfo()
external
view
noDelegateCall
returns (
address contractAddress,
address creator,
uint256 id,
string memory name,
string memory description,
string memory thumbnail,
string memory entitySlotDefaultURI
)
Retrieves information about the entity.
Return Values:
Name | Type | Description |
---|---|---|
contractAddress | address | The address of the entity contract. |
creator | address | The address of the entity creator. |
id | uint256 | The ID of the entity. |
name | string | The name of the entity. |
description | string | The description of the entity. |
thumbnail | string | The URI of the entity's thumbnail image. |
entitySlotDefaultURI | string | The default URI for entity slots. |
Events
SubscriberContractAddressSet
event CollectionCreated(
address instanceAddress,
address verifier,
address controller,
uint256 entityId,
uint64 collectionId,
uint256 templateId,
uint256 mintPrice,
uint256 totalSupply,
uint256 mintLimitPerWallet,
uint256 royalty,
string[] collectionURIs,
uint8 mintType,
bool dynamic,
bool free,
bool whiteListed
);
Emitted when a collection is created.
Parameters:
Name | Type | Description |
---|---|---|
instanceAddress | address | The address of the created collection contract instance. |
verifier | address | The address of the verifier contract. |
controller | address | The address of the controller contract. |
entityId | uint256 | The ID of the entity associated with the collection. |
collectionId | uint64 | The ID of the collection. |
templateId | uint256 | The ID of the template associated with the collection. |
mintPrice | uint256 | The price of minting a token in the collection. |
totalSupply | uint256 | The total supply of tokens in the collection. |
mintLimitPerWallet | uint256 | The maximum number of tokens that can be minted per wallet. |
royalty | uint256 | The royalty percentage for the collection. |
collectionURIs | string[] | The URIs associated with the collection. |
mintType | uint8 | The minting type of the collection. |
dynamic | bool | A flag indicating if the collection has dynamic URIs. |
free | bool | A flag indicating if the collection is free. |
whiteListed | bool | A flag indicating if the collection is whitelisted. |
ExternalCollectionCreated
event ExternalCollectionCreated(
address collectionAddress,
uint256 entityId,
uint256 templateId,
uint64 collectionId
);
Emitted when an external collection is created.
Parameters:
Name | Type | Description |
---|---|---|
collectionAddress | address | The address of the created external collection contract. |
entityId | uint256 | The ID of the entity associated with the collection. |
templateId | uint256 | The ID of the template associated with the collection. |
collectionId | uint64 | The ID of the collection. |