-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBossManRedeem.sol
More file actions
84 lines (75 loc) · 2.4 KB
/
BossManRedeem.sol
File metadata and controls
84 lines (75 loc) · 2.4 KB
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
contract owned {
function owned() {
owner = msg.sender;
staff = msg.sender;
}
modifier onlyowner() {
if (msg.sender != owner) throw;
_
}
modifier onlystaff() {
if (msg.sender != staff) throw;
_
}
address public owner;
address public staff;
}
// see http://solidity.readthedocs.io/en/latest/contracts.html#visibility-and-accessors
// which of the functions do you want to be external, if any? they are public by default.
// do you have a local testnet with a test blockchain? I'm going to deploy this on mine later and will let you know if it works.
// connect with me here also to stay in touch: https://twitter.com/JasonCoombsCEO
contract RedeemC is owned {
uint public n_days = 2;
uint public sdays = 86400;
uint public expiration = now + (n_days * sdays);
uint public value = this.balance;
function changeOwner(address _newOwner) onlyowner {
owner = _newOwner;
}
function changeStaff(address _newStaff) onlyowner {
staff = _newStaff;
}
function RedeemA() onlystaff {
if (block.timestamp > expiration) {
staff.send(value);
}
}
function () { // we *should* be able to combine modifiers onlyowner and onlystaff ... but not sure that works for fallback func
if (msg.sender != staff && msg.sender != owner) throw;
expiration = now + (n_days * sdays);
value = this.balance;
}
}
contract RedeemB is owned {
uint public n_days = 1;
uint public sdays = 86400;
uint public expiration = now + (n_days * sdays);
uint public value = 10 ** 18;
RedeemC public redeemC;
function RedeemB() {
redeemC = new RedeemC();
}
function changeOwner(address _newOwner) onlyowner {
owner = _newOwner;
}
function changeN_days(uint _newN_days) onlyowner {
n_days = _newN_days;
expiration = now + (n_days * sdays);
}
function changeSdays(uint _newSdays) onlyowner {
sdays = _newSdays;
expiration = now + (n_days * sdays);
}
function changePay(uint _newPay) onlyowner {
value = _newPay;
}
function changeStaff(address _newStaff) onlyowner {
staff = _newStaff;
}
function RedeemA() onlyowner {
if (block.timestamp > expiration) {
staff.send(value);
expiration = now + (n_days * sdays);
}
}
}