-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathDirectClearing.js
62 lines (54 loc) · 2.05 KB
/
DirectClearing.js
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
/**
* StromDAO Business Object: DirectClearing
* =========================================
* Directly charge for Energy delivery to an account within StromDAO Energy Blockchain.
*
* DirectCharging gets used together with DirectConnections.
*
* In theory account A and account B are exchanging energy metered by meter_point C
*
* DirectCharging takes several DirectConnections and runs charging as soon as method chargeAll is called.
*
* @author Thorsten Zoerner thorsten.zoerner@stromdao.de
*
*/
this.directclearing=function(obj_or_address) {
if(typeof obj_or_address == "undefined") obj_or_address=parent.options.contracts["StromDAO-BO.sol_DirectClearing"];
var p1 = new Promise(function(resolve, reject) {
var instance=parent._objInstance(obj_or_address,'StromDAO-BO.sol_DirectClearing');
instance.preSettle=function(address_meterpointset) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.preSettle(address_meterpointset).then(function(o) {
parent._waitForTransactionKeepRef(o,resolve2);
});
});
return p2;
};
instance.clear=function() {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.clear().then(function(o) {
parent._waitForTransactionKeepRef(o,resolve2);
});
});
return p2;
};
instance.settle=function(address_mprset) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.settle(address_mprset).then(function(o) {
parent._waitForTransactionKeepRef(o,resolve2);
});
});
return p2;
};
instance.setSettlement=function(address_settlement) {
var p2 = new Promise(function(resolve2, reject2) {
instance.obj.setSettlement(address_settlement).then(function(o) {
parent._waitForTransactionKeepRef(o,resolve2);
});
});
return p2;
};
resolve(instance);
});
return p1;
};