-
Notifications
You must be signed in to change notification settings - Fork 5
/
EvidenceFactory.sol
60 lines (49 loc) · 1.6 KB
/
EvidenceFactory.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
pragma solidity ^0.4.4;
import "Evidence.sol";
contract EvidenceFactory{
address[] signers;
event newEvidenceEvent(address addr);
function newEvidence(string evi)public returns(address)
{
Evidence evidence = new Evidence(evi, this);
newEvidenceEvent(evidence);
return evidence;
}
function getEvidence(address addr) public constant returns(string,address[],address[]){
return Evidence(addr).getEvidence();
}
function addSignatures(address addr) public returns(bool) {
return Evidence(addr).addSignatures();
}
constructor(address[] evidenceSigners){
for(uint i=0; i<evidenceSigners.length; ++i) {
signers.push(evidenceSigners[i]);
}
}
function verify(address addr)public constant returns(bool){
for(uint i=0; i<signers.length; ++i) {
if (addr == signers[i])
{
return true;
}
}
return false;
}
function getSigner(uint index)public constant returns(address){
uint listSize = signers.length;
if(index < listSize)
{
return signers[index];
}
else
{
return 0;
}
}
function getSignersSize() public constant returns(uint){
return signers.length;
}
function getSigners() public constant returns(address[]){
return signers;
}
}