Skip to content

Commit 895ddc4

Browse files
First commit
1 parent d1ada0d commit 895ddc4

File tree

296 files changed

+8664
-6
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

296 files changed

+8664
-6
lines changed

README.md

+10-6
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
# EtherSamaj
2-
A Decentralised system for Community Work and funding.
2+
#### A Decentralised system for Community Work and funding.
33

44
EtherSamaj is a Decentalised Desktop Application which allows people of community to help each other progress towards a better society collectively. EtherSamaj allows :
5+
* A person or a group persons to raise a concern or issue (for e.g.: cleaniliness of parks, security concerns during night, need for public awareness). The work then would be funded by the members of the community.
6+
* A person or a group of persons can launch a project they would like to work on with public interest in view for which the funds could be requested by the community at the place (Similar to crowd-funding).
7+
* Arranging immediate funds if required for persons in mediacal emergency.
58

6-
A person or a group persons to raise a concern or issue (for e.g.: cleaniliness of parks, security concerns during night, need for public awareness). The work then would be funded by the members of the community.
7-
A person or a group of persons can launch a project they would like to work on with public interest in view for which the funds could be requested by the community at the place (Similar to crowd-funding).
8-
Arranging immediate funds if required for persons in mediacal emergency.
9+
#### Implemntation Details
10+
Desktop App developes on JAVA using Web3j interface on the infura ethereum-test network.
911

10-
Implemntation Details
12+
#### Sample Images
1113

12-
Desktop App developes on JAVA using Web3j interface on the infura ethereum-test network.
14+
![Main Page](https://github.com/surbhitawasthi/EtherSamaj/blob/master/Screenshot%20from%202018-02-28%2014-31-44.png)
15+
16+
![Main Page](https://github.com/surbhitawasthi/EtherSamaj/blob/master/Screenshot%20from%202018-01-28%2006-17-24.png)
972 KB
Loading
188 KB
Loading

SmartContract/CommWork.sol

+154
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
2+
pragma solidity ^0.4.19;
3+
4+
/**
5+
* The mortal contract contains the suicide method
6+
*/
7+
contract mortal
8+
{
9+
address owner; // A variable for address type to store address of owner of contract
10+
11+
modifier onlyOwner()
12+
{ // Modifier for onlyOwner
13+
if (msg.sender == owner)
14+
_;
15+
}
16+
17+
function mortal() public
18+
{ // Constructor
19+
owner = msg.sender;
20+
}
21+
22+
function kill () onlyOwner
23+
{ // Function to kill the contract
24+
selfdestruct(owner);
25+
}
26+
27+
}
28+
29+
30+
/**
31+
* The CommunityWork contract is one of the three main contracts
32+
*/
33+
contract CommunityWork is mortal
34+
{
35+
function CommunityWork () payable
36+
{
37+
38+
}
39+
40+
// project type...containing all the required details of project
41+
struct project {
42+
address projectOwnerAddress;
43+
uint allocatedFunds;
44+
string projectDescription;
45+
uint targetAmount;
46+
uint fundingDuration;
47+
funders[] arrayOfFunders;
48+
bool isOpen;
49+
bool isAccepted;
50+
bool isCompleted;
51+
address projectAcceptor;
52+
}
53+
54+
struct funders{
55+
address funderAddress;
56+
uint amountFunded;
57+
}
58+
59+
mapping (uint => project) projectIdToProject;
60+
uint[] projectIdArray;
61+
62+
//Modifier for time keeping stuff
63+
modifier afterTimeLimit(uint _projectId)
64+
{
65+
require(now >= projectIdToProject[_projectId].fundingDuration);
66+
_;
67+
}
68+
69+
70+
// Function to create a new project
71+
function projectDeployer(
72+
address _projectOwnerAddress,
73+
uint _allocatedFunds,
74+
string _projectDescription,
75+
uint _targetAmount,
76+
uint _fundingDuration,
77+
uint _projectId) payable{
78+
79+
var projectInfo = projectIdToProject[_projectId];
80+
projectInfo.projectOwnerAddress = _projectOwnerAddress;
81+
projectInfo.allocatedFunds = _allocatedFunds;
82+
projectInfo.projectDescription = _projectDescription;
83+
projectInfo.targetAmount = _targetAmount;
84+
projectInfo.fundingDuration = now + _fundingDuration;
85+
projectInfo.isOpen = true;
86+
projectInfo.isAccepted = false;
87+
projectInfo.isCompleted = false;
88+
89+
projectIdArray.push(_projectId) -1;
90+
91+
if(_allocatedFunds > 0){
92+
// funders storage funder0;
93+
// funder0.funderAddress = _projectOwnerAddress;
94+
// funder0.amountFunded = _allocatedFunds;
95+
// projectInfo.arrayOfFunders.push(funder0) -1;
96+
projectInfo.arrayOfFunders[projectInfo.arrayOfFunders.length++] = funders({funderAddress: _projectOwnerAddress, amountFunded: _allocatedFunds});
97+
}
98+
}
99+
100+
// Function to get allProjectIds
101+
function getAllProjectId() view public returns(uint[]){
102+
return projectIdArray;
103+
}
104+
105+
// Function to return details of a project coressponding to an ID
106+
function getProjectInfo(uint _projectId)view public returns(project){
107+
return(projectIdToProject[_projectId]);
108+
}
109+
110+
// Function which accepts new funds on a particular project
111+
function addFunds(address _senderAddress, uint _projectId) payable returns(bool){
112+
/* Check if project is alive and funding is on */
113+
uint amount = msg.value;
114+
projectIdToProject[_projectId].allocatedFunds += amount;
115+
projectIdToProject[_projectId].arrayOfFunders[projectIdToProject[_projectId].arrayOfFunders.length++] = funders ({funderAddress: _senderAddress, amountFunded: amount});
116+
}
117+
118+
// Function for accepting projects
119+
function acceptProject(uint _projectId) returns(bool){
120+
121+
require(now <= projectIdToProject[_projectId].fundingDuration);
122+
123+
if(projectIdToProject[_projectId].isCompleted == false &&
124+
projectIdToProject[_projectId].isOpen == true &&
125+
projectIdToProject[_projectId].isAccepted == false){
126+
127+
projectIdToProject[_projectId].isAccepted == true;
128+
projectIdToProject[_projectId].projectAcceptor = msg.sender;
129+
return true;
130+
}else {
131+
// Error in accepting project
132+
throw;
133+
return false;
134+
}
135+
}
136+
//Function for completion of project
137+
//****Add check for time interval
138+
function onCompletion(uint _projectId) payable returns(bool){
139+
address fundAcceptor = msg.sender;
140+
if(fundAcceptor.send(projectIdToProject[_projectId].allocatedFunds)){
141+
projectIdToProject[_projectId].isCompleted = true;
142+
return true;
143+
}else {
144+
return false;
145+
}
146+
}
147+
148+
//Time limit event for each projectIdToProject element
149+
150+
//Function for money back if time limit exceeded controled by modifier
151+
function endingProject(uint _projectId) afterTimeLimit(_projectId) payable returns(bool){
152+
153+
}
154+
}
1 Byte
Binary file not shown.
18.5 KB
Binary file not shown.
17 Bytes
Binary file not shown.
18.4 KB
Binary file not shown.
19.4 KB
Binary file not shown.
17 Bytes
Binary file not shown.

app/.gradle/buildOutputCleanup/built.bin

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#Wed Jan 24 20:24:25 IST 2018
2+
gradle.version=4.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+


app/.idea/.name

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/compiler.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/gradle.xml

+18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_annotations_2_8_0.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_core_2_8_5.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_fasterxml_jackson_core_jackson_databind_2_8_5.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jffi_1_2_14.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jffi_native_1_2_14.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jnr_constants_0_9_6.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jnr_enxio_0_14.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jnr_ffi_2_1_2.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jnr_posix_3_0_33.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jnr_unixsocket_0_15.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_github_jnr_jnr_x86asm_1_0_2.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_squareup_okhttp3_logging_interceptor_3_8_1.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.idea/libraries/Gradle__com_squareup_okhttp3_okhttp_3_8_1.xml

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)