Skip to content

Commit

Permalink
Merge pull request #25 from morpho-labs/fix/safe-transfer
Browse files Browse the repository at this point in the history
Fix safeTransfer
  • Loading branch information
MathisGD authored Jul 5, 2023
2 parents 5d4543e + d22f355 commit 1554b78
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Market.sol
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ contract Blue {

collateral[id][msg.sender] += amount;

market.collateralAsset.transferFrom(msg.sender, address(this), amount);
market.collateralAsset.safeTransferFrom(msg.sender, address(this), amount);
}

function withdrawCollateral(Market calldata market, uint amount) external {
Expand All @@ -169,7 +169,7 @@ contract Blue {

require(isHealthy(market, id, msg.sender), "not enough collateral");

market.collateralAsset.transfer(msg.sender, amount);
market.collateralAsset.safeTransfer(msg.sender, amount);
}

// Liquidation.
Expand Down
7 changes: 3 additions & 4 deletions src/interfaces/IERC20.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.5.0;

interface IERC20 {
function transferFrom(address, address, uint) external;
function transfer(address, uint) external;
}
/// @dev Empty because we only call functions in assembly. It prevents calling
/// transfer (transferFrom) instead of safeTransfer (safeTransferFrom).
interface IERC20 {}

0 comments on commit 1554b78

Please sign in to comment.