-
Notifications
You must be signed in to change notification settings - Fork 4
/
getTheDAOCreatedTokenEvents
31 lines (26 loc) · 1.71 KB
/
getTheDAOCreatedTokenEvents
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
#!/bin/sh
# ------------------------------------------------------------------------------
# Retrieve The DAO CreatedToken events. These events are from block 1429038 to
# 1599205 when the creation phase ended.
#
# Usage:
# 1. Download this script to getTheDAOCreatedTokenEvents .
# 2. `chmod 700 getTheDAOCreatedTokenEvents`
# 3. Run `geth console` in a window.
# 4. Then run this script `./getTheDAOCreatedTokenEvents` in a separate window.
#
# Enjoy. (c) BokkyPooBah 2016. The MIT licence.
# ------------------------------------------------------------------------------
geth attach << EOF
var theDAOABIFragment = [{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"amount","type":"uint256"}],"name":"CreatedToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_from","type":"address"},{"indexed":true,"name":"_to","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"}],"name":"Transfer","type":"event"}];
var theDAOAddress = "0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413";
var theDAOStartingBlock = 1428757;
var theDAO = web3.eth.contract(theDAOABIFragment).at(theDAOAddress);
var theDAOCreatedTokenEvent = theDAO.CreatedToken({}, {fromBlock: theDAOStartingBlock, toBlock: theDAOStartingBlock + 200000});
console.log("address\tamount\tto\tblockHash\tblockNumber\tevent\tlogIndex\ttransactionHash\ttransactionIndex");
theDAOCreatedTokenEvent.watch(function(error, result){
console.log(result.address + "\t" + result.args.amount / 1e16 + "\t" + result.args.to + "\t" +
result.blockHash + "\t" + result.blockNumber + "\t" + result.event + "\t" + result.logIndex + "\t" +
result.transactionHash + "\t" + result.transactionIndex);
});
EOF