Synthetix is not deployed on Mode L2
*issue-contents*
0 CONTENTS
- 1................................................................................
- 2................................................................................
- 3................................................................................
- 4................................................................................
- 5................................................................................
1 METADATA
Number | 112 |
---|---|
Severity | Medium |
Author | valuevalk |
Contest | Autonomint |
Platform | Sherlock |
2 SUMMARY
For liquidationType2 we use Synthetix perps, to create short position. However the Synthetix protocol is not deployed on Mode L2.
3 ROOT CAUSE
Mode L2 is noted in the readme of the competition that will be used. Reference: https://github.com/sherlock-audit/2024-11-autonomint?tab=readme-ov-file#q-on-what-chains-are-the-smart-contracts-going-to-be-deployed
Q: On what chains are the smart contracts going to be deployed? Optimism and Mode
However the Synthetix perps protocol is not deployed on Mode L2. Check deployments here https://docs.synthetix.io/v3/for-developers/addresses-+-abis
Reference: borrowLiquidation.sol#L324-L366
function liquidationType2(address user, uint64 index, uint64 currentEthPrice) internal {
// Get the borrower and deposit details
ITreasury.GetBorrowingResult memory getBorrowingResult = treasury.getBorrowing(user, index);
ITreasury.DepositDetails memory depositDetail = getBorrowingResult.depositDetails;
require(!depositDetail.liquidated, "Already Liquidated");
// Check whether the position is eligible for liquidation
uint128 ratio = BorrowLib.calculateEthPriceRatio(depositDetail.ethPriceAtDeposit, currentEthPrice);
require(ratio <= 8000, "You cannot liquidate, ratio is greater than 0.8");
uint256 amount = BorrowLib.calculateHalfValue(depositDetail.depositedAmountInETH);
// Convert the ETH into WETH
weth.deposit{value: amount}();
// Approve it, to mint sETH
bool approved = weth.approve(address(wrapper), amount);
if (!approved) revert BorrowLiq_ApproveFailed();
// Mint sETH
wrapper.mint(amount);
// Exchange sETH with sUSD
@>> synthetix.exchange(
0x7345544800000000000000000000000000000000000000000000000000000000,
amount,
0x7355534400000000000000000000000000000000000000000000000000000000
);
// Calculate the margin
int256 margin = int256((amount * currentEthPrice) / 100);
// Transfer the margin to synthetix
synthetixPerpsV2.transferMargin(margin);
// Submit an offchain delayed order in synthetix for short position with 1X leverage
@>> synthetixPerpsV2.submitOffchainDelayedOrder(
-int256((uint256(margin * 1 ether * 1e16) / currentEthPrice)), currentEthPrice * 1e16
);
4 IMPACT
The liquidationType2 in borrowingLiquidations.sol
contract won’t work on Mode
L2.
5 MITIGATION
No response
LINKS
*issue-links*
- 1.
- 2.
- 3.