TCO2 contracts
TCO2 tokens represents tokenized carbon credits
A separate TCO2 contract is created for each different vintage issuance. Each token contract has the same standard functions, extends ERC20, and is upgradeable.
Find out more about how we name TCO2s in the Carbon Rosetta Stone.
requestDetokenization
Request a detokenization of batch-NFTs. The amount of TCO2 to detokenize will be transferred from the user to an escrow contract. The detokenization request will be processed asynchronously by Toucan so callers should monitor the status of the request by listening to the DetokenizationFinalized and DetokenizationReverted events.
This function is permissionless and can be called by anyone with enough TCO2 to detokenize
Parameters
Name | Type | Description |
---|---|---|
tokenIds | uint256[] | Token IDs of one or more batches to detokenize |
amount | uint256 | The amount of TCO2 to detokenize, must be greater than zero and equal to or smaller than the total amount of the batches (and also greater then the total amount of all the batches except the last one) |
Return Values
Name | Type | Description |
---|---|---|
requestId | uint256 | The ID of the request in the escrow contract |
requestRetirement
Request a retirement of TCO2s from batch-NFTs. The amount of TCO2s to retire will be transferred from the user to an escrow contract. The retirement request will be processed asynchronously by Toucan so callers should monitor the status of the request by listening to the RetirementFinalized and RetirementReverted events.
This function is permissionless and can be called by anyone with enough TCO2 to retire
Parameters
Name | Type | Description |
---|---|---|
params | struct CreateRetirementRequestParams | The parameters of the retirement request: uint256[] tokenIds One or more batches to retire uint256 amount The amount of TCO2 to retire, must be greater than zero and equal to or smaller than the total amount of the batches (and also greater then the total amount of all the batches except the last one) string retiringEntityString The name of the retiring entity address beneficiary The address of the beneficiary of the retirement string beneficiaryString The name of the beneficiary of the retirement string retirementMessage A message to be included in the retirement certificate string beneficiaryLocation The location of the beneficiary of the retirement string consumptionCountryCode The country code of the consumption location uint256 consumptionPeriodStart The start of the consumption period, in seconds since the epoch uint256 consumptionPeriodEnd The end of the consumption period, in seconds since the epoch |
Return Values
Name | Type | Description |
---|---|---|
requestId | uint256 | The ID of the request in the escrow contract |
retire
To retire a given amount of CO2 tons. The credits are permanently removed from circulation — this achieves the offset. This also emits a Retired
event.
Params
Name | Type | Description |
---|---|---|
|
| Amount of TCO2 tokens to retire |
Return values
Name | Type | Description |
---|---|---|
|
| The ID of the event emitted upon retirement. Can be used later to mint |
retireFrom
Achieves similar functionality as retire()
, but instead of retiring from the caller's address, it does so from the provided address. This allow for pools or third party contracts to retire for the user.
This function requires the user to approve the third party from the TCO2 contract.
Params
Name | Type | Description |
---|---|---|
|
| Address from which to retire |
|
| Amount of TCO2 tokens to retire |
Return values
Name | Type | Description |
---|---|---|
|
| The ID of the event emitted upon retirement. Can be used later to mint |
retireAndMintCertificate
Retires an amount of TCO2 tokensand mints a certificate, passing the retirementEventId
. The information provided is set in the RetirementCertificate
NFT.
Note: This information is publicly written to the blockchain in plaintext.
Params
Name | Type | Description |
---|---|---|
|
| An identifiable string for the retiring entity, e.g. their name |
|
| The address of the beneficiary |
|
| An identifiable string for the beneficiary, e.g. their name |
|
| A retirement message |
|
| Amount of TCO2 tokens to retire |
mintCertificateLegacy
This function mints a RetirementCertificate
NFT based on the legacy retirement functionality. This function is used only for backwards-compatibility reasons. (In case you retired before the RetirementCertificates
NFT was introduced, but still want the NFT.)
Some context: before the RetirementCertificates
NFT was introduced, retirements didn't emit the Retired
event. How much an address/entity had retired was stored solely in a mapping (mapping(address => uint256) public retiredAmount;
).
This is relevant for retirements performed before Block 27360444 on Polygon
All retirements on Celo are compatible with
RetirementCertificates
Going forward users should mint NFT either directly in the RetirementCertificates
contract or using the retireAndMintCertificate()
function above.
Params
Name | Type | Description |
---|---|---|
|
| An identifiable string for the retiring entity, eg. their name. |
|
| The address of the beneficiary to set in the NFT. |
|
| An identifiable string for the beneficiary to set in the NFT, eg. their name |
|
| A retirement message to be set in the NFT |
|
| Amount of TCO2 to retire and issue a |
getAttributes
Function to get corresponding attributes from the carbon project vintage that is represented by this TCO2 contract.
The return values are tuples — below you can find the definitions of the ProjectData
& VintageData
structs.
Last updated