Repository navigation
Added request interfaces for position manager + callback #2
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
171234e
feat: added interfaces for position manager + callback
maxencerb efdf97a
chore: update README
maxencerb 5046918
chore: fix type in Request.sol
maxencerb 78eab4e
feat: added error on repayment when repayment is complete
maxencerb cb0e309
feat: added repayment deadline that automatically unlocks the deadline
maxencerb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.20; | ||
|
|
||
| /// @title IPositionManagerRequest | ||
| /// @notice Interface for the PositionManagerRequest contract that pulls funds from the contract. | ||
| interface IPositionManagerRequest { | ||
| /// @notice Transfers underlying assets from the contract to the puller. | ||
| /// @dev This function is used after offers are consumed to transfer the collected funds | ||
| /// to the borrower. The borrower then repays by transferring assets back to the | ||
| /// contract before `setRepaid()` is called to enable PT/YT holder withdrawals. | ||
| /// @dev This function should trigger a callback to the puller if data is provided. | ||
| /// This should only be called by the puller role. | ||
| /// @param amount The amount of underlying assets to transfer | ||
| /// @param data Additional data to be passed to the puller callback | ||
| function pullFunds(uint256 amount, bytes calldata data) external; | ||
|
|
||
| /// @notice Repays the request by transferring the underlying assets back to the contract. | ||
| /// @dev This function is used to repay the request by transferring the underlying assets back to the contract. | ||
| /// It assumes caller has enough allowance to transfer the underlying assets back to the contract. | ||
| /// Depending on the request contract implementation, this is optional and may be done via a simple transfer. | ||
| /// @param amount The amount of underlying assets to transfer | ||
| function repay(uint256 amount) external; | ||
| } |
11 changes: 11 additions & 0 deletions
11
src/interfaces/request/IPositionManagerRequestCallback.sol
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // SPDX-License-Identifier: BUSL-1.1 | ||
| pragma solidity ^0.8.20; | ||
|
|
||
| /// @title IPositionManagerRequestCallback | ||
| /// @notice Interface for contracts that want to receive callbacks when their requests are being consumed. | ||
| interface IPositionManagerRequestCallback { | ||
| /// @notice Called when the PositionManagerRequest contract pulls funds from the contract with non-null data. | ||
| /// @param amount The amount of underlying assets to transfer | ||
| /// @param data Additional data to be passed to the callback | ||
| function onPullFunds(uint256 amount, bytes calldata data) external; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe emit an event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just an helper for the future if repayment needs to have flashloan repayments or whatever. Plus a repayment in this case can simply be an ERC20 transfer which won't trigger the event anyway.