Skip to content

Commit

Permalink
👷 check perm before unwind
Browse files Browse the repository at this point in the history
  • Loading branch information
Flocqst committed Oct 18, 2024
1 parent d8510d7 commit 545e98f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Engine.sol
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,8 @@ contract Engine is
uint256 _swapTolerance,
bytes memory _path
) external payable override {
if (!isAccountOwner(_accountId, msg.sender)) revert Unauthorized();

/// @dev "PERPS_MODIFY_COLLATERAL" permission will be revoked after unwinding through zap
PERPS_MARKET_PROXY.grantPermission(
_accountId, PERPS_MODIFY_COLLATERAL_PERMISSION, address(zap)
Expand Down Expand Up @@ -497,6 +499,8 @@ contract Engine is
uint256 _swapTolerance,
bytes memory _path
) external payable override {
if (!isAccountOwner(_accountId, msg.sender)) revert Unauthorized();

uint256 balanceBefore = WETH.balanceOf(address(this));

/// @dev "PERPS_MODIFY_COLLATERAL" permission will be revoked after unwinding through zap
Expand Down

0 comments on commit 545e98f

Please sign in to comment.