File tree 1 file changed +6
-0
lines changed
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ contract HouseformManager is Ownable, ReentrancyGuard {
29
29
Project[] public projects;
30
30
// The mapping from builder to projects to easily retrieve them
31
31
mapping (address => uint []) public builderToProjects;
32
+ // Used to check if builder fee has been already redeemed
33
+ mapping (uint => bool ) public projectToFeeRedeemed;
32
34
33
35
event ProjectCreated (
34
36
uint _projectId ,
@@ -259,6 +261,8 @@ contract HouseformManager is Ownable, ReentrancyGuard {
259
261
) external projectExists (_projectId) onlyBuilder (_projectId) buildingCompleted (_projectId) nonReentrant {
260
262
Project storage project = projects[_projectId];
261
263
264
+ // Check fee not redeemed yet
265
+ require (! projectToFeeRedeemed[_projectId], 'Builder fee already redeemed ' );
262
266
// Require that there was a profit otherwise nothing goes to the builder
263
267
require (project.saleAmount - project.goalAmount > 0 , 'No profit no party ' );
264
268
@@ -273,6 +277,8 @@ contract HouseformManager is Ownable, ReentrancyGuard {
273
277
274
278
// Update data
275
279
project.currentAmount -= amountToRedeem;
280
+ // Save that fee has been redeemed to avoid doing it multiple times
281
+ projectToFeeRedeemed[_projectId] = true ;
276
282
277
283
// Emit event
278
284
emit FeeRedeemed (msg .sender , _projectId, amountToRedeem);
You can’t perform that action at this time.
0 commit comments