From b667db23af426b61b9f78970d72b1fe738fa30ef Mon Sep 17 00:00:00 2001 From: Lena Hierzi Date: Mon, 2 Oct 2023 17:32:11 +0100 Subject: [PATCH 1/2] fix: move path an address types to address file --- utils/addresses.ts | 11 +++++++++++ utils/paths.ts | 15 +++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/utils/addresses.ts b/utils/addresses.ts index 85fc4da..5beb610 100644 --- a/utils/addresses.ts +++ b/utils/addresses.ts @@ -1,3 +1,14 @@ +interface IfcPoolAddresses { + BCT: string; + NCT: string; +} +interface IfcNetworkPoolAddresses { + celo: IfcPoolAddresses; + alfajores: IfcPoolAddresses; + polygon: IfcPoolAddresses; + mumbai: IfcPoolAddresses; +} + interface IfcOneNetworkAddresses { BCT: string; NCT: string; diff --git a/utils/paths.ts b/utils/paths.ts index 39b743f..ab3c56a 100644 --- a/utils/paths.ts +++ b/utils/paths.ts @@ -1,7 +1,3 @@ -interface IfcPoolAddresses { - BCT: string; - NCT: string; -} interface IfcTokenAddresses { mcUSD?: string[]; cUSD?: string[]; @@ -16,12 +12,6 @@ interface IfcNetworkTokenAddresses { polygon: IfcTokenAddresses; mumbai: IfcTokenAddresses; } -interface IfcNetworkPoolAddresses { - celo: IfcPoolAddresses; - alfajores: IfcPoolAddresses; - polygon: IfcPoolAddresses; - mumbai: IfcPoolAddresses; -} const paths: IfcNetworkTokenAddresses = { celo: { @@ -56,6 +46,11 @@ const paths: IfcNetworkTokenAddresses = { "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1", "0x71DB38719f9113A36e14F409bAD4F07B58b4730b", ], + WETH: [ + "0x48D380cb7de1da5d4cA0DAA696480943fD93B9fF", + "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1", + "0x71DB38719f9113A36e14F409bAD4F07B58b4730b", + ], }, polygon: { USDC: ["0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"], From e93d9e40cb090a623edaaeab27d99fc946f21e53 Mon Sep 17 00:00:00 2001 From: Lena Hierzi Date: Mon, 2 Oct 2023 17:32:48 +0100 Subject: [PATCH 2/2] refactor: call `autoRedeem` instead of `autoRedeem2` --- contracts/OffsetHelper.sol | 4 ++-- contracts/interfaces/IToucanPoolToken.sol | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/contracts/OffsetHelper.sol b/contracts/OffsetHelper.sol index 984217d..68d03d6 100644 --- a/contracts/OffsetHelper.sol +++ b/contracts/OffsetHelper.sol @@ -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. @@ -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; diff --git a/contracts/interfaces/IToucanPoolToken.sol b/contracts/interfaces/IToucanPoolToken.sol index 25672ed..b0c2d5c 100644 --- a/contracts/interfaces/IToucanPoolToken.sol +++ b/contracts/interfaces/IToucanPoolToken.sol @@ -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);