Skip to content

ux: withdraw return pending fee decrease#974

Open
adhusson wants to merge 6 commits into
mainfrom
return-more
Open

ux: withdraw return pending fee decrease#974
adhusson wants to merge 6 commits into
mainfrom
return-more

Conversation

@adhusson

@adhusson adhusson commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Goal: if the caller knows an old value of a user's credit (or postmaturity credit: credit - pendingFee) he can always do

(...) = updatePosition(lender); 
(...) = withdraw();

and know the new credit (or postmaturity credit) + the part of the (postmaturity) credit change that was due to a loss.

Before this PR, it was only possible by doing 2 additional reads after the last call (or recreating the pending fee formula).

corresponding thread

@adhusson adhusson changed the title more return values ux: more return values Jun 3, 2026

@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: eb8d8cdb3b

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/Midnight.sol Outdated
@adhusson adhusson changed the title ux: more return values ux: withdraw return pending fee decrease Jun 3, 2026

@MathisGD MathisGD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why shouldn't take return the pendingFee deltas?
should liquidate return the badDebt?

@adhusson

Copy link
Copy Markdown
Contributor Author

why shouldn't take return the pendingFee deltas?
should liquidate return the badDebt?

Bad debt unrelated to credit but I can add it.

For deltas i thought i was too misleading due to reentrancy, if you update using just the value before + the delta you can get it wrong.

@adhusson

Copy link
Copy Markdown
Contributor Author

this is what it looks like wdyt? #1005

@MathisGD MathisGD left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

discussed: let's do this one and not #1005

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.

3 participants