The `V3AMO._mintAndSellBoost()` function does not work with Velodrome, Aerodrome, Fenix, Thena and Ramses
The `_mintAndSellBoost()` function calls the `swap()` function on SolidlyV3 DEX pools with parameters that do not match the actual `swap()` signature used by Velodrome, Aerodrome, Fenix, Thena and Ramses. As a result, the function reverts, preventing the protocol from minting and selling BOOST tokens to restore the peg.
Source: https://github.com/sherlock-audit/2024-10-axion-judging/issues/268
Found by
ABA, Kirkeelee, KupiaSec, carrotsmuggler, pkqs90
Summary
The protocol mints BOOST tokens and sells them for USD using the _mintAndSellBoost() function for SolidlyV3 DEXes. Since Velodrome, Aerodrome, Fenix, Thena and Ramses are parts of the SolidlyV3 DEXes, they should be compatible. However, the _mintAndSellBoost() function does not work with the DEXes due to incorrect function parameters.
Root Cause
In the _mintAndSellBoost() function, it mints BOOST tokens and swaps them for USD tokens.
File: liquidity-amo\contracts\SolidlyV3AMO.sol
144: @> (int256 amount0, int256 amount1) = ISolidlyV3Pool(pool).swap(
145: address(this),
146: boost < usd,
147: int256(boostAmount), // Amount of BOOST tokens being swapped
148: targetSqrtPriceX96, // The target square root price
149: minUsdAmountOut, // Minimum acceptable amount of USD to receive from the swap
150: deadline
151: );
However, the swap() function of Velodrome, Aerodrome, Fenix, Thena and Ramses has different parameters.
The swap() functions of the DEXes are as follows:
Velodrome : https://optimistic.etherscan.io/address/0xCc0bDDB707055e04e497aB22a59c2aF4391cd12F#code:~:text=File%208%20of%2037%20%3A%20CLPool.sol L613-L619
Aerodrome : https://basescan.org/address/0x5e7BB104d84c7CB9B682AaC2F3d509f5F406809A#code:~:text=File%208%20of%2037%20%3A%20CLPool.sol L679-L685
Fenix : https://blastscan.io/address/0x5aCCAc55f692Ae2F065CEdDF5924C8f6B53cDaa8#code:~:text=File%202%20of%2044%20%3A%20AlgebraPool.sol L212-L218
Thena : https://bscscan.com/address/0xc89F69Baa3ff17a842AB2DE89E5Fc8a8e2cc7358#code:~:text=File%202%20of%2031%20%3A%20AlgebraPool.sol L591-L597
Ramses : https://arbiscan.io/address/0xf896d16fa56a625802b6013f9f9202790ec69908#code:~:text=File%2044%20of%2045%20%3A%20RamsesV2Pool.sol L944-L950
function swap(
address recipient,
bool zeroToOne,
int256 amountRequired,
uint160 limitSqrtPrice,
bytes calldata data
) external override returns (int256 amount0, int256 amount1) {
As a result, the _mintAndSellBoost() function does not work with Velodrome, Aerodrome, Fenix, Thena and Ramses due to incorrect function parameters.
Internal pre-conditions
For convenience, let's assume that the USD token is USDC from this point forward.
- Protocol team is going to mint additional
BOOSTand sell them forUSDCto bring the price back down to peg.
External pre-conditions
- The
BOOST-USDCprice diverges from peg andBOOSTis trading above$1in Velodrome.
Attack Path
- Alice(protocol team) calls the
mintAndSellBoost()function.
It reverts.
Impact
The mintAndSellBoost(), mintSellFarm() functions will be permanently DoSed for Velodrome, Aerodrome, Fenix, Thena and Ramses.
Protocol team can't mint additional BOOST and sell them for USDC to bring the price back down to peg.
PoC
Mitigation
Use the correct function parameters for Velodrome, Aerodrome, Fenix, Thena and Ramses.
Discussion
sherlock-admin2
The protocol team fixed this issue in the following PRs/commits: https://github.com/AXION-MONEY/liquidity-amo/pull/13
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
The `_mintAndSellBoost()` function passes parameters to the `swap()` function that do not match the signature implemented by the target DEX pools.
Impact
The `mintAndSellBoost()` and `mintSellFarm()` functions are permanently disabled for the listed DEXes, so the protocol cannot mint and sell BOOST to bring its price back down to peg.
What the attacker needed
BOOST price diverges above peg on a listed DEX; Protocol team attempts to mint and sell BOOST
The fix
The protocol team fixed this issue by updating the function parameters to match the DEXes' `swap()` signature.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
This is a smart contract bug where a function calls another contract's function with the wrong arguments. The target contracts expect a different set of parameters, so the call fails and the transaction reverts. This means the protocol cannot perform a key stabilisation action on several exchanges.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.