Skip to content

Latest commit

 

History

History
70 lines (49 loc) · 2.15 KB

022.md

File metadata and controls

70 lines (49 loc) · 2.15 KB

Low Tangerine Cod

Medium

Synthetix orders will not be executable due to not implemented payable

Summary

The admin would not be able to pass ether to synthetixPerpsV2.executeOffchainDelayedOrder

Root Cause

Protocol liquidates user's positions by taking a short position in Synthetix. Later, admin should be able to execute those positions in Synthetix to maintain automint. Admin calls executeOrdersInSynthetix -> executeOrdersInSynthetix executeOffchainDelayedOrder passed 1 wei, but there is not receive function in that contract. payable is not being imeplented which means gas will not be passed

     function executeOrdersInSynthetix(
        bytes[] calldata priceUpdateData
    ) external onlyBorrowingContract {
        // Execute the submitted order
        synthetixPerpsV2.executeOffchainDelayedOrder{value: 1}(address(this), priceUpdateData);
    }

0xVolodya/blob/d4c790d2a7fcf4998effcb2490c7a9fba97ad465/Blockchain/Blockchian/contracts/Core_logic/borrowLiquidation.sol#L385

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

protocol will not be able to executed orders to get profit. Profits or losses are realized only when the order is executed.

PoC

No response

Mitigation

implement payable

    function executeOrdersInSynthetix(
        bytes[] calldata priceUpdateData
-    ) external onlyAdmin {
+    ) external payable onlyAdmin {
        
        // call executeOrdersInSynthetix in borrowLiquidation contract
-        borrowLiquidation.executeOrdersInSynthetix(priceUpdateData);
+        borrowLiquidation.executeOrdersInSynthetix{value: msg.value}(priceUpdateData);
    }
    function executeOrdersInSynthetix(
        bytes[] calldata priceUpdateData
-    ) external onlyBorrowingContract {
+    ) external payable onlyBorrowingContract {

        // Execute the submitted order
        synthetixPerpsV2.executeOffchainDelayedOrder{value: 1}(address(this), priceUpdateData);
    }