Generalized Retirement

Common Retirement Parameters

While there are multiple functions available to call based on a user's needs, the base information needed to carry out these transactions is similar among them. The common parameters used by both the exact carbon and exact source functions are as follows:

All retirement functions return the latest retirement index for the transaction just completed.

Retire Exact Carbon

Additional parameter definitions:

function retireExactCarbonDefault(
        address sourceToken,
        address poolToken,
        uint256 maxAmountIn,
        uint256 retireAmount,
        string memory retiringEntityString,
        address beneficiaryAddress,
        string memory beneficiaryString,
        string memory retirementMessage,
        LibTransfer.From fromMode
    ) external payable nonReentrant returns (uint256 retirementIndex) 
function retireExactCarbonSpecific(
        address sourceToken,
        address poolToken,
        address projectToken,
        uint256 maxAmountIn,
        uint256 retireAmount,
        string memory retiringEntityString,
        address beneficiaryAddress,
        string memory beneficiaryString,
        string memory retirementMessage,
        LibTransfer.From fromMode
    ) external payable nonReentrant returns (uint256 retirementIndex)

Retire Exact Source

There are no additional parameters for these functions. They simply transfer in the amount of the source token, and then use all of it to swap (if needed) and retire the specified carbon.

function retireExactSourceDefault(
        address sourceToken,
        address poolToken,
        uint256 maxAmountIn,
        string memory retiringEntityString,
        address beneficiaryAddress,
        string memory beneficiaryString,
        string memory retirementMessage,
        LibTransfer.From fromMode
    ) external payable nonReentrant returns (uint256 retirementIndex)
function retireExactSourceSpecific(
        address sourceToken,
        address poolToken,
        address projectToken,
        uint256 maxAmountIn,
        string memory retiringEntityString,
        address beneficiaryAddress,
        string memory beneficiaryString,
        string memory retirementMessage,
        LibTransfer.From fromMode
    ) external payable nonReentrant returns (uint256 retirementIndex)

View Functions

function getTotalRetirements(address account) external view returns (uint256 totalRetirements) 

function getTotalCarbonRetired(address account) external view returns (uint256 totalCarbonRetired)

function getTotalPoolRetired(address account, address poolToken) external view returns (uint256 totalPoolRetired) 

function getTotalProjectRetired(address account, address projectToken) external view returns (uint256 totalRetired) 

function getTotalRewardsClaimed(address account) external view returns (uint256 totalClaimed)

function getRetirementDetails(address account, uint256 retirementIndex)
    external
    view
    returns (
        address poolTokenAddress,
        address projectTokenAddress,
        address beneficiaryAddress,
        string memory beneficiary,
        string memory retirementMessage,
        uint256 amount
    )
    
function getSourceAmountSpecificRetirement(
        address sourceToken,
        address carbonToken,
        uint256 retireAmount
    ) external view returns (uint256 amountIn)
    
function getSourceAmountDefaultRetirement(
        address sourceToken,
        address carbonToken,
        uint256 retireAmount
    ) public view returns (uint256 amountIn)
    
function getSourceAmountDefaultRedeem(
        address sourceToken,
        address carbonToken, // Pool token being redeemed
        uint256 redeemAmount
    ) public view returns (uint256 amountIn)

function getSourceAmountSpecificRedeem(
        address sourceToken,
        address carbonToken, // Pool token being redeemed
        uint256[] memory redeemAmounts
    ) public view returns (uint256 amountIn)

Last updated