Skip to content

Commit

Permalink
refactor: rm approved from Refunds and update approval check in appro…
Browse files Browse the repository at this point in the history
…veRefund()
  • Loading branch information
TamaraRingas committed Nov 25, 2024
1 parent 66de57b commit 9fbeb91
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/router-plus/SuperformRouterPlusAsync.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ contract SuperformRouterPlusAsync is ISuperformRouterPlusAsync, BaseSuperformRou
mapping(uint256 routerPlusPayloadId => Refund) public refunds;
mapping(uint256 routerPlusPayloadId => bool processed) public processedRebalancePayload;

mapping(uint256 routerPlusPayloadId => bool approvedRefund) public approvedRefund;

//////////////////////////////////////////////////////////////
// MODIFIERS //
//////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -431,6 +429,7 @@ contract SuperformRouterPlusAsync is ISuperformRouterPlusAsync, BaseSuperformRou
Refund memory r = refunds[routerPlusPayloadId_];

if (msg.sender != r.receiver) revert INVALID_REQUESTER();
if (r.receiver == address(0)) revert REFUND_ALREADY_APPROVED();
if (r.interimToken == address(0)) revert INVALID_REFUND_DATA();

XChainRebalanceData memory data = xChainRebalanceCallData[r.receiver][routerPlusPayloadId_];
Expand All @@ -446,11 +445,9 @@ contract SuperformRouterPlusAsync is ISuperformRouterPlusAsync, BaseSuperformRou

/// @inheritdoc ISuperformRouterPlusAsync
function approveRefund(uint256 routerPlusPayloadId_) external onlyCoreStateRegistryRescuer {
if (approvedRefund[routerPlusPayloadId_]) revert REFUND_ALREADY_APPROVED();

Refund memory r = refunds[routerPlusPayloadId_];

approvedRefund[routerPlusPayloadId_] = true;
if (r.receiver == address(0) && r.interimToken == address(0)) revert REFUND_ALREADY_APPROVED();

/// @dev deleting to prevent re-entrancy
delete refunds[routerPlusPayloadId_];
Expand Down

0 comments on commit 9fbeb91

Please sign in to comment.