Skip to content

Commit

Permalink
Check return value for WETH transfers
Browse files Browse the repository at this point in the history
Signed-off-by: 34x4p08 <[email protected]>
  • Loading branch information
chainpioneer committed Apr 6, 2021
1 parent 37cb4f9 commit aee3a86
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions contracts/vault-managers/CDPManager01.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ contract CDPManager01 is ReentrancyGuard {

if (msg.value != 0) {
IWETH(WETH).deposit{value: msg.value}();
IWETH(WETH).transfer(msg.sender, msg.value);
require(IWETH(WETH).transfer(msg.sender, msg.value), "Unit Protocol: WETH_TRANSFER_FAILED");
}

join(WETH, msg.value, usdpAmount);
Expand Down Expand Up @@ -205,7 +205,7 @@ contract CDPManager01 is ReentrancyGuard {
**/
function exit_Eth(uint ethAmount, uint usdpAmount) public returns (uint) {
usdpAmount = exit(WETH, ethAmount, usdpAmount);
IWETH(WETH).transferFrom(msg.sender, address(this), ethAmount);
require(IWETH(WETH).transferFrom(msg.sender, address(this), ethAmount), "Unit Protocol: WETH_TRANSFER_FROM_FAILED");
IWETH(WETH).withdraw(ethAmount);
(bool success, ) = msg.sender.call{value:ethAmount}("");
require(success, "Unit Protocol: ETH_TRANSFER_FAILED");
Expand Down

0 comments on commit aee3a86

Please sign in to comment.