Skip to content

Commit

Permalink
Merge pull request #10 from yashthipsay/test
Browse files Browse the repository at this point in the history
changed smart contract methods
  • Loading branch information
yashthipsay authored Sep 3, 2023
2 parents 44173bf + 1411c95 commit 6b3a33e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion chain/contracts/Crowdfunding.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity ^0.8.19;
import "./ERC_Remote.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

contract Crowdfunding is ReentrancyGuard{
contract Crowdfunding is ERC_Remote, ReentrancyGuard{

uint public CampaignCount;
IERC20 public token;
Expand Down
29 changes: 14 additions & 15 deletions chain/contracts/Crowdfunding_Remix.sol
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
// SPDX-License-Identifier: GPL-3.0
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.0 <0.9.0;


contract CrowdFunding{

uint public CampignCount;

mapping(uint => mapping(address => uint)) public pledgedAmount;
mapping (uint => Author) public Authors;

constructor(address _token){
}

}

struct Author{
struct Author{
address owner;
uint id;
uint goal;
Expand All @@ -23,14 +21,13 @@ contract CrowdFunding{
bool claimed;
}

struct Donater{
struct Donor{
address donater;
uint compaignID;
uint amount;
}


function creator(uint _goal)public{

function creator(uint _goal)public{

require(_goal > 0 , "Goal is not Equal to Zero");
CampignCount++;
Expand All @@ -44,7 +41,7 @@ contract CrowdFunding{
function payUser() public payable{
payable(msg.sender).transfer(1 ether);
}
// Donateing Money

function donate(uint _compaignID , uint _amount ) public payable{
Author storage AuthorVar = Authors[_compaignID];
require(AuthorVar.endAt >= block.timestamp ,"This Compaign Has been Ended");
Expand All @@ -54,8 +51,7 @@ contract CrowdFunding{

}

// Donater withdraw money they are not donating
function unDonate(uint _compaignID , uint _amount )public{
function unDonate(uint _compaignID , uint _amount )public payable{
Author storage AuthorVar = Authors[_compaignID];

if(AuthorVar.endAt >= block.timestamp ){
Expand All @@ -75,12 +71,14 @@ contract CrowdFunding{
}
}else{
revert("Something went wrong 2");
}
}




}

function claim(uint _compaignID )public {
function claim(uint _compaignID )public payable{
Author storage AuthorVar = Authors[_compaignID];
require(msg.sender == AuthorVar.owner , "only Owner Can Claim");
require(block.timestamp > AuthorVar.endAt , "Not ended ");
Expand All @@ -92,4 +90,5 @@ contract CrowdFunding{

}


}

0 comments on commit 6b3a33e

Please sign in to comment.