-
Notifications
You must be signed in to change notification settings - Fork 3
/
HireChain.sol
105 lines (82 loc) · 2.5 KB
/
HireChain.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
pragma solidity ^0.4.0;
contract User{
//Array of Users
address[] public Users;
//user
struct detail{
string name;
string ipfshash;
}
//Map of address and username
mapping( address => detail) public Username;
function countUsers() public view returns(uint){
return Users.length;
}
function AddUser(string _name,string _ipfshash) public {
Users.push(msg.sender);
Username[msg.sender] = detail(_name,_ipfshash);
}
}
//Project Description contract
contract Consignment is User{
address public owner;
address public employee;
uint public status=0;
uint public finalbid=0;
uint public UserProjectLength=0;
uint public EmployeeProjectLength=0;
struct Project{
string pname;
string pdescription;
uint cost;
//string[] skills;
}
struct Accept{
address usr;
uint finalbid;
}
mapping ( address => Accept ) public AcceptMap;
mapping ( address => Project[] ) public ProjectMap;
mapping ( address => string ) public ProjectEmployeeMap;
function Consignment(){
owner = msg.sender;
}
function addEmployee(address _employee) public{
employee=_employee;
}
function updateStatus(uint _newstatus) public{
status=_newstatus;
}
function AddProject( string _pname, string _pdescription) public payable{
ProjectMap[msg.sender].push(Project(_pname,_pdescription,msg.value));
UserProjectLength++;
}
function withdraw(address _user) private {
_user.transfer(msg.value);
}
function updateEmployeeStatus(string _pname,address _employee) public {
ProjectEmployeeMap[_employee] = _pname;
EmployeeProjectLength++;
}
function lenP() public returns(uint){
return UserProjectLength;
}
function lenE() public returns(uint){
return EmployeeProjectLength;
}
function lenC() public returns(uint){
return ProjectMap[msg.sender].length;
}
function acceptMap(address _usr,uint _finalbid) public{
AcceptMap[msg.sender] = Accept(_usr,_finalbid);
}
}
//Main Model contract
contract Main is Consignment{
mapping( address => address[] ) public ProjectAddressMap;
uint public NumProj;
function AddPA(address _contractAddress){
ProjectAddressMap[msg.sender].push(_contractAddress);
NumProj++;
}
}