Skip to main content

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:

NameTypeDescription
_collectionParamsCollectionParamsThe parameters for the collection.
_isDynamicUriboolFlag indicating if the collection has dynamic URIs.
_ERCimplementationuint8The implementation ID of the ERC contract.
_merkelRootbytes32The Merkel root of the collection if it is whitelisted.

CollectionParams Struct

NameTypeDescription
templateIduint256The ID of the template associated with the collection
collectionURIsstring[]The URIs associated with the collection
totalSupplyuint256The total supply of tokens in the collection
mintPriceuint256The price of minting a token in the collection
mintPerAccountLimituint8The maximum number of tokens that can be minted per wallet
namestringThe name of the collection
symbolstringThe symbol of the collection
verifieraddressThe address of the verifier contract
isWhitelistedboolA 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:

NameTypeDescription
_instanceaddressThe 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:

NameTypeDescription
_templateIduint256The template ID of the collection.
_collectionAddressaddressThe 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:

NameTypeDescription
_newOwneraddressThe address of the new owner.
_collectionIduint64The ID of the collection.

collectFunds

 function collectFunds(uint64[] calldata _ids) external

Collects funds from multiple collections.

Parameters:

NameTypeDescription
_idsuint64[]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:

TypeDescription
addressThe address of the collection.

getLastCollectionId

  function getLastCollectionId() external view returns (uint64)

Retrieves the ID of the last collection created.

Return Values:

TypeDescription
uint64The ID of the last collection.

getBalance

  function getBalance() external view returns (uint256)

Retrieves the Ether balance of the contract.

Return Values:

TypeDescription
uint256The 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:

NameTypeDescription
contractAddressaddressThe address of the entity contract.
creatoraddressThe address of the entity creator.
iduint256The ID of the entity.
namestringThe name of the entity.
descriptionstringThe description of the entity.
thumbnailstringThe URI of the entity's thumbnail image.
entitySlotDefaultURIstringThe 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:

NameTypeDescription
instanceAddressaddressThe address of the created collection contract instance.
verifieraddressThe address of the verifier contract.
controlleraddressThe address of the controller contract.
entityIduint256The ID of the entity associated with the collection.
collectionIduint64The ID of the collection.
templateIduint256The ID of the template associated with the collection.
mintPriceuint256The price of minting a token in the collection.
totalSupplyuint256The total supply of tokens in the collection.
mintLimitPerWalletuint256The maximum number of tokens that can be minted per wallet.
royaltyuint256The royalty percentage for the collection.
collectionURIsstring[]The URIs associated with the collection.
mintTypeuint8The minting type of the collection.
dynamicboolA flag indicating if the collection has dynamic URIs.
freeboolA flag indicating if the collection is free.
whiteListedboolA 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:

NameTypeDescription
collectionAddressaddressThe address of the created external collection contract.
entityIduint256The ID of the entity associated with the collection.
templateIduint256The ID of the template associated with the collection.
collectionIduint64The ID of the collection.