Skip to content

Commit a33037a

Browse files
authored
refactor: audit optimizations (#1410)
1 parent e28dd43 commit a33037a

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

contracts/release/extensions/external-position-manager/external-positions/alice-v2/AliceV2PositionLib.sol

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,6 @@ contract AliceV2PositionLib is IAliceV2Position, AliceV2PositionLibBase1, AssetH
215215
IAliceV2Position.RefundOrderActionArgs memory refundOrderArgs =
216216
abi.decode(_actionsArgs, (IAliceV2Position.RefundOrderActionArgs));
217217

218-
OrderDetails memory orderDetails = getOrderDetails({_orderId: refundOrderArgs.orderId});
219-
220218
// Remove the order from storage
221219
__removeOrder({_orderId: refundOrderArgs.orderId});
222220

@@ -231,14 +229,8 @@ contract AliceV2PositionLib is IAliceV2Position, AliceV2PositionLibBase1, AssetH
231229
_timestamp: refundOrderArgs.timestamp
232230
});
233231

234-
// Return the refunded outgoing asset back to the vault
235-
IERC20 outgoingAsset = IERC20(orderDetails.outgoingAssetAddress);
236-
237-
if (address(outgoingAsset) == ALICEV2_NATIVE_ASSET_ADDRESS) {
238-
Address.sendValue(payable(msg.sender), address(this).balance);
239-
} else {
240-
outgoingAsset.safeTransfer(msg.sender, outgoingAsset.balanceOf(address(this)));
241-
}
232+
// Return the refunded outgoing asset back to the vault using the existing helper
233+
__retrieveAssetBalance({_asset: IERC20(refundOrderArgs.tokenToSell), _receiver: msg.sender});
242234
}
243235

244236
/// @dev Helper to place an order with a reference ID

0 commit comments

Comments
 (0)