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

Feat/repay wrapper #23

Open
wants to merge 7 commits into
base: feat/susds-wrappers
Choose a base branch
from
Open

Conversation

foodaka
Copy link

@foodaka foodaka commented Oct 7, 2024

  • Adds repay and repaywithpermit wrapper functionality

Copy link

height bot commented Oct 7, 2024

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

require(amountWrapped > 0, 'INSUFFICIENT_WRAPPED_TOKEN_RECEIVED');

SafeERC20.safeApprove(IERC20(TOKEN_OUT), address(POOL), amountWrapped);
POOL.repay(TOKEN_OUT, amountWrapped, 2, onBehalfOf);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
POOL.repay(TOKEN_OUT, amountWrapped, 2, onBehalfOf);
POOL.repay(TOKEN_OUT, amountWrapped, VARIABLE_INTEREST_RATE_MODE, onBehalfOf);

@@ -240,6 +269,23 @@ abstract contract BaseTokenWrapper is Ownable, IBaseTokenWrapper {
IERC20(TOKEN_IN).transfer(onBehalfOf, amountIn);
}

function _repayToken(
uint256 amount,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to handle max repayment here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so retrieve the outstanding debt of the user, and repay all if amount is higher.

we must do the same thing for withdraw

@@ -878,11 +878,16 @@ abstract contract BaseTokenWrapperTest is Test {
}
}

function testFuzzBorrowToken(uint256 borrowAmount) public {
function testFuzzRepayToken(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are replacing testFuzzBorrowToken test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants