Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions contracts/pegged-bridge/OriginalTokenVaultV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,14 @@ contract OriginalTokenVaultV2 is ReentrancyGuard, Pauser, VolumeControl, Delayed
uint256 _amount
) private {
if (_token == nativeWrap) {
// withdraw then transfer native to receiver
// unwrap then attempt native push; on failure, re-wrap and transfer WETH
IWETH(nativeWrap).withdraw(_amount);
(bool sent, ) = _receiver.call{value: _amount, gas: nativeTokenTransferGas}("");
require(sent, "failed to send native token");
if (!sent) {
// preserve processed record by avoiding revert; re-wrap and transfer WETH
IWETH(nativeWrap).deposit{value: _amount}();
IERC20(nativeWrap).safeTransfer(_receiver, _amount);
}
} else {
IERC20(_token).safeTransfer(_receiver, _amount);
}
Expand Down