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
View function to calculate deposit fees pre-execution
User specifies in front-end the address and amount they want
Parameters
Name | Type | Description |
---|---|---|
tco2 | address | TCO2 contract address |
amount | uint256 | Amount to redeem |
Return Values
Name | Type | Description |
---|---|---|
feeDistributionTotal | uint256 | Total fee amount to be paid |
calculateRedemptionOutFees
View function to calculate fees pre-execution, according to the amounts of TCO2 to be redeemed.
Parameters
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
feeDistributionTotal | uint256 | Total fee amount to be paid |
checkEligible
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
Name | Type | Description |
---|---|---|
vintageToken | address | the contract to check |
Return Values
Name | Type | Description |
---|---|---|
isEligible | bool | true if address is eligible and no other issues occur |
deposit
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
Name | Type | Description |
---|---|---|
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 |
Return Values
Name | Type | Description |
---|---|---|
mintedPoolTokenAmount | uint256 | Amount of pool tokens minted to the caller |
redeemOutMany
Redeem TCO2s for pool tokens 1:1 minus fees The amounts provided are the exact amounts of TCO2s to be redeemed.
Parameters
Name | Type | Description |
---|---|---|
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 |
Return Values
Name | Type | Description |
---|---|---|
poolAmountSpent | uint256 | The amount of pool tokens spent by the caller |
Last updated