forked from uniswap-python/uniswap-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtoken.py
More file actions
31 lines (20 loc) 路 678 Bytes
/
Copy pathtoken.py
File metadata and controls
31 lines (20 loc) 路 678 Bytes
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
from dataclasses import dataclass
from .types import AddressLike
@dataclass
class BaseToken:
"""Base for tokens of all kinds"""
symbol: str
"""Symbol such as ETH, DAI, etc."""
address: AddressLike
"""Address of the token contract."""
def __repr__(self) -> str:
return f"BaseToken({self.symbol}, {self.address!r})"
@dataclass
class ERC20Token(BaseToken):
"""Represents an ERC20 token"""
name: str
"""Name of the token, as specified in the contract."""
decimals: int
"""Decimals used to denominate the token."""
def __repr__(self) -> str:
return f"Token({self.symbol}, {self.address!r}, {self.decimals})"