feat(multi-atm): perfectly linear accrual#56
Merged
adam-hotait merged 1 commit intomainfrom Feb 27, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds an optional “linear yield” pricing mode to MultiATM, where the swap price is derived via linear extrapolation from the last two oracle rounds (instead of min/max bounding), and extends the test suite to validate the new behavior.
Changes:
- Extend pair configuration and events to include a
linearYieldflag. - Implement linear extrapolation pricing path in
MultiATMusing the two latest oracle rounds. - Update and expand tests to cover linear-yield pricing behavior and updated pair details/event args.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 10 comments.
| File | Description |
|---|---|
contracts/token/MultiATM.sol |
Adds linearYield to pair config, updates ABI (event + view), and introduces linear extrapolation pricing logic. |
test/main.test.js |
Updates existing expectations for the new flag and adds extensive regression/swap tests for linear-yield pricing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
antoinemch
approved these changes
Feb 17, 2026
fondation451
approved these changes
Feb 17, 2026
b580207 to
56d0c50
Compare
56d0c50 to
957c21a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current situation
The MultiATM contract facilitates asset swaps (e.g.,
USTBL <> USDC) based on on-chain Oracle prices. To mitigate sandwich attacks during Oracle update blocks, the contract currently employs a spread-based logic:This "min/max" logic prevents sandwich attackers from profiting from the price delta immediately before and after an Oracle update.
Multi-Hop Swaps. The contract supports swaps between any two assets provided an Oracle Path exists (e.g.,
eurSPKCC→EURC→USDC→USTBL). The price is calculated by traversing the vertices of the path, which is provided as a parameter by the user during the function call.Objective of the feature: Linear Yield Accrual
We aim to introduce instant yield accrual for specific assets that exhibit linear Net Asset Value (NAV) growth, such as MMF shares (e.g.,
USTBL,EUTBL). For these Linear Accruing Pairs, we will replace the min/max logic with a linear extrapolation based on the current block timestamp. This allows for a single, fair price for both buys and sells that reflects real-time yield growth between Oracle updates. For such identified pairs, the price function need to be updated to:Where: