Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LILA-5632] update redeemauto function to work like autoredeem2 in offsethelper #22

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/OffsetHelper.sol
Original file line number Diff line number Diff line change
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
11 changes: 11 additions & 0 deletions utils/addresses.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
15 changes: 5 additions & 10 deletions utils/paths.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
interface IfcPoolAddresses {
BCT: string;
NCT: string;
}
interface IfcTokenAddresses {
mcUSD?: string[];
cUSD?: string[];
Expand All @@ -16,12 +12,6 @@ interface IfcNetworkTokenAddresses {
polygon: IfcTokenAddresses;
mumbai: IfcTokenAddresses;
}
interface IfcNetworkPoolAddresses {
celo: IfcPoolAddresses;
alfajores: IfcPoolAddresses;
polygon: IfcPoolAddresses;
mumbai: IfcPoolAddresses;
}

const paths: IfcNetworkTokenAddresses = {
celo: {
Expand Down Expand Up @@ -56,6 +46,11 @@ const paths: IfcNetworkTokenAddresses = {
"0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1",
"0x71DB38719f9113A36e14F409bAD4F07B58b4730b",
],
WETH: [
"0x48D380cb7de1da5d4cA0DAA696480943fD93B9fF",
"0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1",
"0x71DB38719f9113A36e14F409bAD4F07B58b4730b",
],
},
polygon: {
USDC: ["0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"],
Expand Down
Loading