Skip to content

Commit

Permalink
refactor: call autoRedeem instead of autoRedeem2
Browse files Browse the repository at this point in the history
  • Loading branch information
Lena Hierzi committed Oct 2, 2023
1 parent b667db2 commit e93d9e4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
4 changes: 2 additions & 2 deletions contracts/OffsetHelper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import "./interfaces/IToucanContractRegistry.sol";
*
* Retiring carbon tokens requires multiple steps and interactions with
* Toucan Protocol's main contracts:
* 1. Obtain a Toucan pool token e.g., NCT (by performing a token
* 1. Obtain a pool token e.g., NCT (by performing a token
* swap on a DEX).
* 2. Redeem the pool token for a TCO2 token.
* 3. Retire the TCO2 token.
Expand Down Expand Up @@ -359,7 +359,7 @@ contract OffsetHelper is OffsetHelperStorage {
IToucanPoolToken PoolTokenImplementation = IToucanPoolToken(_fromToken);

// auto redeem pool token for TCO2; will transfer automatically picked TCO2 to this contract
(tco2s, amounts) = PoolTokenImplementation.redeemAuto2(_amount);
(tco2s, amounts) = PoolTokenImplementation.redeemAuto(_amount);

// update balances
balances[msg.sender][_fromToken] -= _amount;
Expand Down
23 changes: 13 additions & 10 deletions contracts/interfaces/IToucanPoolToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,27 @@ interface IToucanPoolToken is IERC20Upgradeable {

function checkEligible(address erc20Addr) external view returns (bool);

function checkAttributeMatching(address erc20Addr)
external
view
returns (bool);
function checkAttributeMatching(
address erc20Addr
) external view returns (bool);

function calculateRedeemFees(
address[] memory tco2s,
uint256[] memory amounts
) external view returns (uint256);

function redeemMany(address[] memory tco2s, uint256[] memory amounts)
external;
function redeemMany(
address[] memory tco2s,
uint256[] memory amounts
) external;

function redeemAuto(uint256 amount) external;
function redeemAuto(
uint256 amount
) external returns (address[] memory tco2s, uint256[] memory amounts);

function redeemAuto2(uint256 amount)
external
returns (address[] memory tco2s, uint256[] memory amounts);
function redeemAuto2(
uint256 amount
) external returns (address[] memory tco2s, uint256[] memory amounts);

function getRemaining() external view returns (uint256);

Expand Down

0 comments on commit e93d9e4

Please sign in to comment.