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

Add warning on repay/withdraw #279

Merged
merged 3 commits into from
Aug 13, 2023
Merged
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
8 changes: 8 additions & 0 deletions src/interfaces/IMorpho.sol
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ interface IMorpho is IFlashLender {
/// is guaranteed to have `amount` tokens pulled from their balance,
/// but the possibility to mint a specific amount of shares is given
/// for full compatibility and precision.
/// @dev Supplying a large amount can overflow and revert without any error message.
/// @param market The market to supply assets to.
/// @param amount The amount of assets to supply.
/// @param shares The amount of shares to mint.
Expand All @@ -124,6 +125,7 @@ interface IMorpho is IFlashLender {
/// @dev Either `amount` or `shares` should be zero.
/// To withdraw the whole position, pass the `shares`'s balance of `onBehalf`.
/// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.
/// @dev Withdrawing an amount corresponding to more shares than supplied will underflow and revert without any error message.
/// @param market The market to withdraw assets from.
/// @param shares The amount of amount to withdraw.
/// @param shares The amount of shares to burn.
Expand All @@ -142,6 +144,7 @@ interface IMorpho is IFlashLender {
/// but the possibility to burn a specific amount of shares is given
/// for full compatibility and precision.
/// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.
/// @dev Borrowing a large amount can underflow and revert without any error message.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Overflow* 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fuck

Copy link
Contributor Author

Choose a reason for hiding this comment

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

/// @param market The market to borrow assets from.
/// @param amount The amount of assets to borrow.
/// @param shares The amount of shares to mint.
Expand All @@ -157,6 +160,7 @@ interface IMorpho is IFlashLender {
/// optionally calling back the caller's `onMorphoReplay` function with the given `data`.
/// @dev Either `amount` or `shares` should be zero.
/// To repay the whole debt, pass the `shares`'s balance of `onBehalf`.
/// @dev Repaying an amount corresponding to more shares than borrowed will underflow and revert without any error message.
/// @param market The market to repay assets to.
/// @param amount The amount of assets to repay.
/// @param shares The amount of shares to burn.
Expand All @@ -171,6 +175,7 @@ interface IMorpho is IFlashLender {
/// @notice Supplies the given `amount` of collateral to the given `market` on behalf of `onBehalf`,
/// optionally calling back the caller's `onMorphoSupplyCollateral` function with the given `data`.
/// @dev Interests are not accrued since it's not required and it saves gas.
/// @dev Supplying a large amount can overflow and revert without any error message.
/// @param market The market to supply collateral to.
/// @param amount The amount of collateral to supply.
/// @param onBehalf The address that will receive the collateral.
Expand All @@ -179,6 +184,7 @@ interface IMorpho is IFlashLender {

/// @notice Withdraws the given `amount` of collateral from the given `market` on behalf of `onBehalf`.
/// @dev `msg.sender` must be authorized to manage `onBehalf`'s positions.
/// @dev Withdrawing an amount corresponding to more collateral than supplied will underflow and revert without any error message.
/// @param market The market to withdraw collateral from.
/// @param amount The amount of collateral to withdraw.
/// @param onBehalf The address of the owner of the collateral.
Expand All @@ -187,6 +193,8 @@ interface IMorpho is IFlashLender {

/// @notice Liquidates the given `seized` amount to the given `market` of the given `borrower`'s position,
/// optionally calling back the caller's `onMorphoLiquidate` function with the given `data`.
/// @dev Seizing more than the collateral balance will revert without any error message.
/// @dev Repaying more than the borrow balance will overflow and revert without any error message.
/// @param market The market of the position.
/// @param borrower The owner of the position.
/// @param seized The amount of collateral to seize.
Expand Down