LibC3Carbon

Git Source

Author: Cujo

Functions

freeRedeemAndRetire

Calls freeRedeem on a C3 pool and retires the underlying C3T

function freeRedeemAndRetire(
    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 tokens to redeem and 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

Calls taxedRedeem on a C3 pool and retires the underlying C3T

function redeemSpecificAndRetire(
    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 being redeemed
amountuint256Amount of tokens to redeem and 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

retireC3T

Retire a C3T token

function retireC3T(
    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 being redeemed
amountuint256Amount of tokens to redeem and 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

getExactCarbonSpecificRedeemFee

Return the additional fee needed to redeem specific number of project tokens.

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

Parameters

NameTypeDescription
poolTokenaddressPool token to use for this retirement
amountuint256Amount of tokens to redeem and retire

Returns

NameTypeDescription
poolFeeAmountuint256Additional C3 pool tokens needed for the redemption

getExactSourceSpecificRetireAmount

Return the amount that can be specifically redeemed from a C3 given x number of tokens.

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

Parameters

NameTypeDescription
poolTokenaddressPool token to use for this retirement
amountuint256Amount of tokens to redeem and retire

Returns

NameTypeDescription
retireAmountuint256Amount of C3T that can be specifically redeemed from a given pool amount

redeemPoolAuto

Receives and redeems a number of pool tokens and sends the C3T to a destination..

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

Parameters

NameTypeDescription
poolTokenaddressPool token to use for this retirement
amountuint256Amount of tokens to redeem and retire
toModeLibTransfer.ToWhere to send redeemed tokens to

Returns

NameTypeDescription
allProjectTokensaddress[]Default redeem C3T list from the pool
amountsuint256[]Amount of C3T that was redeemed from the pool

redeemPoolSpecific

Receives and redeems a number of pool tokens and sends the C3T to a destination.

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

Parameters

NameTypeDescription
poolTokenaddressPool token to use for this retirement
projectTokensaddress[]Project tokens to redeem
amountsuint256[]Amounts of the project tokens to redeem
toModeLibTransfer.ToWhere to send redeemed tokens to

Returns

NameTypeDescription
<none>uint256[]redeemedAmounts Amounts of the project tokens redeemed

isValid

function isValid(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
);