Retirement certificates
The RetirementCertificates
contract lets users mint RetirementCertificate
NFTs that act as proof of retirement. These NFTs display how many TCO2 tokens a user has retired, along with retirement details such as the beneficiary of the retirement and a message. This contract extends ERC721 and is upgradeable.
mintCertificate
Mints a new RetirementCertificates
NFT based on existing 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.
Note: This information is publicly written to the blockchain in plaintext.
Params
Name | Type | Description |
---|---|---|
|
| The entity that has retired TCO2 and is eligible to mint an NFT |
|
| An identifiable string for the retiring entity, e.g. their name |
|
| The address of the beneficiary to set in the NFT |
|
| An identifiable string for the beneficiary to set in the NFT, e.g. their name |
|
| A retirement message to be set in the NFT |
|
| An array with with event IDs to associate with the NFT |
attachRetirementEvents
This function allows you to attach the Retired
events to a RetirementCertificates
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 RetirementCertificates
, but you do get a retirementEventId
.
This allows you to update the amount in an existent RetirementCertificates
NFT with new retirements.
Params
Name | Type | Description |
---|---|---|
|
| The ID of the |
|
| An array with with event IDs to associate with the NFT |
getUserEvents
Fetches all the Retired
events that a given user owns.
Params
Name | Type | Description |
---|---|---|
|
| The address of the user for whom to fetch all events. |
Return Values
Name | Type | Description |
---|---|---|
|
| The IDs of the events owned by the given user. |
updateCertificate
This function allows you to update the retirementMessage
, beneficiary
, and beneficiaryString
of a RetirementCertificates
NFT within 24 hours of creation. Empty param values are ignored, and will not overwrite the existing stored values in the NFT.
Params
Name | Type | Description |
---|---|---|
|
| The ID of the |
|
| An identifiable string for the retiring entity, e.g. their name |
|
| The address of the beneficiary to set in the NFT |
|
| An identifiable string for the beneficiary to set in the NFT, e.g. their name |
|
| A retirement message to be set in the NFT |
getRetiredAmount
This function returns the amount of TCO2 tokens retired by a user that's associated with a given RetirementCertificates
NFT. The function sums up all the retirement amounts from all of event IDs attached to the RetirementCertificate.
Params
Name | Type | Description |
---|---|---|
|
| The ID of the |
Return Values
Name | Type | Description |
---|---|---|
|
| The amount of retired TCO2 tokens associated with that |
Last updated