-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontracts.coffee
100 lines (61 loc) · 1.7 KB
/
contracts.coffee
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
keys = require './keys.js'
Eth = require 'ethjs'
sender = artifacts.require 'MassVestingSender'
sender_addr = '0xCBC66115e9d8655709c3408D0e320410Aef1161A'.toLowerCase()
log = console.log
ether = (val)->
Eth.fromWei val, 'ether'
wei = (val)->
Eth.toWei val, 'ether'
bn = (val)->
return new Eth.BN val, 10
gas = (val, gas_price)->
return (bn val).mul(bn '1000000000').mul(bn gas_price).toString()
delay = (ms)->
return new Promise (resolve, reject)=>
setTimeout resolve, ms
```
const getNonce = account => new Promise((resolve, reject) => {
web3.eth.getTransactionCount(account, (err, result) => {
if(err)
{
return reject(err);
}
resolve(result);
});
});
```
address = '0xF9c024A74938F8e9172C14dE7b513D3ce4329B49'.toLowerCase()
data = [
{id: 503, addr: address, amount: '0.0001', vesting: '1545862481'}
]
module.exports = (cb)->
try
eth = new Eth web3.currentProvider
wei = (val)->
val = to_fix val.toString(), 18
return Eth.toWei(val, 'ether').toString()
# sender = await sender.deployed()
sender = await sender.at sender_addr
data = []
await delay 1000
catch err
log err
try
# log nonce
#// for(let i = 0; i < data.length; i += size)
#// {
#// const slice = data.slice(i, i + size);
#// const ids = slice.map(s => s[0]);
#// const receivers = slice.map(s => s[1]);
#// const amounts = slice.map(s => s[2].mul(new BigNumber(10).pow(18)));
#//
#// // console.log(ids, receivers, amounts);
#//
#// console.log(`last processed address: ${receivers[receivers.length - 1]}`);
#//
#// for(let j = 0; j < 5; j++)
#// sender.bulkTransfer('0xbf799a2f71d020a4a8c10e7406e2bf970b3d734b', ids, receivers, amounts, {nonce: nonce++});
#//
#// sleep.sleep(1);
#// }