inspect whether package is installed

pull/1743/head
alpharush 2 years ago
parent 12682c3094
commit 3861029145
  1. 2
      .github/workflows/read_storage.yml
  2. 2
      setup.py
  3. 30
      slither/tools/read_storage/read_storage.py
  4. 6
      slither/tools/read_storage/utils/__init__.py
  5. 2
      slither/tools/read_storage/utils/utils.py

@ -39,7 +39,7 @@ jobs:
- name: Install python dependencies - name: Install python dependencies
run: | run: |
pip install ".[slither-read-storage]" pip install ".[read-storage]"
solc-select install 0.8.1 solc-select install 0.8.1
solc-select install 0.8.10 solc-select install 0.8.10
solc-select use 0.8.1 solc-select use 0.8.1

@ -31,7 +31,7 @@ setup(
"openai", "openai",
"pdoc", "pdoc",
], ],
"slither-read-storage": ["solc-select>=v1.0.0b1", "web3>=6.0.0b"], "read-storage": ["solc-select>=v1.0.0b1", "web3>=6.0.0b"],
}, },
license="AGPL-3.0", license="AGPL-3.0",
long_description=long_description, long_description=long_description,

@ -1,27 +1,31 @@
import importlib.util
import logging import logging
import sys import sys
from math import floor from math import floor
from typing import Callable, Optional, Tuple, Union, List, Dict, Any from typing import Any, Callable, Dict, List, Optional, Tuple, Union
if importlib.util.find_spec("web3").loader is None:
print(
"Please install slither with `pip install slither-analyzer[read-storage]` to use slither-read-storage."
)
sys.exit(-1)
import dataclasses
from web3 import Web3
from eth_typing.evm import ChecksumAddress
from eth_abi import decode, encode from eth_abi import decode, encode
from eth_typing.evm import ChecksumAddress
from eth_utils import keccak from eth_utils import keccak
from .utils import ( from web3 import Web3
get_offset_value,
get_storage_data,
coerce_type,
)
import dataclasses
from slither.utils.myprettytable import MyPrettyTable
from slither.core.solidity_types.type import Type
from slither.core.solidity_types import ArrayType, ElementaryType, UserDefinedType, MappingType
from slither.core.declarations import Contract, Structure from slither.core.declarations import Contract, Structure
from slither.core.solidity_types import (ArrayType, ElementaryType,
MappingType, UserDefinedType)
from slither.core.solidity_types.type import Type
from slither.core.variables.state_variable import StateVariable from slither.core.variables.state_variable import StateVariable
from slither.core.variables.structure_variable import StructureVariable from slither.core.variables.structure_variable import StructureVariable
from slither.utils.myprettytable import MyPrettyTable
from .utils import coerce_type, get_offset_value, get_storage_data
logging.basicConfig() logging.basicConfig()
logger = logging.getLogger("Slither-read-storage") logger = logging.getLogger("Slither-read-storage")

@ -1,5 +1 @@
from .utils import ( from .utils import coerce_type, get_offset_value, get_storage_data
get_offset_value,
get_storage_data,
coerce_type,
)

@ -1,7 +1,7 @@
from typing import Union from typing import Union
from eth_typing.evm import ChecksumAddress from eth_typing.evm import ChecksumAddress
from eth_utils import to_int, to_text, to_checksum_address from eth_utils import to_checksum_address, to_int, to_text
def get_offset_value(hex_bytes: bytes, offset: int, size: int) -> bytes: def get_offset_value(hex_bytes: bytes, offset: int, size: int) -> bytes:

Loading…
Cancel
Save