Skip to content

feat: midnight to blue rolling bundle POC - #77

Open
Jean-Grimal wants to merge 6 commits into
mainfrom
feat/midnight-to-blue-roll-bundle
Open

feat: midnight to blue rolling bundle POC#77
Jean-Grimal wants to merge 6 commits into
mainfrom
feat/midnight-to-blue-roll-bundle

Conversation

@Jean-Grimal

Copy link
Copy Markdown
Collaborator

No description provided.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge 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 👍 / 👎.

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.

1 participant