kopia lustrzana https://github.com/bugout-dev/moonworm
fix of various issues
rodzic
dc397a0384
commit
8be7014bbd
|
@ -12,7 +12,7 @@ from moonworm.crawler.ethereum_state_provider import Web3StateProvider
|
|||
from moonworm.watch import watch_contract
|
||||
|
||||
from .contracts import CU, ERC20, ERC721, CULands
|
||||
from .crawler.networks import Network
|
||||
from .crawler.utils import Network
|
||||
from .deployment import find_deployment_block
|
||||
from .generators.basic import (
|
||||
generate_contract_cli_content,
|
||||
|
@ -123,8 +123,8 @@ def handle_watch(args: argparse.Namespace) -> None:
|
|||
if args.network is None:
|
||||
raise ValueError("Please specify --network")
|
||||
network = Network.__members__[args.network]
|
||||
from moonstreamdb.db import yield_db_session_ctx
|
||||
|
||||
from moonstreamdb.db import yield_db_session_ctx
|
||||
from .crawler.moonstream_ethereum_state_provider import (
|
||||
MoonstreamEthereumStateProvider,
|
||||
)
|
||||
|
|
|
@ -3,20 +3,32 @@ from typing import Any, Dict, List, Optional, Union
|
|||
|
||||
from eth_typing.evm import ChecksumAddress
|
||||
from hexbytes.main import HexBytes
|
||||
from moonstreamdb.db import yield_db_session_ctx
|
||||
from moonstreamdb.models import (
|
||||
|
||||
try:
|
||||
from moonstreamdb.db import yield_db_session_ctx
|
||||
from moonstreamdb.models import (
|
||||
EthereumLabel,
|
||||
EthereumTransaction,
|
||||
PolygonLabel,
|
||||
PolygonTransaction,
|
||||
XDaiTransaction,
|
||||
)
|
||||
)
|
||||
except ImportError:
|
||||
print("this feature requires moonstreamdb which is not installed")
|
||||
print("to enable, run: `pip install -e[moonstream]`")
|
||||
raise ImportError(
|
||||
"moonstreamdb not installed, to install, run: `pip install -e[moonstream]`"
|
||||
)
|
||||
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy.sql.base import NO_ARG
|
||||
from web3 import Web3
|
||||
|
||||
from .ethereum_state_provider import EthereumStateProvider
|
||||
from .networks import MODELS, Network
|
||||
|
||||
from .networks import MODELS
|
||||
from .utils import Network
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from enum import Enum
|
||||
from typing import Dict
|
||||
|
||||
from moonstreamdb.models import (
|
||||
try:
|
||||
from moonstreamdb.models import (
|
||||
Base,
|
||||
EthereumBlock,
|
||||
EthereumLabel,
|
||||
|
@ -12,14 +12,15 @@ from moonstreamdb.models import (
|
|||
XDaiBlock,
|
||||
XDaiLabel,
|
||||
XDaiTransaction,
|
||||
)
|
||||
|
||||
|
||||
class Network(Enum):
|
||||
ethereum = "ethereum"
|
||||
polygon = "polygon"
|
||||
xdai = "xdai"
|
||||
)
|
||||
except ImportError:
|
||||
print("this feature requires moonstreamdb which is not installed")
|
||||
print("to enable, run: `pip install -e[moonstream]`")
|
||||
raise ImportError(
|
||||
"moonstreamdb not installed, to install, run: `pip install -e[moonstream]`"
|
||||
)
|
||||
|
||||
from .utils import Network
|
||||
|
||||
MODELS: Dict[Network, Dict[str, Base]] = {
|
||||
Network.ethereum: {
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class Network(Enum):
|
||||
ethereum = "ethereum"
|
||||
polygon = "polygon"
|
||||
xdai = "xdai"
|
|
@ -100,6 +100,8 @@ def python_type(evm_type: str) -> List[str]:
|
|||
return ["ChecksumAddress"]
|
||||
elif evm_type == "bool":
|
||||
return ["bool"]
|
||||
elif evm_type == "tuple":
|
||||
return ["tuple"]
|
||||
else:
|
||||
return ["Any"]
|
||||
|
||||
|
@ -161,6 +163,8 @@ def generate_contract_class(
|
|||
# transactions (see "generate_add_default_arguments" in brownie.py for an example of default arguments).
|
||||
PROTECTED_ARG_NAMES: Set[str] = {
|
||||
"address",
|
||||
"block-number",
|
||||
"block_number",
|
||||
"chain",
|
||||
"confirmations",
|
||||
"gas-price",
|
||||
|
@ -170,6 +174,7 @@ PROTECTED_ARG_NAMES: Set[str] = {
|
|||
"password",
|
||||
"sender",
|
||||
"signer",
|
||||
"value",
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -785,6 +785,13 @@ def generate_cli_generator(
|
|||
value=cst.parse_expression("bytes_argument_type"),
|
||||
),
|
||||
)
|
||||
elif param["type"] == "tuple":
|
||||
call_args.append(
|
||||
cst.Arg(
|
||||
keyword=cst.Name(value="type"),
|
||||
value=cst.parse_expression("eval"),
|
||||
),
|
||||
)
|
||||
|
||||
add_argument_call = cst.Call(
|
||||
func=cst.Attribute(
|
||||
|
|
Ładowanie…
Reference in New Issue