Skip to content

feat: update stable swap impl#46

Open
ChefMist wants to merge 16 commits into
mainfrom
feat/stable-swap-tweak
Open

feat: update stable swap impl#46
ChefMist wants to merge 16 commits into
mainfrom
feat/stable-swap-tweak

Conversation

@ChefMist

@ChefMist ChefMist commented Jun 3, 2025

Copy link
Copy Markdown
Contributor

this PR update stableSwap router

Previously

  • 2 commands: SS_EXACT_IN, SS_EXACT_IN with same param
  • the first command will swap all the balanceOf instead of based on amountIn

This PR update it to respect amountIn -- unfortunately have to tweak optimizer run to be within size limit

Comment thread src/modules/pancakeswap/StableSwapRouter.sol Outdated
assertEq(ERC20(address(BUSD)).balanceOf(FROM), 100000999768181033551138); // roughly 0.999768181 recieved from swap
}

function test_stableSwap_ExactInput0For1_SamePath_FromRouter() public {

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.

this is the critical test to ensure it passes


// Update amountIn for the next hop. this is done as swapContract do not return the output amount
// If this is the last hop, amountIn is the output amount
amountIn = ERC20(output).balanceOf(address(this)) - outputTokenBal;

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.

unchecked removed as a safeguard due to this minus operation

@ChefMist

ChefMist commented Jun 4, 2025

Copy link
Copy Markdown
Contributor Author

will deploy under this deploymentSalt()

INFINITY-UNIVERSAL-ROUTER/UniversalRouter/1.0.1

@ChefMist

ChefMist commented Jun 4, 2025

Copy link
Copy Markdown
Contributor Author

will only merge once QA is done with this new version on FE -- address is 0x3aD6aC4068569a9970fCC5868cAbcA96E34d5fC3 on bnb, base and arb

@ChefMist

Copy link
Copy Markdown
Contributor Author

Status:

  1. cross-chain swaps to use the new universal router - to verify 🆗
  2. PCS UI to use the new universal router - to verify 🆗
  3. then we merge this PR and update dev docs

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.

4 participants