Toucan
Search
⌃K

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.

Deposit

Accepts TCO2 within the pool contract and mints pool tokens 1:1.
function deposit(address erc20Addr, uint256 amount) external virtual;

Params

Name
Type
Description
erc20Addr
address
Address of the TCO2 to deposit in pool.
amount
uint256
Amount of TCO2 to deposit in pool.

checkEligible

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);

Params

Name
Type
Description
erc20Address
address
Address of the token to check.

calculateRedeemFees

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);

Params

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.

Return Values

Name
Type
Description
Total
uint256
The total amount of pool tokens you will pay in fees to redeem the given TCO2s.

redeemMany

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;

Params

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.

redeemAuto

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;

Params

Name
Type
Description
amount
uint256
Amount of pool tokens to redeem for TCO2s.

redeemAuto2

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);

Params

Name
Type
Description
amount
uint256
Amount of pool tokens to redeem for TCO2s.

Return values

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

redeemAndBurn

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;

Params

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.

getScoredTCO2s

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);

Return values

Name
Type
Description
scoredTCO2s
address[]
The addresses of TCO2s in the pool ascending by rank.

getRemaining

Returns the remaining space in the pool before hitting its cap.
function getRemaining() public view returns (uint256);

Return values

Name
Type
Description
remaining
uint256
supplyCap - totalSupply