Retire Carbon

The following guide is written for V1 of the Retirement Aggregator. To learn more about V2, see V2 - Diamond. For an in-depth review of the retirement aggregator V1 smart contract, see Retirement Aggregator V1 Contract Guide.

Retiring Carbon via Solidity

Requirements

  • Get some MATIC to pay for gas fees

  • Get some KLIMA tokens to spend to retire carbon

  • Get the contract addresses from here:

1. Transfer your source token to your contract

You can transfer KLIMA tokens to your contract via web3.js and JSON RPC (like using Metamask) or choose to implement a deposit function that calls KLIMA's standard ERC20 approve and transfer functions to allow your contract to transfer users' KLIMA tokens to your contract.

2. Approving the Aggregator contract

Your contract's function calls the KLIMA token's standard ERC20 approve function to allow the Aggregator contract to withdraw KLIMA tokens from your contract. In the example below, an interface named IERC20 to interact with the KLIMA token smart contact.

3. Retiring carbon with the Aggregator contract

Your contract's function calls the Aggregator contract's retireCarbon function. In the example below, an interface named IKlimaRetirementAggregator is used to interact with the Aggregator contract.

To fully understand the parameters for the Aggregator contract's functions, we recommend reviewing this page.

Example 1

Use KLIMA to retire BCT with one beneficiary address, name, and retirement message

Example 2

Use USDC to retire a specific amount of your choice of carbon token (BCT, NCT, UBO, NBO, MCO2) allowing the caller to set the beneficiary information

Last updated

Was this helpful?