Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: make it run again #3

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
FROM golang

ADD . /go/src/github.com/hunterlong/tokenexporter
RUN cd /go/src/github.com/hunterlong/tokenexporter && go get
RUN go install github.com/hunterlong/tokenexporter
WORKDIR /go/src/github.com/hunterlong/tokenexporter
RUN go mod tidy
RUN go install

ENV GETH https://mainnet.infura.io/Nsy8W84s3hqW4eE49ljZ
ENV PORT 9021
ENV GETH https://xdai.fairdatasociety.org
ENV PORT 9022
ENV ADDRESSES ${ADDRESSES}
ENV TOKEN_LIST ${TOKEN_LIST}
ENV PORT ${PORT}

RUN mkdir /app
WORKDIR /app
ADD addresses.txt /app
ADD tokens-list.json /app

EXPOSE 9021
EXPOSE ${PORT}

ENTRYPOINT /go/bin/tokenexporter
#CMD ["/bin/bash", "-c", "echo $ADDRESSES > /app/addresses.txt && echo $TOKEN_LIST > /app/token-list.json && /go/bin/tokenexporter"]
CMD ["/bin/bash", "-c", "/go/bin/tokenexporter"]
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
A lightweight Prometheus exporter that will output ERC20 Token balances from a list of addresses you specify. TOKENexporter attaches to a geth server to fetch token wallet balances for your Grafana dashboards. You can also use [BTCexporter](https://github.com/hunterlong/btcexporter) for Bitcoin balances and [ETHexporter](https://github.com/hunterlong/ethexporter) for Ethereum balances.

## Watch Addresses
The `addresses.txt` file holds all the addresses to fetch balances for. Use the format `name:address` on each new line.
The `addresses.txt` file holds all the addresses to fetch balances for. Use the format `name:address:host` on each new line.
```
etherdelta:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819
bittrex:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98
etherdelta:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819:host1
bittrex:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98:host2
```

## Running the Exporter
Expand Down Expand Up @@ -617,3 +617,8 @@ token_balance{name="etherdelta",symbol="onG",contract="0xd341d1680eeee3255b8c4c7
token_balance{name="etherdelta",symbol="YEED",contract="0x6f7a4bac3315b5082f793161a22e26666d22717f",address="0x8d12A197cB00D4747a1fe03395095ce2A5CC6819"} 0
token_query_seconds{name="all"} 10.037673145
```

## abi update
```
abigen --abi=main.go --pkg=main --out=tokens.go
```
1 change: 1 addition & 0 deletions abi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint8"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"balanceOf","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_extraData","type":"bytes"}],"name":"approveAndCall","outputs":[{"name":"success","type":"bool"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"spentAllowance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"allowance","outputs":[{"name":"","type":"uint256"}],"type":"function"},{"inputs":[{"name":"initialSupply","type":"uint256"},{"name":"tokenName","type":"string"},{"name":"decimalUnits","type":"uint8"},{"name":"tokenSymbol","type":"string"}],"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}]
8 changes: 2 additions & 6 deletions addresses.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
bittrex:0xFBb1b73C4f0BDa4f67dcA266ce6Ef42f520fBB98
etherdelta:0x8d12A197cB00D4747a1fe03395095ce2A5CC6819
kraken:0xe853c56864a2ebe4576a807d26fdc4a0ada51919
kraken2:0x267be1c1d684f78cb4f6a176c4911b741e4ffdc0
vitalik:0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B
exchange:0x1db3439a222c519ab44bb1144fc28167b4fa6ee6
bee-1:0x000000000000000000000000000000000000BB98:host1
bee-2:0x000000000000000000000000000000000000BB99:host2
21 changes: 21 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module github.com/hunterlong/tokenexporter

go 1.17

require github.com/ethereum/go-ethereum v1.10.23

require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
)
Loading