Skip to content

Commit 4b92eec

Browse files
authored
fix: add reentrancy guard to withdraw function in factory contract
1 parent 4386ae4 commit 4b92eec

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/blockchain/src/FairFund.sol

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,14 @@ import {VotingPowerToken} from "./VotingPowerToken.sol";
3131
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
3232
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
3333
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
34+
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
3435

3536
/**
3637
* @title FairFund
3738
* @author Aditya Bhattad
3839
* @notice This is the main FairFund contract that will be used for deployment and keeping track of all the funding vaults.
3940
*/
40-
contract FairFund is Ownable {
41+
contract FairFund is Ownable, ReentrancyGuard {
4142
// Errors //
4243
error FairFund__CannotBeAZeroAddress();
4344
error FairFund__TallyDateCannotBeInThePast();
@@ -125,7 +126,7 @@ contract FairFund is Ownable {
125126
* @param recepient The address to receive the withdrawn fees
126127
* @param token The address of the token to withdraw
127128
*/
128-
function withdrawPlatformFee(address recepient, address token) external onlyOwner {
129+
function withdrawPlatformFee(address recepient, address token) external onlyOwner nonReentrant {
129130
if (recepient == address(0) || token == address(0)) {
130131
revert FairFund__CannotBeAZeroAddress();
131132
}

0 commit comments

Comments
 (0)