LibToucanCarbon

Git Source

Author: Cujo

Functions

redeemAutoAndRetire

Redeems Toucan pool tokens using default redemtion and retires the TCO2

function redeemAutoAndRetire(
    address poolToken,
    uint256 amount,
    address retiringAddress,
    string memory retiringEntityString,
    address beneficiaryAddress,
    string memory beneficiaryString,
    string memory retirementMessage
) internal;

Parameters

NameTypeDescription
poolTokenaddressPool token to use for this retirement
amountuint256Amount of the project token to retire
retiringAddressaddressAddress initiating this retirement
retiringEntityStringstringString description of the retiring entity
beneficiaryAddressaddress0x address for the beneficiary
beneficiaryStringstringString description of the beneficiary
retirementMessagestringString message for this specific retirement

redeemSpecificAndRetire

Redeems Toucan pool tokens using specific redemtion and retires the TCO2

function redeemSpecificAndRetire(
    address poolToken,
    address projectToken,
    uint256 amount,
    address retiringAddress,
    string memory retiringEntityString,
    address beneficiaryAddress,
    string memory beneficiaryString,
    string memory retirementMessage
) internal returns (uint256 retiredAmount);

Parameters

NameTypeDescription
poolTokenaddressPool token to use for this retirement
projectTokenaddressProject token to use for this retirement
amountuint256Amount of the project token to retire
retiringAddressaddressAddress initiating this retirement
retiringEntityStringstringString description of the retiring entity
beneficiaryAddressaddress0x address for the beneficiary
beneficiaryStringstringString description of the beneficiary
retirementMessagestringString message for this specific retirement

Returns

NameTypeDescription
retiredAmountuint256The amount of TCO2 retired

retireTCO2

Redeems Toucan TCO2s

function retireTCO2(
    address poolToken,
    address projectToken,
    uint256 amount,
    address retiringAddress,
    string memory retiringEntityString,
    address beneficiaryAddress,
    string memory beneficiaryString,
    string memory retirementMessage
) internal;

Parameters

NameTypeDescription
poolTokenaddressPool token to use for this retirement
projectTokenaddressProject token to use for this retirement
amountuint256Amount of the project token to retire
retiringAddressaddressAddress initiating this retirement
retiringEntityStringstringString description of the retiring entity
beneficiaryAddressaddress0x address for the beneficiary
beneficiaryStringstringString description of the beneficiary
retirementMessagestringString message for this specific retirement

retirePuroTCO2

Creates a Retirement Request for Toucan Puro TCO2s

function retirePuroTCO2(uint256 tokenId, address projectToken, uint256 amount, LibRetire.RetireDetails memory details)
    internal;

Parameters

NameTypeDescription
tokenIduint256Credit token ID to be retired
projectTokenaddressProject token to use for this retirement
amountuint256Amount of the project token to retire
detailsLibRetire.RetireDetails

sendRetireCert

Send the ERC-721 retirement certificate received to a beneficiary

function sendRetireCert(address _beneficiary) internal;

Parameters

NameTypeDescription
_beneficiaryaddressBeneficiary to send the certificate to

getSpecificRedeemFee

Calculates the additional pool tokens needed to specifically redeem x TCO2s

function getSpecificRedeemFee(address poolToken, uint256 amount) internal view returns (uint256 poolFeeAmount);

Parameters

NameTypeDescription
poolTokenaddressPool token to redeem
amountuint256Amount of TCO2 needed

Returns

NameTypeDescription
poolFeeAmountuint256Number of additional pool tokens needed

getSpecificRetireAmount

Returns the number of TCO2s retired when selectively redeeming x pool tokens

function getSpecificRetireAmount(address poolToken, uint256 amount) internal view returns (uint256 retireAmount);

Parameters

NameTypeDescription
poolTokenaddressPool token to redeem
amountuint256Amount of pool tokens redeemed

Returns

NameTypeDescription
retireAmountuint256Number TCO2s that can be retired.

redeemPoolAuto

Simple wrapper to use redeem Toucan pools using the default list

function redeemPoolAuto(address poolToken, uint256 amount, LibTransfer.To toMode)
    internal
    returns (address[] memory projectTokens, uint256[] memory amounts);

Parameters

NameTypeDescription
poolTokenaddressPool token to redeem
amountuint256Amount of tokens being redeemed
toModeLibTransfer.ToWhere to send TCO2 tokens

Returns

NameTypeDescription
projectTokensaddress[]TCO2 token addresses redeemed
amountsuint256[]TCO2 token amounts redeemed

redeemPoolSpecific

Simple wrapper to use redeem Toucan pools using the specific list

function redeemPoolSpecific(
    address poolToken,
    address[] memory projectTokens,
    uint256[] memory amounts,
    LibTransfer.To toMode
) internal returns (uint256[] memory);

Parameters

NameTypeDescription
poolTokenaddressPool token to redeem
projectTokensaddress[]Project tokens to redeem
amountsuint256[]Token amounts to redeem
toModeLibTransfer.ToWhere to send TCO2 tokens

Returns

NameTypeDescription
<none>uint256[]redeemedAmounts TCO2 token amounts redeemed

isValid

function isValid(address token) internal returns (bool);

isPuro

function isPuro(address token) internal returns (bool);

Events

CarbonRetired

event CarbonRetired(
    LibRetire.CarbonBridge carbonBridge,
    address indexed retiringAddress,
    string retiringEntityString,
    address indexed beneficiaryAddress,
    string beneficiaryString,
    string retirementMessage,
    address indexed carbonPool,
    address carbonToken,
    uint256 retiredAmount
);

CarbonRetired

event CarbonRetired(
    LibRetire.CarbonBridge carbonBridge,
    address indexed retiringAddress,
    string retiringEntityString,
    address indexed beneficiaryAddress,
    string beneficiaryString,
    string retirementMessage,
    address indexed carbonPool,
    address carbonToken,
    uint256 tokenId,
    uint256 retiredAmount
);