Pool contracts
We provide pools like BCT (Base Carbon Tonne) or NCT (Nature Carbon Tonne). Each of them has the same standard functions, extends ERC20 & is upgradeable.
Accepts TCO2 within the pool contract and mints pool tokens 1:1.
function deposit(address erc20Addr, uint256 amount) external virtual;
Name | Type | Description |
---|---|---|
erc20Addr | address | Address of the TCO2 to deposit in pool. |
amount | uint256 | Amount of TCO2 to deposit in pool. |
Checks if token can be deposited in the pool. Each pool comes with its own eligibility criteria.
function checkEligible(address erc20Addr) public view virtual returns (bool);
Name | Type | Description |
---|---|---|
erc20Address | address | Address of the token to check. |
Calculates the amount of fees paid to selectively redeem the given TCO2s. Selective redeeming usually incurs fees, whereas if you didn't care what TCO2s you're receiving from the pool that would generally have no fees.
function calculateRedeemFees(
address[] memory tco2s,
uint256[] memory amounts
) external view virtual returns (uint256);
Name | Type | Description |
---|---|---|
tco2s | address[] | An array of addresses of the TCO2s you want redeemed |
amounts | uint256[] | An array of amounts you want redeemed |
It's of note that the arrays have to be equal.
Name | Type | Description |
---|---|---|
Total | uint256 | The total amount of pool tokens you will pay in fees to redeem the given TCO2s. |
Selectively redeems pool tokens for underlying TCO2 tokens. This is 1:1 minus fees. The user's pool tokens get burnt within the process.
function redeemMany(address[] memory tco2s, uint256[] memory amounts)
external virtual;
Name | Type | Description |
---|---|---|
tco2s | address[] | An array of addresses of the TCO2s you want redeemed |
amounts | uint256[] | An array of amounts you want redeemed |
It's of note that the arrays have to be equal.
Automatically redeems pool tokens for underlying TCO2 tokens. This is 1:1 and doesn't incur fees. But you will receive what are considered lower quality TCO2s based on an arbitrary index called
scoredTCO2s
(to be explained further down below). The user's pool tokens get burnt within the process.function redeemAuto(uint256 amount) external virtual;
Name | Type | Description |
---|---|---|
amount | uint256 | Amount of pool tokens to redeem for TCO2s. |
redeemAuto2
acts very similar to redeemAuto
but it also returns arrays of the redeemed TCO2s. This uses more gas but it is going to be more optimal to use by other on-chain contracts.function redeemAuto2(uint256 amount) external virtual
returns (address[] memory tco2s, uint256[] memory amounts);
Name | Type | Description |
---|---|---|
amount | uint256 | Amount of pool tokens to redeem for TCO2s. |
Name | Type | Description |
---|---|---|
tco2s | address[] | An array of addresses of the TCO2s that were redeemed |
amounts | uint256[] | An array of amounts that were redeemed for each given TCO2 |
Redeems a whitelisted TCO2s without paying any fees and immediately burns it. This is not a retirement, but a burn of the TCO2. It is used to clean the pools of subpar TCO2s and was initially added to burn HFC-23 credits. The user's pool tokens get burnt within the process.
function redeemAndBurn(address tco2, uint256 amount) external;
Name | Type | Description |
---|---|---|
tco2 | address | The address of the TCO2s to be burned from the pool |
amount | uint256 | The amount of the TCO2 to be burned from the pool. |
Note: you have to approve the pool token from the TCO2 contract that is to be redeemed and burned in order for this to work.
Returns an array of ranked TCO2 addresses.
scoredTCO2s[0]
being the lowest rank, the rank is then ascending.It's important to note that (currently) this is set manually which means sometimes some of the returned addresses may have a balance of
0
within the pool.function getScoredTCO2s() external view returns (address[] memory);
Name | Type | Description |
---|---|---|
scoredTCO2s | address[] | The addresses of TCO2s in the pool ascending by rank. |
Returns the remaining space in the pool before hitting its cap.
function getRemaining() public view returns (uint256);
Name | Type | Description |
---|---|---|
remaining | uint256 | supplyCap - totalSupply |
Last modified 5mo ago