Carbon pool contracts

All carbon pools have the same standard functions

Toucan's Carbon Pool smart contracts extend the ERC20 standard — carbon reference tokens are ERC20 tokens. Pool contracts are upgradeable. Contract addresses for deployed carbon pools can be found at app.toucan.earth/contracts.

calculateDepositFees

function calculateDepositFees(address tco2, uint256 amount) external view returns (uint256 feeDistributionTotal)

View function to calculate deposit fees pre-execution

User specifies in front-end the address and amount they want

Parameters

NameTypeDescription

tco2

address

TCO2 contract address

amount

uint256

Amount to redeem

Return Values

NameTypeDescription

feeDistributionTotal

uint256

Total fee amount to be paid

calculateRedemptionOutFees

function calculateRedemptionOutFees(address[] tco2s, uint256[] amounts, bool toRetire) external view returns (uint256 feeDistributionTotal)

View function to calculate fees pre-execution, according to the amounts of TCO2 to be redeemed.

Parameters

NameTypeDescription

tco2s

address[]

Array of TCO2 contract addresses

amounts

uint256[]

Array of TCO2 amounts to redeem The indexes of this array are matching 1:1 with the tco2s array.

toRetire

bool

Whether the TCO2s will be retired atomically with the redemption. It may be that lower fees will be charged in this case. Currently not supported.

Return Values

NameTypeDescription

feeDistributionTotal

uint256

Total fee amount to be paid

checkEligible

function checkEligible(address vintageToken) external view virtual returns (bool isEligible)

Checks if token to be deposited is eligible for this pool. Reverts if not. Beware that the revert reason might depend on the underlying implementation of IPoolFilter.checkEligible

Parameters

NameTypeDescription

vintageToken

address

the contract to check

Return Values

NameTypeDescription

isEligible

bool

true if address is eligible and no other issues occur

deposit

function deposit(address tco2, uint256 amount, uint256 maxFee) external returns (uint256 mintedPoolTokenAmount)

Deposit function for pool that accepts TCO2s and mints pool token 1:1

Eligibility of the ERC20 token to be deposited is checked via checkEligible

Parameters

NameTypeDescription

tco2

address

TCO2 to be deposited. The pool contract needs to be approved in the TCO2 contract by the caller in order to allow the transfer of TCO2 tokens to the pool

amount

uint256

Amount of TCO2 to be deposited

maxFee

uint256

Maximum fee to be paid for the deposit. This value cannot be zero. Use calculateDepositFees(tco2,amount) to determine the fee that will be charged given the state of the pool during this call. Add a buffer on top of the returned fee amount up to the maximum fee you are willing to pay.

Return Values

NameTypeDescription

mintedPoolTokenAmount

uint256

Amount of pool tokens minted to the caller

redeemOutMany

function redeemOutMany(address[] tco2s, uint256[] amounts, uint256 maxFee) external virtual returns (uint256 poolAmountSpent)

Redeem TCO2s for pool tokens 1:1 minus fees The amounts provided are the exact amounts of TCO2s to be redeemed.

Parameters

NameTypeDescription

tco2s

address[]

Array of TCO2 contract addresses

amounts

uint256[]

Array of TCO2 amounts to redeem The indexes of this array are matching 1:1 with the tco2s array.

maxFee

uint256

Maximum fee to be paid for the redemption. This value cannot be zero. Use calculateRedemptionOutFees(tco2s,amounts,false) to determine the fee that will be charged given the state of the pool during this call. Add a buffer on top of the returned fee amount up to the maximum fee you are willing to pay.

Return Values

NameTypeDescription

poolAmountSpent

uint256

The amount of pool tokens spent by the caller

Last updated