forked from smartexio/smartex-contracts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSmartexInvoice.sol
73 lines (62 loc) · 1.66 KB
/
SmartexInvoice.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
/**
* @notice Smartex Invoice
* @author Christopher Moore [email protected] - Smartex.io Ltd. 2016-2017 - https://smartex.io
*/
contract SmartexInvoice is owned {
address sfm;
/**
* @notice Incoming transaction Event
* @notice Logs : block number, sender, value, timestamp
*/
event IncomingTx(
uint indexed blockNumber,
address sender,
uint value,
uint timestamp
);
/**
* @notice Refund Invoice Event
* @notice Logs : invoice address, timestamp
*/
event RefundInvoice(
address invoiceAddress,
uint timestamp
);
/**
* @notice Invoice constructor
*/
function SmartexInvoice(address target, address owner) {
sfm = target;
transferOwnership(owner);
}
/**
* @notice Refund invoice
* @param recipient (address refunded)
*/
function refund(address recipient) onlyOwner {
RefundInvoice(address(this), now);
}
/**
* @notice Sweep funds
* @param _to (Funds recipient)
*/
function sweep(address _to) payable onlyOwner {
if (!_to.send(this.balance)) throw;
}
/**
* @notice Advanced send
* @param _to (transaction Recipient)
* @param _value (transaction value)
* @param _data (additional payload)
*/
function advSend(address _to, uint _value, bytes _data) onlyOwner {
_to.call.value(_value)(_data);
}
/**
* @notice anonymous function
* @notice Triggered by invalid function calls and incoming transactions
*/
function() payable {
IncomingTx(block.number, msg.sender, msg.value, now);
}
}