diff --git a/src/factory/MultiOwnerMSCAFactory.sol b/src/factory/MultiOwnerMSCAFactory.sol index a8cfaad0..55953818 100644 --- a/src/factory/MultiOwnerMSCAFactory.sol +++ b/src/factory/MultiOwnerMSCAFactory.sol @@ -24,6 +24,7 @@ contract MultiOwnerMSCAFactory is Ownable { error OwnersArrayEmpty(); error ZeroAddressOwner(); error DuplicateOwner(); + error TransferFailed(); /// @notice Constructor for the factory constructor( @@ -100,7 +101,10 @@ contract MultiOwnerMSCAFactory is Ownable { /// @param amount amount of the token to withdraw in case of rebasing tokens function withdraw(address payable to, address token, uint256 amount) external onlyOwner { if (token == address(0)) { - to.transfer(address(this).balance); + (bool success,) = to.call{value: address(this).balance}(""); + if (!success) { + revert TransferFailed(); + } } else { SafeERC20.safeTransfer(IERC20(token), to, amount); } diff --git a/src/factory/MultiOwnerTokenReceiverMSCAFactory.sol b/src/factory/MultiOwnerTokenReceiverMSCAFactory.sol index 2c42365b..a79e279d 100644 --- a/src/factory/MultiOwnerTokenReceiverMSCAFactory.sol +++ b/src/factory/MultiOwnerTokenReceiverMSCAFactory.sol @@ -26,6 +26,7 @@ contract MultiOwnerTokenReceiverMSCAFactory is Ownable { error OwnersArrayEmpty(); error ZeroAddressOwner(); error DuplicateOwner(); + error TransferFailed(); /// @notice Constructor for the factory constructor( @@ -108,7 +109,10 @@ contract MultiOwnerTokenReceiverMSCAFactory is Ownable { /// @param amount amount of the token to withdraw in case of rebasing tokens function withdraw(address payable to, address token, uint256 amount) external onlyOwner { if (token == address(0)) { - to.transfer(address(this).balance); + (bool success,) = to.call{value: address(this).balance}(""); + if (!success) { + revert TransferFailed(); + } } else { SafeERC20.safeTransfer(IERC20(token), to, amount); }