Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use safeTransfer when transferring ERC20 token balances #86

Merged
merged 1 commit into from Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PrizeVault.sol
Expand Up @@ -936,7 +936,7 @@ contract PrizeVault is TwabERC20, Claimable, IERC4626, ILiquidationSource, Ownab
yieldVault.redeem(_yieldVaultShares, address(this), address(this));
}
if (_receiver != address(this)) {
_asset.transfer(_receiver, _assets);
_asset.safeTransfer(_receiver, _assets);
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/PrizeVaultFactory.sol
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.24;

import { IERC20, IERC4626 } from "openzeppelin/token/ERC20/extensions/ERC4626.sol";
import { SafeERC20 } from "openzeppelin/token/ERC20/utils/SafeERC20.sol";

import { PrizePool } from "pt-v5-prize-pool/PrizePool.sol";

Expand All @@ -11,6 +12,7 @@ import { PrizeVault } from "./PrizeVault.sol";
/// @author PoolTogether Inc. & G9 Software Inc.
/// @notice Factory contract for deploying new prize vaults using a standard underlying ERC4626 yield vault.
contract PrizeVaultFactory {
using SafeERC20 for IERC20;

////////////////////////////////////////////////////////////////////////////////
// Events
Expand Down Expand Up @@ -115,7 +117,7 @@ contract PrizeVaultFactory {

// A donation to fill the yield buffer is made to ensure that early depositors have
// rounding errors covered in the time before yield is actually generated.
IERC20(_vault.asset()).transferFrom(msg.sender, address(_vault), YIELD_BUFFER);
IERC20(_vault.asset()).safeTransferFrom(msg.sender, address(_vault), YIELD_BUFFER);

allVaults.push(_vault);
deployedVaults[address(_vault)] = true;
Expand Down