feat: midnight to blue rolling bundle POC - #77
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 503f8ed52b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| IMidnight(MIDNIGHT) | ||
| .withdrawCollateral(sourceMidnightMarket, collateralIndex, collateralAmount, sender, address(this)); | ||
|
|
||
| IERC20Approve(destBlueParams.collateralToken).approve(BLUE, type(uint256).max); |
There was a problem hiding this comment.
Use force approvals for token approvals
When either token is USDT-like and forbids changing a non-zero allowance directly, a successful roll leaves this contract with a remaining BLUE/MIDNIGHT allowance, so the next callback reverts at this approve(max) before the migration can complete. The other bundle contracts use TokenLib.forceApproveMax to skip sufficient allowances and reset to zero when needed; use that helper for both approvals here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 09b1a26d63
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| BLUE = _blue; | ||
| } | ||
|
|
||
| function onRepay(bytes32, Market memory, uint256 units, address, bytes memory data) external returns (bytes32) { |
There was a problem hiding this comment.
Bind the callback to the repaid account
When this shared callback is authorized by a user on Midnight and Blue, ignoring the onBehalf argument lets any caller repay their own Midnight debt with callback = roll while encoding that user as sender; the callback then withdraws the user's Midnight collateral, supplies it to the user's Blue position, borrows against the user, and leaves those borrowed tokens for Midnight to pull for the caller's repay. Derive sender from onBehalf or require sender == onBehalf and that the decoded source market matches the callback market/id.
Useful? React with 👍 / 👎.
This reverts commit 503f8ed.
No description provided.