ICertificateFacet
The CertificateFacet contract interface
This contract allows for the management of certificates
Functions
Section titled “Functions”ownerOf
Section titled “ownerOf”Gets the certificate owner
function ownerOf(uint256 certificateId) external view returns (address ownerAddress);Parameters
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The certificate ID to check |
Returns
| Name | Type | Description |
|---|---|---|
ownerAddress | address | The address of the certificate owner |
isCertificateFrozen
Section titled “isCertificateFrozen”Checks if a certificate is frozen
function isCertificateFrozen(uint256 certificateId) external view returns (bool isFrozen, uint256 frozenUntil);Parameters
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The certificate ID to check |
Returns
| Name | Type | Description |
|---|---|---|
isFrozen | bool | Whether the certificate is frozen |
frozenUntil | uint256 | The time remaining until the certificate is unfrozen |
createTShareCertificate
Section titled “createTShareCertificate”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
| Name | Type | Description |
|---|---|---|
shareAmount | uint256 | The amount of token shares to be added to the certificate |
Returns
| Name | Type | Description |
|---|---|---|
newCertificateId | uint256 | The newly created certificate ID |
createVShareCertificate
Section titled “createVShareCertificate”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
| Name | Type | Description |
|---|---|---|
shareAmount | uint256 | The amount of virtual shares to be added to the certificate |
certificateCount | uint256 | The number of certificates to create |
Returns
| Name | Type | Description |
|---|---|---|
certificateIds | uint256[] | The newly created certificate IDs in an array |
mergeCertificates
Section titled “mergeCertificates”Merges two certificates of the same type and returns the new certificate ID
function mergeCertificates( uint256 certificateId1, uint256 certificateId2) external returns (uint256 newCertificateId);Parameters
| Name | Type | Description |
|---|---|---|
certificateId1 | uint256 | The first certificate ID to merge |
certificateId2 | uint256 | The second certificate ID to merge |
Returns
| Name | Type | Description |
|---|---|---|
newCertificateId | uint256 | Is actually certificateId1 if the merge was successful |
splitCertificate
Section titled “splitCertificate”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
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The certificate ID to split |
percentageToKeep | uint256 | The percentage of the certificate to keep (1_000 = 1%) |
Returns
| Name | Type | Description |
|---|---|---|
originalCertificateId | uint256 | The original certificate ID |
newCertificateId | uint256 | The new certificate ID |
updateCertificateState
Section titled “updateCertificateState”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
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The certificate ID to update |
certificateBurnedCallback
Section titled “certificateBurnedCallback”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
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The certificate ID that has been burned |
enforceCertificateOwnership
Section titled “enforceCertificateOwnership”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
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The Certificate to check. |
account | address | The account to check. |
enforceCertificateNotFrozen
Section titled “enforceCertificateNotFrozen”Ensures that the certificate is not frozen
This function will revert if the certificate is frozen
function enforceCertificateNotFrozen(uint256 certificateId) external view;Parameters
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The Certificate to check |
freezeCertificateTransfer
Section titled “freezeCertificateTransfer”Freezes the NFT certificate transfer when it’s balance is changed or rewards are withdrawn
function freezeCertificateTransfer(uint256 certificateId) external;Parameters
| Name | Type | Description |
|---|---|---|
certificateId | uint256 | The Certificate to freeze |