Skip to content

Supernova AMO#2800

Open
sparrowDom wants to merge 41 commits intomasterfrom
sparrowDom/supernovaAMO
Open

Supernova AMO#2800
sparrowDom wants to merge 41 commits intomasterfrom
sparrowDom/supernovaAMO

Conversation

@sparrowDom
Copy link
Member

@sparrowDom sparrowDom commented Feb 14, 2026

Supernova AMO

TODO:

  • the sonic deploy script should be removed once fork testing Swapx amo is not needed anymore
  • uncomment the hardcoded OETH/WETH address in the StableSwapAMMStrategy.sol after the deploy

What was done

  • Refactored the Sonic SwapXAMO strategy into a generalized Algebra-based strategy.
  • Updated strategy behavior to accept pool tokens in any order, removing token-order assumptions.
  • Kept strategy behavior consistent while improving flexibility and reuse across Algebra-style pools.

Test fixes and updates

  • Fixed existing Sonic fork tests that were broken or outdated after the refactor.
  • Adjusted fork test setup and assertions to match the new generalized strategy interface/flow.
  • Updated test cases to validate compatibility with the refactored format and token-order handling.

Why this change

  • The prior SwapXAMO implementation was too specialized and was expecting ws / OS tokens in specific order. Also the strategy was named SwapX even though the pool engine underneath was Algebra
  • Ensuring token-order-agnostic handling prevents integration issues across pools with varying token ordering.

What isn't done

  • The strategy still expects both tokens to have 18 decimal format. Additional work is required to make strategy support non 18 decimal tokens.

Code review suggestions

A couple of files have been moved still they should be compared with their old versions:

  • StableSwapAMMStrategy.sol with the SonicSwapXAMOStrategy.sol example code-diff as of 03e81d9 commit : https://www.diffchecker.com/MdOvAfVf/
  • algebraAmoStrategy.js with the swapx-amo.sonic.fork-test.js online diff tools do a terrible job here
  • Compare of SwapX Pair contract with Supernova's sol2uml diff 0x6509f770B83856Ac51613AEe73D1E7bFaD032784 -bn sonic 0xcfE67b6c7B65c8d038e666b3241a161888B7f2b0

@sparrowDom sparrowDom marked this pull request as draft February 14, 2026 12:46
@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 15.65217% with 194 lines in your changes missing coverage. Please review.
✅ Project coverage is 44.92%. Comparing base (6f80e57) to head (4e49bd8).

Files with missing lines Patch % Lines
...racts/strategies/algebra/StableSwapAMMStrategy.sol 15.35% 193 Missing ⚠️
...ntracts/strategies/sonic/SonicSwapXAMOStrategy.sol 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2800      +/-   ##
==========================================
- Coverage   45.06%   44.92%   -0.15%     
==========================================
  Files         105      107       +2     
  Lines        4500     4523      +23     
  Branches     1228     1235       +7     
==========================================
+ Hits         2028     2032       +4     
- Misses       2469     2488      +19     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Sonic SwapXAMO strategy into a generalized Algebra-based AMO strategy and introduces a new Supernova AMO strategy for OETH on mainnet. The refactoring enables code reuse across different Algebra-style DEX pools while making the strategy token-order agnostic.

Changes:

  • Extracted a generalized StableSwapAMMStrategy base contract that works with any Algebra-style stable swap pool
  • Refactored SonicSwapXAMOStrategy to inherit from the base contract, removing ~850 lines of duplicated code
  • Added new OETHSupernovaAMOStrategy for OETH/WETH pool on mainnet
  • Created comprehensive behavior-driven tests that can be reused across different Algebra AMO implementations
  • Updated deployment scripts and fixtures to support the new strategy architecture

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
contracts/contracts/strategies/algebra/StableSwapAMMStrategy.sol New generalized base strategy for Algebra stable pools with token-order-agnostic handling
contracts/contracts/strategies/sonic/SonicSwapXAMOStrategy.sol Refactored to inherit from base, reducing from ~850 to ~5 lines
contracts/contracts/strategies/algebra/OETHSupernovaAMOStrategy.sol New OETH Supernova AMO strategy implementation
contracts/test/behaviour/algebraAmoStrategy.js Comprehensive reusable behavior tests for Algebra AMO strategies
contracts/test/strategies/sonic/swapx-amo.sonic.fork-test.js Refactored to use behavior tests
contracts/test/strategies/oeth-supernova-amo.mainnet.fork-test.js New tests for OETH Supernova strategy
contracts/deploy/mainnet/178_supernova_AMO.js Deployment script for mainnet Supernova AMO
contracts/deploy/deployActions.js Helper functions for pool/gauge creation and strategy deployment
contracts/test/_fixture.js New fixture for OETH Supernova AMO testing
contracts/test/_fixture-sonic.js Enhanced fixture with auto-allocate handling
contracts/contracts/interfaces/algebra/* New interfaces for Algebra pair and gauge contracts
contracts/utils/addresses.js Added Supernova protocol addresses

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

naddison36 and others added 5 commits February 24, 2026 09:36
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link

Copilot AI commented Feb 23, 2026

@naddison36 I've opened a new pull request, #2810, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Collaborator

@naddison36 naddison36 left a comment

Choose a reason for hiding this comment

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

I have a separate PR with some changes #2811

naddison36 and others added 6 commits February 26, 2026 19:12
* Removed asset and oToken from StableSwapAMMStrategy constructor
Added oToken to IVault which is used by StableSwapAMMStrategy constructor
Removed calculateRedeemOutput and calculateRedeemOutputs from IVault

* Added contract diagrams for OETHSupernovaAMOStrategy

* Fix SwapX AMO fork tests

* Fix SwapX AMO fork tests

* More rounding issues with Algebra fork tests
@sparrowDom
Copy link
Member Author

@copilot can you do another pass?

Copy link
Collaborator

@naddison36 naddison36 left a comment

Choose a reason for hiding this comment

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

We need to decide if we combined the 172_oeth_vault_upgrade and 179_supernova_AMO deploy scripts.

OETHSupernovaAMOStrategy calls oToken and asset on the OETHVault so I'm happy to combine these into the one governance proposal.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 16 out of 22 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sparrowDom
Copy link
Member Author

Due to Supernova requiring the upgraded vault to be deployed, for this deploy WETH and OETH values have been hardcoded: 6bde7d3

return fixture;
}

async function supernovaOETHAMOFixure(
Copy link
Collaborator

Choose a reason for hiding this comment

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

typo: supernovaOETHAMOFixture

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks fixed here: 5d1a14f

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.

5 participants