Skip to content

Commit

Permalink
Audit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Fletch153 committed Nov 22, 2024
1 parent 1b18243 commit 6e45c51
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions contracts/src/v0.8/llo-feeds/v0.5.0/FeeManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ contract FeeManager is IFeeManager, ConfirmedOwner, TypeAndVersionInterface {
);

if (fee.amount == 0) {
_tryReturnChange(subscriber, msg.value);
_transfer(subscriber, msg.value);
return;
}

Expand Down Expand Up @@ -240,7 +240,7 @@ contract FeeManager is IFeeManager, ConfirmedOwner, TypeAndVersionInterface {
if (numberOfLinkFees != 0 || numberOfNativeFees != 0) {
_handleFeesAndRewards(subscriber, feesAndRewards, numberOfLinkFees, numberOfNativeFees);
} else {
_tryReturnChange(subscriber, msg.value);
_transfer(subscriber, msg.value);
}
}

Expand Down Expand Up @@ -361,9 +361,7 @@ contract FeeManager is IFeeManager, ConfirmedOwner, TypeAndVersionInterface {
function withdraw(address assetAddress, address recipient, uint192 quantity) external onlyOwner {
//address 0 is used to withdraw native in the context of withdrawing
if (assetAddress == address(0)) {
(bool success, ) = payable(recipient).call{value: quantity}("");

if (!success) revert InvalidReceivingAddress();
_transfer(recipient, quantity);
return;
}

Expand Down Expand Up @@ -498,12 +496,13 @@ contract FeeManager is IFeeManager, ConfirmedOwner, TypeAndVersionInterface {
}

// a refund may be needed if the payee has paid in excess of the fee
_tryReturnChange(subscriber, change);
_transfer(subscriber, change);
}

function _tryReturnChange(address subscriber, uint256 quantity) internal {
function _transfer(address to, uint256 quantity) internal {
if (quantity != 0) {
payable(subscriber).transfer(quantity);
(bool success, ) = payable(to).call{value: quantity}("");
if (!success) revert InvalidReceivingAddress();
}
}

Expand Down

0 comments on commit 6e45c51

Please sign in to comment.