forked from Medha08/solidity-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCertificates.sol
60 lines (37 loc) · 1.43 KB
/
Certificates.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.5.0;
contract Certificate{
address payable public owner;
string public leftName;
string public rightName;
string public leftVows;
string public rightVows;
modifier _onlyOwmer(){
require(msg.sender == owner);
_;
}
constructor(address payable _owner , string memory _leftName, string memory _rightName , string memory _leftVows , string memory _rightVows ) public {
leftName = _leftName;
rightName = _rightName;
leftVows = _leftVows;
rightVows = _rightVows;
owner = _owner;
}
function ringBell() payable public {
require(msg.value > 0.001 ether);
}
function collect() external _onlyOwmer {
owner.transfer(address(this).balance);
}
function getBalance() public view _onlyOwmer returns(uint){
return address(this).balance;
}
}
contract CertificateFactory{
event ContractCreated(address certi);
address[] public registeredPromises ;
function createPromise(string memory _leftName, string memory _rightName , string memory _leftVows , string memory _rightVows) public {
address certi = address(new Certificate(msg.sender, _leftName,_rightName ,_leftVows , _rightVows));
emit ContractCreated(certi);
registeredPromises.push(certi);
}
}