-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSmartexController.sol
More file actions
77 lines (66 loc) · 1.87 KB
/
Copy pathSmartexController.sol
File metadata and controls
77 lines (66 loc) · 1.87 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
/**
* @notice Smartex Funds Manager
* @author Christopher Moore cmoore@smartex.io - Smartex.io Ltd. 2016 - https://smartex.io
*/
contract SmartexController is owned {
mapping(uint => Invoice) invoices;
uint totalInvoices;
/**
* @notice Invoice
*/
struct Invoice {
address creator;
address InvoiceAddress;
uint blockCreatedOn;
}
/**
* @notice Create invoice event
*/
event CreateInvoice(
uint blockNumber,
uint id,
address fundManager,
uint timestamp
);
function SmartexController() {
totalInvoices = 0;
}
/**
* @notice Create Invoice
* @param id (incremental id)
* @param fundManager (fund manager contract address)
*/
function createInvoice(uint id, address fundManager, address owner) onlyOwner {
address InvoiceAddress = new SmartexInvoice(fundManager, owner);
invoices[id] = Invoice({
creator: msg.sender,
InvoiceAddress: InvoiceAddress,
blockCreatedOn: block.number
});
CreateInvoice(block.number, id, fundManager, now);
++totalInvoices;
}
/**
* @notice Refund Invoice
* @param invoiceAddress (Invoice address)
* @param recipient (Refund recipient)
*/
function refundInvoice(address invoiceAddress, address recipient) onlyOwner {
SmartexInvoice sI = SmartexInvoice(invoiceAddress);
sI.refund(recipient);
}
/**
* @notice Get address of invoice
* @param id (Invoice id)
*/
function getInvoiceAddress(uint id) constant returns(address) {
Invoice i = invoices[id];
return i.InvoiceAddress;
}
/**
* @notice Get total invoices number
*/
function getTotalInvoices() constant returns(uint) {
return totalInvoices;
}
}