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.
Currently, we support TCO2s for two different carbon registries, Puro and Verra, each with a varying degree of functionality documented below.
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.
Puro
The integration with Puro is achieved through a two-way bridge, where state is synced between the registry and onchain. For more high-level info on the Puro bridge read here.
To ensure a robust sync between the Puro offchain registry and the Toucan onchain contracts, our Puro TCO2 contracts use an escrow contract to hold TCO2s temporarily. The TCO2s are escrowed on every detokenization or retirement request, until the request is completed in the registry, before it can be finalized onchain.
Developers only need to care about creating the request with one of the functions documented below, then it's up to Toucan to finalize the request. In the future, we envision deprecating the admin functionality to process requests offchain and finalize onchain with the use of oracles.
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
Return Values
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
Return Values
Verra
Note that the Verra bridge does not support bringing new credits onchain anymore. Nevertheless for existing Verra credits, we support direct onchain retirements, which can be executed using any of the functions documented below.
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
Return values
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
Return values
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
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
Last updated