Skip to content

Commit

Permalink
May 24, 2023, 8:49 PM
Browse files Browse the repository at this point in the history
  • Loading branch information
xthet committed May 24, 2023
1 parent 6d9e435 commit 7670b2f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
8 changes: 4 additions & 4 deletions contracts/Campaign.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
// import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@chainlink/contracts/src/v0.8/interfaces/KeeperCompatibleInterface.sol";
import { UpkeepIDConsumer } from "./UpkeepIDConsumer.sol";
Expand All @@ -19,7 +19,7 @@ import { LinkTokenInterface } from "@chainlink/contracts/src/v0.8/interfaces/Lin
// error Cmp_Bankrupt();

contract Campaign is KeeperCompatibleInterface, ReentrancyGuard{
using SafeMath for uint256;
// using SafeMath for uint256;

// enums
enum C_State {
Expand Down Expand Up @@ -140,7 +140,7 @@ contract Campaign is KeeperCompatibleInterface, ReentrancyGuard{
returns (bool upkeepNeeded, bytes memory /**performData */)
{
bool isOpen = c_state == C_State.Fundraising;
bool timePassed = ((block.timestamp.sub(i_initTimeStamp)) > duration);
bool timePassed = ((block.timestamp - i_initTimeStamp) > duration);
upkeepNeeded = (timePassed && isOpen);
return (upkeepNeeded, "0x0");
}
Expand Down Expand Up @@ -169,7 +169,7 @@ contract Campaign is KeeperCompatibleInterface, ReentrancyGuard{
if(aggrDonations[_donator] == 0 ){revert();}
uint256 amountToRefund = aggrDonations[_donator];
if(currentBalance < amountToRefund){revert();}
currentBalance = currentBalance.sub(amountToRefund);
currentBalance = currentBalance - amountToRefund;
(bool success, ) = payable(_donator).call{value: amountToRefund}("");
if(!success){revert();}
delete aggrDonations[_donator];
Expand Down
4 changes: 2 additions & 2 deletions contracts/CrowdFunder.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;

import "@openzeppelin/contracts/utils/math/SafeMath.sol";
// import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "./Campaign.sol";

// errors
Expand All @@ -12,7 +12,7 @@ import "./Campaign.sol";
// error Crf_PubF();

contract CrowdFunder {
using SafeMath for uint256;
// using SafeMath for uint256;

event UserAdded(
address indexed _address,
Expand Down
6 changes: 0 additions & 6 deletions contracts/Reward.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ contract Reward {
delete true_donator[_donator];
}

// function getValidDonator(address _donator) external view returns(bool) {
// if((true_donator[_donator] > 0)){
// return false;
// }else{return true;}
// }

function respondToSurvey(string memory _response) external {
if(!(true_donator[msg.sender] > 0)){revert();} // not a donator
surveyResponses[msg.sender] = _response;
Expand Down

0 comments on commit 7670b2f

Please sign in to comment.