TCO2
Toucan Carbon Offset
Each TCO2 is representative of a carbon offset. 1 unit represents 1 ton of CO2. Each TCO2 token contract represents a unique vintage with a specific carbon project. But each of them has the same standard functions, extends ERC20, and is upgradeable.
You retire a given amount of CO2 tons. The tokens get burnt and this achieves the offset. This also emits a
Retired
event.function retire(uint256 amount) public virtual returns (uint256 retirementEventId);
Name | Type | Description |
---|---|---|
amount | uint256 | Amount of TCO2 to retire. |
Name | Type | Description |
---|---|---|
retirementEventId | uint256 | The ID of the event emited upon retirement. Can be used later to mint RetirementCertificates |
Achieves similar functionality as
retire()
, but instead of retiring from the callers address, it does so from the given address. This allow for pools or third party contracts to retire for the user.It is of note that for this function to work the user needs to approve the third party from the TCO2 contract.
function retireFrom(address account, uint256 amount) external virtual returns (uint256 retirementEventId);
Name | Type | Description |
---|---|---|
account | address | Address from which to retire. |
amount | uint256 | Amount of TCO2 to retire. |
Name | Type | Description |
---|---|---|
retirementEventId | uint256 | The ID of the event emited upon retirement. Can be used later to mint RetirementCertificates |
Just as
retire()
this retires an amount of TCO2, but after the Retired
event is emited this function mints a certificate passing the given retirementEventId
.function retireAndMintCertificate(
string calldata retiringEntityString,
address beneficiary,
string calldata beneficiaryString,
string calldata retirementMessage,
uint256 amount
) external virtual;
Name | Type | Description |
---|---|---|
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 |
amount | uint256 | Amount of TCO2 to retire and issue a RetirementCertificates NFT for. |
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 function mints an NFT based on the amount someone has retired as stored in that mapping. This function is used only for backwards-compatibility reasons. (In case you retired before the
RetirementCertificates
NFT was introduced, but still want the NFT.)Going forward users should mint NFT either directly in the
RetirementCertificates
contract or using the retireAndMintCertificate()
function above.function mintCertificateLegacy(
string calldata retiringEntityString,
address beneficiary,
string calldata beneficiaryString,
string calldata retirementMessage,
uint256 amount
) external;
Name | Type | Description |
---|---|---|
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 |
amount | uint256 | Amount of TCO2 to retire and issue a RetirementCertificates NFT for. |
Function to get corresponding attributes from the carbon project that is represented by this TCO2.
function getAttributes() public view virtual returns (ProjectData memory, VintageData memory);
Below you can find the definitions of the
ProjectData
& VintageData
structs.struct ProjectData {
string projectId;
string standard;
string methodology;
string region;
string storageMethod;
string method;
string emissionType;
string category;
string uri;
address beneficiary;
}
struct VintageData {
/// @dev A human-readable string which differentiates this from other vintages in
/// the same project, and helps build the corresponding TCO2 name and symbol.
string name;
uint64 startTime; // UNIX timestamp
uint64 endTime; // UNIX timestamp
uint256 projectTokenId;
uint64 totalVintageQuantity;
bool isCorsiaCompliant;
bool isCCPcompliant;
string coBenefits;
string correspAdjustment;
string additionalCertification;
string uri;
}
Last modified 5mo ago