-
Notifications
You must be signed in to change notification settings - Fork 0
/
tokens.py
72 lines (55 loc) · 2.92 KB
/
tokens.py
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
from web3.auto.gethdev import w3
from dataclasses import dataclass
@dataclass(init=True, repr=True, eq=True)
class Token:
symbol: str
decimals: int
address: str
def __init__(self, symbol, decimals, address):
self.symbol = symbol
self.decimals = decimals
self.address = w3.toChecksumAddress(address)
def fromUnits(self, n):
return n * (10**self.decimals)
@property
def normalized_address(self):
return self.address.lower().replace('0x', '')
eth = Token("ETH", 18, "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE")
bat = Token("BAT", 18, "0x0d8775f648430679a709e98d2b0cb6250d2887ef")
dai = Token("DAI", 18, "0x6b175474e89094c44da98b954eedeac495271d0f")
rep = Token("REP", 18, "0x1985365e9f78359a9B6AD760e32412f4a445E862")
sai = Token("SAI", 18, "0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359")
usdc = Token("USDC", 6, "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48")
weth = Token("WETH", 18, "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2")
wbtc = Token("WBTC", 8, "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599")
zrx = Token("ZRX", 18, "0xE41d2489571d322189246DaFA5ebDe1F4699F498")
chai = Token("CHAI", -1, "0x06AF07097C9Eeb7fD685c692751D5C66dB49c215")
usdt = Token("USDT", 6, "0xdAC17F958D2ee523a2206206994597C13D831ec7")
tusd = Token("TUSD", 18, "0x0000000000085d4780B73119b644AE5ecd22b376")
busd = Token("BUSD", -1, "0x4Fabb145d64652a948d72533023f6E7A623C7C53")
susd = Token("SUSD", -1, "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51")
pax = Token("PAX", -1, "0x8E870D67F660D95d5be530380D0eC0bd388289E1")
renbtc = Token("RENBTC", -1, "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D")
tbtc = Token("TBTC", -1, "0x1bBE271d15Bb64dF0bc6CD28Df9Ff322F2eBD847")
hbtc = Token("HBTC", -1, "0x0316EB71485b0Ab14103307bf65a021042c6d380")
sbtc = Token("SBTC", -1, "0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6")
# speciality tokens
bzx_sETHwBTCx5 = Token("sETHwBTCx5", 18, "0xb0200B0677dD825bb32B93d055eBb9dc3521db9D")
bzx_sETHwBTCx4 = Token("sETHwBTCx4", 18, "0x2ca1ed53e4fb7aef47c660141911718e96bcaf2a")
bzx_sETHwBTCx3 = Token("sETHwBTCx3", 18, "0xDd15e1e1D9f2E311093676c1a57eEB5D1398d2cE")
bzx_sETHwBTCx2 = Token("sETHwBTCx2", 18, "0xe1652744e343d50a0050e233ed9bd43fe0a3070a")
lsnx = Token("lSNX", 18, "0xC011A72400E58ecD99Ee497CF89E3775d4bd732F")
lsusd = Token("lUSD", 18, "0x57Ab1E02fEE23774580C119740129eAC7081e9D3")
snx = Token("SNX", 18, "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F")
susd = Token("sUSD", 18, "0x57Ab1ec28D129707052df4dF418D58a2D46d5f51")
all_tokens = []
__globals = list(globals().values())
all_tokens = [t for t in __globals if isinstance(t, Token)]
if __name__ == '__main__':
with open('../contracts/Tokens.sol', 'w') as f:
f.write(f'// generated by {__file__}\n')
f.write('pragma solidity >=0.4.21 <0.7.0;\n\n')
f.write('contract Tokens {\n')
for t in all_tokens:
f.write(f' address internal constant {t.symbol} = {t.address};\n')
f.write('}\n')