Skip to content

Commit

Permalink
Use WETH only for value transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
elenadimitrova committed May 25, 2021
1 parent 390ddbf commit 0fd3c46
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions contracts/base/PeripheryPayments.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@ abstract contract PeripheryPayments is IPeripheryPayments, PeripheryImmutableSta
address recipient,
uint256 value
) internal {
if (token == WETH9 && address(this).balance >= value) {
if (token == WETH9 && IWETH9(WETH9).balanceOf(address(this)) >= value) {
// pay with WETH9
IWETH9(WETH9).deposit{value: value}(); // wrap only what is needed to pay
IWETH9(WETH9).transfer(recipient, value);
} else if (payer == address(this)) {
// pay with tokens already in the contract (for the exact input multihop case)
Expand Down

0 comments on commit 0fd3c46

Please sign in to comment.