Skip to content

Commit 0835566

Browse files
committed
Refactor replaySafeSplit to accept payload
1 parent a5d8188 commit 0835566

File tree

1 file changed

+9
-27
lines changed

1 file changed

+9
-27
lines changed

contracts/replaySafeSplit.js

+9-27
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
contracts.replaySafeSplit = {
2+
address: '0xaa1a6e3e6ef20068f7f8d8c835d2d22fd5116444',
23
abi: [
34
{
45
"constant": false,
@@ -22,10 +23,6 @@ contracts.replaySafeSplit = {
2223
"type": "function"
2324
}
2425
],
25-
address: '0xaa1a6e3e6ef20068f7f8d8c835d2d22fd5116444',
26-
preForkAddress: null,
27-
ethAddress: null,
28-
etcAddress: null,
2926
contract: function() {
3027
return(
3128
web3.eth.contract(this.abi)
@@ -36,35 +33,20 @@ contracts.replaySafeSplit = {
3633
this.contract().at(this.address)
3734
);
3835
},
39-
setAddresses: function(preForkAddress, ethAddress, etcAddress) {
40-
this.preForkAddress = preForkAddress;
41-
this.ethAddress = ethAddress;
42-
this.etcAddress = etcAddress;
43-
},
44-
splitSafely: function(value) {
45-
if(
46-
!this.preForkAddress ||
47-
!this.ethAddress ||
48-
!this.etcAddress
49-
) {
50-
throw('setAddresses(...) needs to be called before splitting!')
51-
}
36+
splitSafely: function(payload) {
5237
return(
5338
this
5439
.instance()
5540
.split
5641
.sendTransaction(
57-
this.ethAddress,
58-
this.etcAddress,
59-
this.getPayload(value)
42+
payload.eth,
43+
payload.etc,
44+
{
45+
from: payload.preFork,
46+
to: this.address,
47+
value: payload.value
48+
}
6049
)
6150
);
6251
},
63-
getPayload: function(value) {
64-
return({
65-
from: this.preForkAddress,
66-
to: this.address,
67-
value: value
68-
});
69-
},
7052
}

0 commit comments

Comments
 (0)