Skip to content

Commit

Permalink
safe transfer
Browse files Browse the repository at this point in the history
  • Loading branch information
ethereumdegen committed Nov 8, 2024
1 parent 2d699ba commit bb941da
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/contracts/contracts/escrow/CollateralEscrowV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { SafeERC20Upgradeable } from "@openzeppelin/contracts-upgradeable/token/
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/IERC1155Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC721/IERC721ReceiverUpgradeable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "../interfaces/escrow/ICollateralEscrowV1.sol";

contract CollateralEscrowV1 is OwnableUpgradeable, ICollateralEscrowV1 {
Expand Down Expand Up @@ -116,7 +117,10 @@ contract CollateralEscrowV1 is OwnableUpgradeable, ICollateralEscrowV1 {
"Asset not allowed to be withdrawn as dust"
);

IERC20Upgradeable(tokenAddress).transfer(recipient, amount);

SafeERC20Upgradeable.safeTransfer(IERC20Upgradeable(tokenAddress),recipient, amount);


}


Expand Down Expand Up @@ -180,8 +184,8 @@ contract CollateralEscrowV1 is OwnableUpgradeable, ICollateralEscrowV1 {
address _recipient
) internal {
// Withdraw ERC20
if (_collateral._collateralType == CollateralType.ERC20) {
IERC20Upgradeable(_collateralAddress).transfer(_recipient, _amount);
if (_collateral._collateralType == CollateralType.ERC20) {
SafeERC20Upgradeable.safeTransfer(IERC20Upgradeable(_collateralAddress),_recipient, _amount);
}
// Withdraw ERC721
else if (_collateral._collateralType == CollateralType.ERC721) {
Expand Down

0 comments on commit bb941da

Please sign in to comment.