Toucan
Searchโ€ฆ
Retirements Certificate
The `RetirementsCertificate` contract lets users mint NFTs that act as **proof-of-retirement**. These NFTs display how many TCO2s a user has burnt. They can also contain a beneficiary of the retireme

mintCertificate

Mints a new RetirementsCertificate NFT based on existent Retired events. The function can either be called by a valid TCO2 contract (in its retireAndMintCertificate() function) or by a user who owns Retired events.
function mintCertificate(
address retiringEntity,
string calldata retiringEntityString,
address beneficiary,
string calldata beneficiaryString,
string calldata retirementMessage,
uint256[] calldata retirementEventIds
) external;

Params

Name
Type
Description
retiringEntity
address
The entity that has retired TCO2 and is eligible to mint an NFT.
retiringEntityString
string
An identifiable string for the retiring entity, eg. their name.
beneficiary
address
The address of the beneficiary to set in the NFT.
beneficiaryString
string
An identifiable string for the beneficiary to set in the NFT, eg. their name
retirementMessage
string
A retirement message to be set in the NFT
retirementEventIds
uint256[]
An array with only one event ID to associate with the NFT.
It is of note that currently only 1 event is allowed to be provided in the retirementEventIds array of this function.

attachRetirementEvents

This function allows you to attach the Retired events to a RetirementsCertificate NFT.
For context, if you go back to the TCO2 contract docs you will see that you are able to retire TCO2 without minting a RetirementsCertificate, but you do get a retirementEventId.
This allows you to update the amount in an existent RetirementsCertificate NFT with new retirements.
function attachRetirementEvents(
uint256 tokenId,
uint256[] calldata retirementEventIds
) external;

Params

Name
Type
Description
tokenId
uint256
The ID of the NFT to attach events to.
retirementEventIds
uint256[]
An array with only one event ID to associate with the NFT.
It is of note that currently only 1 event is allowed to be provided in the retirementEventIds array of this function.

getUserEvents

Fetches all the Retired events that a given user owns.
function getUserEvents(address user)external view returns (uint256[] memory);

Params

Name
Type
Description
user
address
The address of the user for whom to fetch all events.

Return Values

Name
Type
Description
retirementEventIds
uint256[]
The IDs of the events owned by the given user.

updateCertificate

This function allows you to update the retirementMessage, beneficiary, and beneficiaryString of a RetirementsCertificate NFT (within 24h of creation). Empty param values are ignored and will not overwrite the existing stored values in the NFT.
function updateCertificate(
uint256 tokenId,
string calldata retiringEntityString,
address beneficiary,
string calldata beneficiaryString,
string calldata retirementMessage
) external;

Params

Name
Type
Description
tokenId
uint256
The ID of the RetirementsCertificate NFT to update
retiringEntityString
string
An identifiable string for the retiring entity, eg. their name.
beneficiary
address
The address of the beneficiary to set in the NFT.
beneficiaryString
string
An identifiable string for the beneficiary to set in the NFT, eg. their name
retirementMessage
string
A retirement message to be set in the NFT

getRetiredAmount

This function returns the amount of TCO2 retired by a user that's associated with a given RetirementsCertificate NFT.
function getRetiredAmount(uint256 tokenId) external view returns (uint256);

Params

Name
Type
Description
tokenId
uint256
The ID of the RetirementsCertificate NFT to fetch the amount for.

Return Values

Name
Type
Description
amount
uint256
The amount of retired TCO2.
Copy link
On this page
mintCertificate
attachRetirementEvents
getUserEvents
updateCertificate
getRetiredAmount