-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsession.sol
52 lines (38 loc) · 920 Bytes
/
session.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
pragma solidity ^0.4.20;
contract proxy {
address public _owner;
function proxy(){
_owner = msg.sender;
}
function owner()public view returns(address){
return _owner;
}
modifier onlyOwner() {
require(msg.sender == _owner);
_;
}
function execute(address to,uint value,bytes data) public onlyOwner{
to.call.value(value)(data);
}
function ()public payable{
}
}
contract session is proxy{
address controller;
uint expireTime;
function executeByController(address to,uint value,bytes data) public{
require(msg.sender==controller);
require(now <= expireTime);
to.call.value(value)(data);
}
function renew() onlyOwner public{
expireTime = now + 3 days;
}
function setController(address _controller) public onlyOwner{
controller = _controller;
}
function session(){
controller = msg.sender;
expireTime = now + 3 days;
}
}