Skip to content

Allow borrowing tokens from reserves#251

Merged
nialexsan merged 3 commits intov0from
nialexsan/fix-token-repayment
Mar 10, 2026
Merged

Allow borrowing tokens from reserves#251
nialexsan merged 3 commits intov0from
nialexsan/fix-token-repayment

Conversation

@nialexsan
Copy link
Collaborator

@nialexsan nialexsan commented Mar 9, 2026

Closes: #???

Description

Allow borrowing tokens from reserves, not just MOET


For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the standards mentioned here.
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@nialexsan nialexsan requested a review from a team as a code owner March 9, 2026 19:56
@nialexsan nialexsan changed the base branch from main to v0 March 9, 2026 19:56
@nialexsan nialexsan changed the title Nialexsan/fix token repayment Allow borrowing tokens from reserves Mar 9, 2026
@nialexsan nialexsan requested a review from jordanschalm March 10, 2026 02:48
@vishalchangrani vishalchangrani requested review from a team, Kay-Zee, holyfuchs and liobrasil March 10, 2026 17:17
Copy link
Member

@jordanschalm jordanschalm left a comment

Choose a reason for hiding this comment

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

Looks good. Just a comment on the event balance field to make it always reflect the net withdrawal.

from: <-sinkVault,
poolUUID: self.uuid,
atHealth: balanceSheet.health,
amount: sinkVault.balance,
Copy link
Member

Choose a reason for hiding this comment

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

Should this be the actual amount withdrawn to the sink? Given the conditional on line 3806, we might for example withdraw 100X from our position, then attempt to push that 100X to the sink, but the sink only accepts 50X, so we re-deposit the remaining 50X (net withdrawal of 50X).

I think the event should reflect the net withdrawal in this case.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll create an issue for this to track it, and address it with the other event related tasks

pid: pid,
poolUUID: self.uuid,
atHealth: balanceSheet.health,
amount: sinkVault.balance,
Copy link
Member

Choose a reason for hiding this comment

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

Same thought here

@nialexsan nialexsan merged commit 7ceac06 into v0 Mar 10, 2026
1 check passed
@nialexsan nialexsan deleted the nialexsan/fix-token-repayment branch March 10, 2026 17:38
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.

2 participants