Skip to content

ICertificateFacet

The CertificateFacet contract interface

This contract allows for the management of certificates

Gets the certificate owner

function ownerOf(uint256 certificateId) external view returns (address ownerAddress);

Parameters

NameTypeDescription
certificateIduint256The certificate ID to check

Returns

NameTypeDescription
ownerAddressaddressThe address of the certificate owner

Checks if a certificate is frozen

function isCertificateFrozen(uint256 certificateId)
external
view
returns (bool isFrozen, uint256 frozenUntil);

Parameters

NameTypeDescription
certificateIduint256The certificate ID to check

Returns

NameTypeDescription
isFrozenboolWhether the certificate is frozen
frozenUntiluint256The time remaining until the certificate is unfrozen

Creates a new certificate that wraps token shares and mints a new NFT

representing the certificate. The certificate ID is returned.

function createTShareCertificate(uint256 shareAmount) external returns (uint256 newCertificateId);

Parameters

NameTypeDescription
shareAmountuint256The amount of token shares to be added to the certificate

Returns

NameTypeDescription
newCertificateIduint256The newly created certificate ID

Creates a new certificate that wraps virtual shares and mints new NFTs

representing the certificates. The certificate IDs are returned.

function createVShareCertificate(
uint256 shareAmount,
uint256 certificateCount
)
external
returns (uint256[] memory certificateIds);

Parameters

NameTypeDescription
shareAmountuint256The amount of virtual shares to be added to the certificate
certificateCountuint256The number of certificates to create

Returns

NameTypeDescription
certificateIdsuint256[]The newly created certificate IDs in an array

Merges two certificates of the same type and returns the new certificate ID

function mergeCertificates(
uint256 certificateId1,
uint256 certificateId2
)
external
returns (uint256 newCertificateId);

Parameters

NameTypeDescription
certificateId1uint256The first certificate ID to merge
certificateId2uint256The second certificate ID to merge

Returns

NameTypeDescription
newCertificateIduint256Is actually certificateId1 if the merge was successful

Splits a certificate into two certificates and returns the new certificate ID

function splitCertificate(
uint256 certificateId,
uint256 percentageToKeep
)
external
returns (uint256 originalCertificateId, uint256 newCertificateId);

Parameters

NameTypeDescription
certificateIduint256The certificate ID to split
percentageToKeepuint256The percentage of the certificate to keep (1_000 = 1%)

Returns

NameTypeDescription
originalCertificateIduint256The original certificate ID
newCertificateIduint256The new certificate ID

Updates the certificate state. This function is called by various facets to update the certificate state when certain actions are performed.

function updateCertificateState(uint256 certificateId) external;

Parameters

NameTypeDescription
certificateIduint256The certificate ID to update

Receives a notification from the certificate manager that a certificate has been burned. This function will withdraw the deposit and rewards from the certificate and remove it from the ledger.

This function can only be called by the CertificateNFTManager contract.

function certificateBurnedCallback(uint256 certificateId) external;

Parameters

NameTypeDescription
certificateIduint256The certificate ID that has been burned

Ensures that the caller is the certificate owner.

This function will revert if the certificate owner is not the account.

function enforceCertificateOwnership(uint256 certificateId, address account) external view;

Parameters

NameTypeDescription
certificateIduint256The Certificate to check.
accountaddressThe account to check.

Ensures that the certificate is not frozen

This function will revert if the certificate is frozen

function enforceCertificateNotFrozen(uint256 certificateId) external view;

Parameters

NameTypeDescription
certificateIduint256The Certificate to check

Freezes the NFT certificate transfer when it’s balance is changed or rewards are withdrawn

function freezeCertificateTransfer(uint256 certificateId) external;

Parameters

NameTypeDescription
certificateIduint256The Certificate to freeze