Skip to content

[rolling fallback] incentive dutch auction - #1127

Open
peyha wants to merge 6 commits into
blue-fallback-rollingfrom
blue-fallback-rolling-auction
Open

[rolling fallback] incentive dutch auction#1127
peyha wants to merge 6 commits into
blue-fallback-rollingfrom
blue-fallback-rolling-auction

Conversation

@peyha

@peyha peyha commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@peyha peyha changed the title feat: auction [rolling fallback] incentive dutch auction Aug 5, 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: 35cc852e60

ℹ️ 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 test/BlueFallbackRollingFactoryTest.sol Outdated
Comment on lines 93 to +97
require(
blueMarketParams.collateralToken == midnightMarket.collateralParams[collateralIndex].token,
InconsistentCollateralToken()
);
require(midnightMarket.collateralParams[collateralIndex].lltv <= blueMarketParams.lltv, BlueLltvTooLow());

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these checks (as well as the loan token check) are not perfect because the users could set non-valid configs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

potential solution, check these in setConfig and use a midnight and blue market instead of their respective ids (it would be more expensive in calldata though)

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.

it's not too bad that one can set an invalid config, but IMO we should do either all checks in setConfig (meaning you can't enable an invalid config) or all checks in roll

bool enabled
) external override {
require(start <= end, EndBeforeStart());
require(incentiveAtStart <= incentiveAtEnd, IncentiveNotIncreasing());

@peyha peyha Aug 7, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is this check really necessary ? would a decreasing incentive make sense ? my gut feeling is that it does not

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.

but at the same time nothing bad happens. we can keep or remove for me, not a big deal

@peyha
peyha requested review from MathisGD and chrmatt August 7, 2026 14:07
Comment thread src/periphery/blue-fallback-rolling/BlueFallbackRolling.sol Outdated
// Round in favor of the Midnight position.
uint256 collateralAssets = IMidnight(MIDNIGHT).collateral(midnightId, user, collateralIndex)
.mulDivDown(assets, IMidnight(MIDNIGHT).debt(midnightId, user));
// Round in favor of the borrower.

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.

I'm realizing that this is not really well said. Less incentive might not always be good for the borrower. In doubt I would remove since this is not very important (unlike the one above). same in incentive() btw

Suggested change
// Round in favor of the borrower.

Comment thread src/periphery/blue-fallback-rolling/BlueFallbackRolling.sol Outdated
Comment thread src/periphery/blue-fallback-rolling/BlueFallbackRolling.sol Outdated
);
require(midnightMarket.collateralParams[collateralIndex].lltv <= blueMarketParams.lltv, BlueLltvTooLow());

// Round in favor of the Midnight position.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the rounding direction has been questioned by @chrmatt and I currently don't have a compelling reason for choosing this direction

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.

yes, see this

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.

let's not tackle that in this PR

@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: 0e54c34760

ℹ️ 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".


/// @param start The start time of the rolling period.
/// @param incentive The caller incentive as a WAD-scaled percentage of the debt rolled.
/// @param end The end time of the rolling period.

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 Update the rolling configuration documentation

Update src/periphery/README.md:26-34 alongside this new end parameter: it still describes configurations as having only a start timestamp and one fixed incentive, and says rolling becomes available after the start without documenting that it expires at end. Integrators following that description will construct the wrong configuration and miss the auction deadline semantics.

AGENTS.md reference: AGENTS.md:L72-L77

Useful? React with 👍 / 👎.

Comment on lines +32 to +33
/// @param incentiveAtStart The caller incentive at `start`, as a WAD-scaled percentage of the debt rolled.
/// @param incentiveAtEnd The caller incentive at `end`, as a WAD-scaled percentage of the debt rolled. The

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.

clear enough we don't need these

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.

Suggested change
/// @param incentiveAtStart The caller incentive at `start`, as a WAD-scaled percentage of the debt rolled.
/// @param incentiveAtEnd The caller incentive at `end`, as a WAD-scaled percentage of the debt rolled. The

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