From 0c196d8f559e1efec24b7b31b2ac4104c0bb8ee4 Mon Sep 17 00:00:00 2001 From: yhtiyar Date: Wed, 3 Nov 2021 14:16:27 +0300 Subject: [PATCH] remove centipede --- .gitmodules | 6 +- centipede/__init__.py | 0 centipede/cli.py | 125 -- centipede/cli.py.template | 150 --- centipede/contract.py.template | 33 - centipede/contracts.py | 40 - centipede/crawler/example.py | 129 -- centipede/crawler/log_scanner.py | 392 ------ centipede/crawler/state/__init__.py | 2 - .../crawler/state/event_scanner_state.py | 54 - centipede/crawler/state/json_state.py | 114 -- centipede/crawler/state/sqlite_state.py | 0 centipede/fixture/abis/CentipedeERC1155.json | 537 -------- centipede/fixture/abis/CentipedeERC20.json | 1 - centipede/fixture/abis/CentipedeERC721.json | 423 ------- centipede/fixture/abis/CryptoKitties.json | 1104 ----------------- centipede/fixture/abis/greetingabi.json | 59 - .../fixture/bytecodes/CentipedeERC1155.bin | 1 - .../fixture/bytecodes/CentipedeERC20.bin | 1 - .../fixture/bytecodes/CentipedeERC721.bin | 1 - .../fixture/events_abi/events.sample.json | 58 - .../smart_contracts/CentipedeERC1155.sol | 148 --- .../smart_contracts/CentipedeERC20.sol | 24 - .../smart_contracts/CentipedeERC721.sol | 20 - centipede/fixture/smart_contracts/Greeter.sol | 21 - centipede/fixture/smart_contracts/compile.sh | 9 - .../smart_contracts/openzeppelin-contracts | 1 - centipede/generator.py | 325 ----- centipede/manage.py | 93 -- centipede/tests/__init__.py | 0 centipede/tests/test_tester_provider.py | 184 --- centipede/tests/test_testnet.py | 62 - centipede/version.py | 1 - centipede/web3_util.py | 167 --- 34 files changed, 3 insertions(+), 4282 deletions(-) delete mode 100644 centipede/__init__.py delete mode 100644 centipede/cli.py delete mode 100644 centipede/cli.py.template delete mode 100644 centipede/contract.py.template delete mode 100644 centipede/contracts.py delete mode 100644 centipede/crawler/example.py delete mode 100644 centipede/crawler/log_scanner.py delete mode 100644 centipede/crawler/state/__init__.py delete mode 100644 centipede/crawler/state/event_scanner_state.py delete mode 100644 centipede/crawler/state/json_state.py delete mode 100644 centipede/crawler/state/sqlite_state.py delete mode 100644 centipede/fixture/abis/CentipedeERC1155.json delete mode 100644 centipede/fixture/abis/CentipedeERC20.json delete mode 100644 centipede/fixture/abis/CentipedeERC721.json delete mode 100644 centipede/fixture/abis/CryptoKitties.json delete mode 100644 centipede/fixture/abis/greetingabi.json delete mode 100644 centipede/fixture/bytecodes/CentipedeERC1155.bin delete mode 100644 centipede/fixture/bytecodes/CentipedeERC20.bin delete mode 100644 centipede/fixture/bytecodes/CentipedeERC721.bin delete mode 100644 centipede/fixture/events_abi/events.sample.json delete mode 100644 centipede/fixture/smart_contracts/CentipedeERC1155.sol delete mode 100644 centipede/fixture/smart_contracts/CentipedeERC20.sol delete mode 100644 centipede/fixture/smart_contracts/CentipedeERC721.sol delete mode 100644 centipede/fixture/smart_contracts/Greeter.sol delete mode 100755 centipede/fixture/smart_contracts/compile.sh delete mode 160000 centipede/fixture/smart_contracts/openzeppelin-contracts delete mode 100644 centipede/generator.py delete mode 100644 centipede/manage.py delete mode 100644 centipede/tests/__init__.py delete mode 100644 centipede/tests/test_tester_provider.py delete mode 100644 centipede/tests/test_testnet.py delete mode 100644 centipede/version.py delete mode 100644 centipede/web3_util.py diff --git a/.gitmodules b/.gitmodules index 05f6a16..d7874e2 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "centipede/fixture/smart_contracts/openzeppelin-contracts"] - path = centipede/fixture/smart_contracts/openzeppelin-contracts - url = git@github.com:OpenZeppelin/openzeppelin-contracts.git +[submodule "moonworm/fixture/smart_contracts/openzeppelin-contracts"] + path = moonworm/fixture/smart_contracts/openzeppelin-contracts + url = git@github.com:OpenZeppelin/openzeppelin-contracts.git \ No newline at end of file diff --git a/centipede/__init__.py b/centipede/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/centipede/cli.py b/centipede/cli.py deleted file mode 100644 index ed6e5ce..0000000 --- a/centipede/cli.py +++ /dev/null @@ -1,125 +0,0 @@ -import argparse -import json -import os -from shutil import copyfile - -from .contracts import ERC20, ERC721 -from .generator import ( - generate_contract_cli_content, - generate_contract_interface_content, -) - - -def write_file(content: str, path: str): - with open(path, "w") as ofp: - ofp.write(content) - - -def copy_web3_util(dest_dir: str, force: bool = False) -> None: - dest_filepath = os.path.join(dest_dir, "web3_util.py") - if os.path.isfile(dest_filepath) and not force: - print(f"{dest_filepath} file already exists. Use -f to rewrite") - web3_util_path = os.path.join(os.path.dirname(__file__), "web3_util.py") - copyfile(web3_util_path, dest_filepath) - - -def create_init_py(dest_dir: str, force: bool = False) -> None: - dest_filepath = os.path.join(dest_dir, "__init__.py") - if os.path.isfile(dest_filepath) and not force: - print(f"{dest_filepath} file already exists. Use -f to rewrite") - with open(dest_filepath, "w") as ofp: - ofp.write("") - - -def handle_generate(args: argparse.Namespace) -> None: - args.name = args.name + "_" - - if args.abi == "erc20": - contract_abi = ERC20.abi() - write_file( - ERC20.bytecode(), os.path.join(args.outdir, args.name + "bytecode.bin") - ) - elif args.abi == "erc721": - contract_abi = ERC721.abi() - write_file( - ERC721.bytecode(), os.path.join(args.outdir, args.name + "bytecode.bin") - ) - else: - with open(args.abi, "r") as ifp: - contract_abi = json.load(ifp) - - abi_file_name = args.name + "abi.json" - write_file(json.dumps(contract_abi), os.path.join(args.outdir, abi_file_name)) - copy_web3_util(args.outdir, args.force) - create_init_py(args.outdir, args.force) - if args.interface: - interface_content = generate_contract_interface_content( - contract_abi, abi_file_name - ) - interface_name = args.name + "interface.py" - write_file(interface_content, os.path.join(args.outdir, interface_name)) - if args.cli: - cli_content = generate_contract_cli_content(contract_abi, abi_file_name) - cli_name = args.name + "cli.py" - write_file(cli_content, os.path.join(args.outdir, cli_name)) - - -def generate_argument_parser() -> argparse.ArgumentParser: - parser = argparse.ArgumentParser( - description="Centipede: Manage your smart contract" - ) - - parser.set_defaults(func=lambda _: parser.print_help()) - subcommands = parser.add_subparsers() - - generate_parser = subcommands.add_parser( - "generate", description="Centipede code generator" - ) - - generate_parser.add_argument( - "-i", - "--abi", - required=True, - help=f"Path to contract abi JSON file or (erc20|erc721)", - ) - generate_parser.add_argument( - "-o", - "--outdir", - required=True, - help=f"Output directory where files will be generated.", - ) - generate_parser.add_argument( - "--interface", - action="store_true", - help="Generate python interface for given smart contract abi", - ) - - generate_parser.add_argument( - "--cli", - action="store_true", - help="Generate cli for given smart contract abi", - ) - generate_parser.add_argument( - "--name", - "-n", - required=True, - help="Prefix name for generated files", - ) - generate_parser.add_argument( - "--force", - "-f", - action="store_true", - help="Force rewrite generated files", - ) - generate_parser.set_defaults(func=handle_generate) - return parser - - -def main() -> None: - parser = generate_argument_parser() - args = parser.parse_args() - args.func(args) - - -if __name__ == "__main__": - main() diff --git a/centipede/cli.py.template b/centipede/cli.py.template deleted file mode 100644 index 7752bce..0000000 --- a/centipede/cli.py.template +++ /dev/null @@ -1,150 +0,0 @@ -# Code generated by moonstream centipede : https://github.com/bugout-dev/centipede -# Centipede version : {centipede_version} - -import argparse -import json -from typing import Any, Callable, Dict, List, Optional, Tuple -import os - -from eth_typing.evm import Address, ChecksumAddress -import web3 -from web3 import Web3 -from web3.contract import Contract - -from .web3_util import * - -abi_path = os.path.join(os.path.dirname(__file__), "{abi_file_name}") -with open(abi_path, "r") as abi_file: - CONTRACT_ABI = json.load(abi_file) - -CONTRACT_FUNCTIONS = {{}} -for abi_item in CONTRACT_ABI: - if abi_item["type"] == "function": - CONTRACT_FUNCTIONS[abi_item["name"]] = abi_item - if abi_item["type"] == "constructor": - CONTRACT_FUNCTIONS["constructor"] = abi_item - - -def init_web3(ipc_path: str) -> Web3: - return Web3(web3.HTTPProvider(ipc_path)) - - -def init_contract(web3: Web3, abi: Dict[str, Any], address: Optional[str]) -> Contract: - checksum_address: Optional[ChecksumAddress] = None - if address is not None: - checksum_address = web3.toChecksumAddress(address) - return web3.eth.contract(address=checksum_address, abi=abi) - -def make_function_call(contract: Contract, function_name: str, *args): - return contract.functions[function_name](*args).call() - - -def populate_subparser_with_common_args( - leaf_parser: argparse.ArgumentParser, -) -> None: - leaf_parser.add_argument( - "-w", - "--web3", - required=True, - help=f"Web3 IPC connection", - ) - - leaf_parser.add_argument( - "-c", - "--contract_address", - required=True, - help=f"contract_address", - ) - -def populate_deploy_subparser( - leaf_parser: argparse.ArgumentParser, -) -> None: - leaf_parser.add_argument( - "-w", - "--web3", - required=True, - help=f"Web3 IPC connection", - ) - leaf_parser.add_argument( - "-b", - "--bytecode-path", - required=True, - help=f"Path to contract bytecode", - ) - -{cli_content} - -def get_address_and_private_key(): - try: - address, pk = read_keys_from_env() - except Exception as e: - print(f"{{str(e)}}, Reading from cli") - address, pk = read_keys_from_cli() - return address, pk - - -def handle_args(args: argparse.Namespace): - # Initializng contract - web3 = init_web3(args.web3) - - kwargs = vars(args) - if args.subcommand == "call": - contract_address = web3.toChecksumAddress(args.contract_address) - contract = web3.eth.contract(address=contract_address, abi=CONTRACT_ABI) - function_name = kwargs["function_name"] - del kwargs["function_name"] - call_args = [ - cast_to_python_type(f_arg["type"])(kwargs[f_arg["name"]]) - for f_arg in CONTRACT_FUNCTIONS[function_name]["inputs"] - ] - print(make_function_call(contract, function_name, *call_args)) - - if args.subcommand == "transact": - contract_address = web3.toChecksumAddress(args.contract_address) - contract = web3.eth.contract(address=contract_address, abi=CONTRACT_ABI) - function_name = kwargs["function_name"] - del kwargs["function_name"] - call_args = [ - cast_to_python_type(f_arg["type"])(kwargs[f_arg["name"]]) - for f_arg in CONTRACT_FUNCTIONS[function_name]["inputs"] - ] - address, pk = get_address_and_private_key() - transaction = build_transaction( - web3, contract.functions[function_name](*call_args), address - ) - print(f"Transaction:\n{{transaction}}") - answer = input("Sign and submit transaction? (y/Y for yes)") - if answer == "Y" or answer == "y": - transaction_hash = submit_transaction(web3, transaction, pk) - print("Transaction is submitted, waiting for transaction receipt...") - tx_receipt = wait_for_transaction_receipt(web3, transaction_hash) - print(f"Got receipt:\n{{tx_receipt}}") - - if args.subcommand == "deploy": - with open(args.bytecode_path, "r") as ifp: - bytecode = ifp.read() - address, pk = get_address_and_private_key() - constructor_args = [ - cast_to_python_type(f_arg["type"])(kwargs[f_arg["name"]]) - for f_arg in CONTRACT_FUNCTIONS["constructor"]["inputs"] - ] - print("Deploying contract") - tx_hash, contract_address = deploy_contract( - web3, - bytecode, - CONTRACT_ABI, - deployer=address, - deployer_private_key=pk, - constructor_arguments=constructor_args, - ) - print(f"Tx hash of deployment: {{web3.toHex(tx_hash)}}") - print(f"Address of deployed_contract: {{contract_address}}") - -def main() -> None: - parser = generate_argument_parser() - args = parser.parse_args() - handle_args(args) - - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/centipede/contract.py.template b/centipede/contract.py.template deleted file mode 100644 index 7cbddb2..0000000 --- a/centipede/contract.py.template +++ /dev/null @@ -1,33 +0,0 @@ -# Code generated by moonstream centipede : https://github.com/bugout-dev/centipede -# Centipede version : {centipede_version} -import json -import os -from typing import Any, Dict, Union - -from eth_typing.evm import Address, ChecksumAddress -from web3 import Web3 -from web3.contract import ContractFunction - -from .web3_util import * - -abi_path = os.path.join(os.path.dirname(__file__), "{abi_file_name}") -with open(abi_path, "r") as abi_file: - CONTRACT_ABI = json.load(abi_file) -{contract_body} - -def deploy( - web3: Web3, - contract_constructor: ContractFunction, - contract_bytecode: str, - deployer_address: ChecksumAddress, - deployer_private_key: str, -) -> Contract: - tx_hash, contract_address = deploy_contract_from_constructor_function( - web3, - constructor=contract_constructor, - contract_bytecode=contract_bytecode, - contract_abi=CONTRACT_ABI, - deployer=deployer_address, - deployer_private_key=deployer_private_key, - ) - return Contract(web3, contract_address) \ No newline at end of file diff --git a/centipede/contracts.py b/centipede/contracts.py deleted file mode 100644 index 4491956..0000000 --- a/centipede/contracts.py +++ /dev/null @@ -1,40 +0,0 @@ -import json -import os -from typing import Any, Dict - - -_PATHS = { - "abi": { - "erc20": "fixture/abis/CentipedeERC20.json", - "erc1155": "fixture/abis/CentipedeERC1155.json", - "erc721": "fixture/abis/CentipedeERC721.json", - }, - "bytecode": { - "erc20": "fixture/bytecodes/CentipedeERC20.bin", - "erc1155": "fixture/bytecodes/CentipedeERC1155.bin", - "erc721": "fixture/bytecodes/CentipedeERC721.bin", - }, -} - - -class CentipedeContract: - def __init__(self, abi_path: str, bytecode_path: str) -> None: - self._abi_path = abi_path - self._bytecode_path = bytecode_path - - def abi(self) -> Dict[str, Any]: - base_dir = os.path.dirname(__file__) - with open(os.path.join(base_dir, self._abi_path), "r") as ifp: - abi = json.load(ifp) - return abi - - def bytecode(self) -> str: - base_dir = os.path.dirname(__file__) - with open(os.path.join(base_dir, self._bytecode_path), "r") as ifp: - bytecode = ifp.read() - return bytecode - - -ERC20 = CentipedeContract(_PATHS["abi"]["erc20"], _PATHS["bytecode"]["erc20"]) -ERC721 = CentipedeContract(_PATHS["abi"]["erc721"], _PATHS["bytecode"]["erc721"]) -ERC1155 = CentipedeContract(_PATHS["abi"]["erc1155"], _PATHS["bytecode"]["erc1155"]) diff --git a/centipede/crawler/example.py b/centipede/crawler/example.py deleted file mode 100644 index b7c022f..0000000 --- a/centipede/crawler/example.py +++ /dev/null @@ -1,129 +0,0 @@ -import sys -import time -import logging - -from web3.providers.rpc import HTTPProvider -from web3 import Web3 - -from .log_scanner import EventScanner -from .state import JSONifiedState - - -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) - -if __name__ == "__main__": - # Simple demo that scans all the token transfers of RCC token (11k). - # The demo supports persistant state by using a JSON file. - # You will need an Ethereum node for this. - # Running this script will consume around 20k JSON-RPC calls. - # With locally running Geth, the script takes 10 minutes. - # The resulting JSON state file is 2.9 MB. - - # We use tqdm library to render a nice progress bar in the console - # https://pypi.org/project/tqdm/ - from tqdm import tqdm - - # RCC has around 11k Transfer events - # https://etherscan.io/token/0x9b6443b0fb9c241a7fdac375595cea13e6b7807a - RCC_ADDRESS = "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619" - - # Reduced ERC-20 ABI, only Transfer event - - ABI = [ - { - "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", - } - ] - - def run(): - - if len(sys.argv) < 2: - print("Usage: eventscanner.py http://your-node-url") - sys.exit(1) - - api_url = sys.argv[1] - - # Enable logs to the stdout. - # DEBUG is very verbose level - logging.basicConfig(level=logging.INFO) - - provider = HTTPProvider(api_url) - - # Remove the default JSON-RPC retry middleware - # as it correctly cannot handle eth_getLogs block range - # throttle down. - provider.middlewares.clear() - - web3 = Web3(provider) - print(web3.eth.block_number) - # Restore/create our persistent state - state = JSONifiedState() - state.restore() - - # chain_id: int, web3: Web3, abi: dict, state: EventScannerState, events: List, filters: {}, max_chunk_scan_size: int=10000 - scanner = EventScanner( - web3=web3, - scanner_state=state, - events=ABI, - addresses=[RCC_ADDRESS], - # How many maximum blocks at the time we request from JSON-RPC - # and we are unlikely to exceed the response size limit of the JSON-RPC server - max_chunk_scan_size=100000, - skip_block_timestamp=True, - ) - - # Assume we might have scanned the blocks all the way to the last Ethereum block - # that mined a few seconds before the previous scan run ended. - # Because there might have been a minor Etherueum chain reorganisations - # since the last scan ended, we need to discard - # the last few blocks from the previous scan results. - chain_reorg_safety_blocks = 10 - scanner.delete_potentially_forked_block_data( - state.get_last_scanned_block() - chain_reorg_safety_blocks - ) - - # Scan from [last block scanned] - [latest ethereum block] - # Note that our chain reorg safety blocks cannot go negative - # start_block = max(state.get_last_scanned_block() - chain_reorg_safety_blocks, 0) - end_block = scanner.get_suggested_scan_end_block() - start_block = end_block - 1000 - blocks_to_scan = end_block - start_block - - print(f"Scanning events from blocks {start_block} - {end_block}") - - # Render a progress bar in the console - start = time.time() - with tqdm(total=blocks_to_scan) as progress_bar: - - def _update_progress( - start, end, current, current_block_timestamp, chunk_size, events_count - ): - if current_block_timestamp: - formatted_time = current_block_timestamp.strftime("%d-%m-%Y") - else: - formatted_time = "" - progress_bar.set_description( - f"Current block: {current} ({formatted_time}), blocks in a scan batch: {chunk_size}, events processed in a batch {events_count}" - ) - progress_bar.update(chunk_size) - - # Run the scan - result, total_chunks_scanned = scanner.scan( - start_block, end_block, progress_callback=_update_progress - ) - - state.save() - duration = time.time() - start - print( - f"Scanned total {len(result)} Transfer events, in {duration} seconds, total {total_chunks_scanned} chunk scans performed" - ) - - run() diff --git a/centipede/crawler/log_scanner.py b/centipede/crawler/log_scanner.py deleted file mode 100644 index 85458d8..0000000 --- a/centipede/crawler/log_scanner.py +++ /dev/null @@ -1,392 +0,0 @@ -# Used example scanner from web3 documentation : https://web3py.readthedocs.io/en/stable/examples.html#eth-getlogs-limitations -import datetime -import logging -import time -from typing import Iterable, List, Tuple, Optional, Callable - -from typing import Optional -from eth_abi.codec import ABICodec -from eth_typing.evm import ChecksumAddress -from web3 import Web3 -from web3._utils.filters import construct_event_filter_params -from web3._utils.events import get_event_data -from web3.datastructures import AttributeDict -from web3.exceptions import BlockNotFound -from web3.types import ABIEvent, FilterParams - -from .state import EventScannerState - -logging.basicConfig(level=logging.INFO) -logger = logging.getLogger(__name__) - - -def _retry_web3_call(func, start_block, end_block, retries, delay) -> Tuple[int, list]: - """A custom retry loop to throttle down block range. - - If our JSON-RPC server cannot serve all incoming `eth_getLogs` in a single request, - we retry and throttle down block range for every retry. - - For example, Go Ethereum does not indicate what is an acceptable response size. - It just fails on the server-side with a "context was cancelled" warning. - - :param func: A callable that triggers Ethereum JSON-RPC, as func(start_block, end_block) - :param start_block: The initial start block of the block range - :param end_block: The initial start block of the block range - :param retries: How many times we retry - :param delay: Time to sleep between retries - """ - for i in range(retries): - try: - return end_block, func(start_block, end_block) - except Exception as e: - # Assume this is HTTPConnectionPool(host='localhost', port=8545): Read timed out. (read timeout=10) - # from Go Ethereum. This translates to the error "context was cancelled" on the server side: - # https://github.com/ethereum/go-ethereum/issues/20426 - if i < retries - 1: - # Give some more verbose info than the default middleware - logger.warning( - "Retrying events for block range %d - %d (%d) failed with %s, retrying in %s seconds", - start_block, - end_block, - end_block - start_block, - e, - delay, - ) - # Decrease the `eth_getBlocks` range - end_block = start_block + ((end_block - start_block) // 2) - # Let the JSON-RPC to recover e.g. from restart - time.sleep(delay) - continue - else: - logger.warning("Out of retries") - raise - - -def _fetch_events_chunk( - web3, - event_abi, - from_block: int, - to_block: int, - addresses: Optional[List[ChecksumAddress]] = None, -) -> Iterable: - """Get events using eth_getLogs API. - - This method is detached from any contract instance. - - This is a stateless method, as opposed to createFilter. - It can be safely called against nodes which do not provide `eth_newFilter` API, like Infura. - """ - - if from_block is None: - raise TypeError("Missing mandatory keyword argument to getLogs: fromBlock") - - # Depending on the Solidity version used to compile - # the contract that uses the ABI, - # it might have Solidity ABI encoding v1 or v2. - # We just assume the default that you set on Web3 object here. - # More information here https://eth-abi.readthedocs.io/en/latest/index.html - codec: ABICodec = web3.codec - - # Here we need to poke a bit into Web3 internals, as this - # functionality is not exposed by default. - # Construct JSON-RPC raw filter presentation based on human readable Python descriptions - # Namely, convert event names to their keccak signatures - # More information here: - # https://github.com/ethereum/web3.py/blob/e176ce0793dafdd0573acc8d4b76425b6eb604ca/web3/_utils/filters.py#L71 - # TODO(yhtiyar): Add argument filters and contract address filters - data_filter_set, event_filter_params = construct_event_filter_params( - event_abi, - codec, - fromBlock=from_block, - toBlock=to_block, - ) - if addresses: - event_filter_params["address"] = addresses - - logger.debug( - "Querying eth_getLogs with the following parameters: %s", - event_filter_params, - ) - - # Call JSON-RPC API on your Ethereum node. - # get_logs() returns raw AttributedDict entries - logs = web3.eth.get_logs(event_filter_params) - - # Convert raw binary data to Python proxy objects as described by ABI - all_events = [] - for log in logs: - # Convert raw JSON-RPC log result to human readable event by using ABI data - # More information how processLog works here - # https://github.com/ethereum/web3.py/blob/fbaf1ad11b0c7fac09ba34baff2c256cffe0a148/web3/_utils/events.py#L200 - try: - evt = get_event_data(codec, event_abi, log) - # Note: This was originally yield, - # but deferring the timeout exception caused the throttle logic not to work - all_events.append(evt) - except: - continue - return all_events - - -class EventScanner: - def __init__( - self, - web3: Web3, - events: List, - addresses: Optional[str] = None, - scanner_state: Optional[EventScannerState] = None, - max_chunk_scan_size: int = 10000, - max_request_retries: int = 30, - request_retry_seconds: float = 3.0, - skip_block_timestamp: bool = False, - ): - """ - :param events: List of web3 Event we scan - :param max_chunk_scan_size: JSON-RPC API limit in the number of blocks we query. (Recommendation: 10,000 for mainnet, 500,000 for testnets) - :param max_request_retries: How many times we try to reattempt a failed JSON-RPC call - :param request_retry_seconds: Delay between failed requests to let JSON-RPC server to recover - """ - - self.web3 = web3 - self.state = scanner_state - self.events = events - self.skip_block_timestamp = skip_block_timestamp - - self.checksum_addresses = [] - if addresses: - for address in addresses: - self.checksum_addresses.append(web3.toChecksumAddress(address)) - - # Our JSON-RPC throttling parameters - self.min_scan_chunk_size = 10 # 12 s/block = 120 seconds period - self.max_scan_chunk_size = max_chunk_scan_size - self.max_request_retries = max_request_retries - self.request_retry_seconds = request_retry_seconds - - # Factor how fast we increase the chunk size if results are found - # # (slow down scan after starting to get hits) - self.chunk_size_decrease = 0.5 - - # Factor how was we increase chunk size if no results found - self.chunk_size_increase = 2.0 - - def get_block_timestamp(self, block_num) -> Optional[datetime.datetime]: - """Get Ethereum block timestamp""" - if self.skip_block_timestamp: - # Returning None since, config set to skip getting block timestamp data - return None - try: - block_info = self.web3.eth.getBlock(block_num) - except BlockNotFound: - # Block was not mined yet, - # minor chain reorganisation? - return None - last_time = block_info["timestamp"] - return datetime.datetime.utcfromtimestamp(last_time) - - def get_suggested_scan_start_block(self): - """Get where we should start to scan for new token events. - - If there are no prior scans, start from block 1. - Otherwise, start from the last end block minus ten blocks. - We rescan the last ten scanned blocks in the case there were forks to avoid - misaccounting due to minor single block works (happens once in a hour in Ethereum). - These heurestics could be made more robust, but this is for the sake of simple reference implementation. - """ - - end_block = self.get_last_scanned_block() - if end_block: - return max(1, end_block - self.NUM_BLOCKS_RESCAN_FOR_FORKS) - return 1 - - def get_suggested_scan_end_block(self): - """Get the last mined block on Ethereum chain we are following.""" - - # Do not scan all the way to the final block, as this - # block might not be mined yet - return self.web3.eth.blockNumber - 1 - - def get_last_scanned_block(self) -> int: - return self.state.get_last_scanned_block() - - def delete_potentially_forked_block_data(self, after_block: int): - """Purge old data in the case of blockchain reorganisation.""" - self.state.delete_data(after_block) - - def estimate_next_chunk_size(self, current_chuck_size: int, event_found_count: int): - """Try to figure out optimal chunk size - - Our scanner might need to scan the whole blockchain for all events - - * We want to minimize API calls over empty blocks - - * We want to make sure that one scan chunk does not try to process too many entries once, as we try to control commit buffer size and potentially asynchronous busy loop - - * Do not overload node serving JSON-RPC API by asking data for too many events at a time - - Currently Ethereum JSON-API does not have an API to tell when a first event occured in a blockchain - and our heuristics try to accelerate block fetching (chunk size) until we see the first event. - - These heurestics exponentially increase the scan chunk size depending on if we are seeing events or not. - When any transfers are encountered, we are back to scanning only a few blocks at a time. - It does not make sense to do a full chain scan starting from block 1, doing one JSON-RPC call per 20 blocks. - """ - - if event_found_count > 0: - # When we encounter first events, reset the chunk size window - current_chuck_size = self.min_scan_chunk_size - else: - current_chuck_size *= self.chunk_size_increase - - current_chuck_size = max(self.min_scan_chunk_size, current_chuck_size) - current_chuck_size = min(self.max_scan_chunk_size, current_chuck_size) - return int(current_chuck_size) - - def scan_chunk(self, start_block, end_block) -> Tuple[int, datetime.datetime, list]: - """Read and process events between to block numbers. - - Dynamically decrease the size of the chunk if the case JSON-RPC server pukes out. - - :return: tuple(actual end block number, when this block was mined, processed events) - """ - - block_timestamps = {} - get_block_timestamp = self.get_block_timestamp - - # Cache block timestamps to reduce some RPC overhead - # Real solution might include smarter models around block - def get_block_when(block_num): - if block_num not in block_timestamps: - block_timestamps[block_num] = get_block_timestamp(block_num) - return block_timestamps[block_num] - - all_processed = [] - - for event_type in self.events: - - # Callable that takes care of the underlying web3 call - def _fetch_events(_start_block, _end_block): - return _fetch_events_chunk( - self.web3, - event_type, - from_block=_start_block, - to_block=_end_block, - addresses=self.checksum_addresses, - ) - - # Do `n` retries on `eth_getLogs`, - # throttle down block range if needed - end_block, events = _retry_web3_call( - _fetch_events, - start_block=start_block, - end_block=end_block, - retries=self.max_request_retries, - delay=self.request_retry_seconds, - ) - - for evt in events: - idx = evt[ - "logIndex" - ] # Integer of the log index position in the block, null when its pending - - # We cannot avoid minor chain reorganisations, but - # at least we must avoid blocks that are not mined yet - assert idx is not None, "Somehow tried to scan a pending block" - - block_number = evt["blockNumber"] - - # Get UTC time when this event happened (block mined timestamp) - # from our in-memory cache - block_when = get_block_when(block_number) - - logger.debug( - "Processing event %s, block:%d count:%d", - evt["event"], - evt["blockNumber"], - ) - processed = self.state.process_event(block_when, evt) - all_processed.append(processed) - - end_block_timestamp = get_block_when(end_block) - return end_block, end_block_timestamp, all_processed - - def scan( - self, - start_block, - end_block, - start_chunk_size=20, - progress_callback=Optional[Callable], - ) -> Tuple[list, int]: - """Perform a token balances scan. - - Assumes all balances in the database are valid before start_block (no forks sneaked in). - - :param start_block: The first block included in the scan - - :param end_block: The last block included in the scan - - :param start_chunk_size: How many blocks we try to fetch over JSON-RPC on the first attempt - - :param progress_callback: If this is an UI application, update the progress of the scan - - :return: [All processed events, number of chunks used] - """ - - assert start_block <= end_block - - current_block = start_block - - # Scan in chunks, commit between - chunk_size = start_chunk_size - last_scan_duration = last_logs_found = 0 - total_chunks_scanned = 0 - - # All processed entries we got on this scan cycle - all_processed = [] - - while current_block <= end_block: - - self.state.start_chunk(current_block, chunk_size) - - # Print some diagnostics to logs to try to fiddle with real world JSON-RPC API performance - estimated_end_block = current_block + chunk_size - logger.debug( - "Scanning token transfers for blocks: %d - %d, chunk size %d, last chunk scan took %f, last logs found %d", - current_block, - estimated_end_block, - chunk_size, - last_scan_duration, - last_logs_found, - ) - - start = time.time() - actual_end_block, end_block_timestamp, new_entries = self.scan_chunk( - current_block, estimated_end_block - ) - - # Where does our current chunk scan ends - are we out of chain yet? - current_end = actual_end_block - - last_scan_duration = time.time() - start - all_processed += new_entries - - # Print progress bar - if progress_callback: - progress_callback( - start_block, - end_block, - current_block, - end_block_timestamp, - chunk_size, - len(new_entries), - ) - - # Try to guess how many blocks to fetch over `eth_getLogs` API next time - chunk_size = self.estimate_next_chunk_size(chunk_size, len(new_entries)) - - # Set where the next chunk starts - current_block = current_end + 1 - total_chunks_scanned += 1 - self.state.end_chunk(current_end) - - return all_processed, total_chunks_scanned diff --git a/centipede/crawler/state/__init__.py b/centipede/crawler/state/__init__.py deleted file mode 100644 index 2d526bd..0000000 --- a/centipede/crawler/state/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -from .event_scanner_state import EventScannerState -from .json_state import JSONifiedState diff --git a/centipede/crawler/state/event_scanner_state.py b/centipede/crawler/state/event_scanner_state.py deleted file mode 100644 index 102d4eb..0000000 --- a/centipede/crawler/state/event_scanner_state.py +++ /dev/null @@ -1,54 +0,0 @@ -from abc import ABC, abstractmethod - -import datetime -from typing import Optional - -from web3.datastructures import AttributeDict - - -class EventScannerState(ABC): - """Application state that remembers what blocks we have scanned in the case of crash.""" - - @abstractmethod - def get_last_scanned_block(self) -> int: - """Number of the last block we have scanned on the previous cycle. - - :return: 0 if no blocks scanned yet - """ - - @abstractmethod - def start_chunk(self, block_number: int): - """Scanner is about to ask data of multiple blocks over JSON-RPC. - - Start a database session if needed. - """ - - @abstractmethod - def end_chunk(self, block_number: int): - """Scanner finished a number of blocks. - - Persistent any data in your state now. - """ - - @abstractmethod - def process_event( - self, block_when: Optional[datetime.datetime], event: AttributeDict - ) -> object: - """Process incoming events. - - This function takes raw events from Web3, transforms them to your application internal - format, then saves them in a database or some other state. - - :param block_when: When this block was mined - - :param event: Symbolic dictionary of the event data - - :return: Internal state structure that is the result of event tranformation. - """ - - @abstractmethod - def delete_data(self, since_block: int) -> int: - """Delete any data since this block was scanned. - - Purges any potential minor reorg data. - """ diff --git a/centipede/crawler/state/json_state.py b/centipede/crawler/state/json_state.py deleted file mode 100644 index c232873..0000000 --- a/centipede/crawler/state/json_state.py +++ /dev/null @@ -1,114 +0,0 @@ -import json -import time -import datetime -from typing import Optional - -from web3.datastructures import AttributeDict - -from .event_scanner_state import EventScannerState - - -class JSONifiedState(EventScannerState): - """Store the state of scanned blocks and all events. - - All state is an in-memory dict. - Simple load/store massive JSON on start up. - """ - - def __init__(self): - self.state = None - self.fname = "test-state.json" - # How many second ago we saved the JSON file - self.last_save = 0 - - def reset(self): - """Create initial state of nothing scanned.""" - self.state = { - "last_scanned_block": 0, - "blocks": {}, - } - - def restore(self): - """Restore the last scan state from a file.""" - try: - self.state = json.load(open(self.fname, "rt")) - print( - f"Restored the state, previously {self.state['last_scanned_block']} blocks have been scanned" - ) - except (IOError, json.decoder.JSONDecodeError): - print("State starting from scratch") - self.reset() - - def save(self): - """Save everything we have scanned so far in a file.""" - with open(self.fname, "wt") as f: - json.dump(self.state, f) - self.last_save = time.time() - - # - # EventScannerState methods implemented below - # - - def get_last_scanned_block(self): - """The number of the last block we have stored.""" - return self.state["last_scanned_block"] - - def delete_data(self, since_block): - """Remove potentially reorganised blocks from the scan data.""" - for block_num in range(since_block, self.get_last_scanned_block()): - if block_num in self.state["blocks"]: - del self.state["blocks"][block_num] - - def start_chunk(self, block_number, chunk_size): - pass - - def end_chunk(self, block_number): - """Save at the end of each block, so we can resume in the case of a crash or CTRL+C""" - # Next time the scanner is started we will resume from this block - self.state["last_scanned_block"] = block_number - - # Save the database file for every minute - if time.time() - self.last_save > 60: - self.save() - - def process_event( - self, block_when: Optional[datetime.datetime], event: AttributeDict - ) -> str: - """Record a ERC-20 transfer in our database.""" - # Events are keyed by their transaction hash and log index - # One transaction may contain multiple events - # and each one of those gets their own log index - - # event_name = event.event # "Transfer" - log_index = event.logIndex # Log index within the block - # transaction_index = event.transactionIndex # Transaction index within the block - txhash = event.transactionHash.hex() # Transaction hash - block_number = event.blockNumber - - # Convert ERC-20 Transfer event to our internal format - args = event["args"] - transfer = { - "from": args["from"], - "to": args.to, - "value": args.value, - } - - if block_when is not None: - transfer["timestamp"] = block_when.isoformat() - - # Create empty dict as the block that contains all transactions by txhash - if block_number not in self.state["blocks"]: - self.state["blocks"][block_number] = {} - - block = self.state["blocks"][block_number] - if txhash not in block: - # We have not yet recorded any transfers in this transaction - # (One transaction may contain multiple events if executed by a smart contract). - # Create a tx entry that contains all events by a log index - self.state["blocks"][block_number][txhash] = {} - - # Record ERC-20 transfer in our database - self.state["blocks"][block_number][txhash][log_index] = transfer - - # Return a pointer that allows us to look up this event later if needed - return f"{block_number}-{txhash}-{log_index}" diff --git a/centipede/crawler/state/sqlite_state.py b/centipede/crawler/state/sqlite_state.py deleted file mode 100644 index e69de29..0000000 diff --git a/centipede/fixture/abis/CentipedeERC1155.json b/centipede/fixture/abis/CentipedeERC1155.json deleted file mode 100644 index 4a00900..0000000 --- a/centipede/fixture/abis/CentipedeERC1155.json +++ /dev/null @@ -1,537 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_symbol", - "type": "string" - }, - { - "internalType": "string", - "name": "_uri", - "type": "string" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - } - ], - "name": "TransferBatch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "TransferSingle", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "value", - "type": "string" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "URI", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "accounts", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]" - } - ], - "name": "balanceOfBatch", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "_ids", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_amaunt", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "_data", - "type": "bytes[]" - } - ], - "name": "batchMint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_cid", - "type": "string" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "create", - "outputs": [ - { - "internalType": "uint256", - "name": "_id", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_amaunt", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "amounts", - "type": "uint256[]" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeBatchTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_id", - "type": "uint256" - } - ], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_id", - "type": "uint256" - } - ], - "name": "uri", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/centipede/fixture/abis/CentipedeERC20.json b/centipede/fixture/abis/CentipedeERC20.json deleted file mode 100644 index 815f7ca..0000000 --- a/centipede/fixture/abis/CentipedeERC20.json +++ /dev/null @@ -1 +0,0 @@ -[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/centipede/fixture/abis/CentipedeERC721.json b/centipede/fixture/abis/CentipedeERC721.json deleted file mode 100644 index 5ac01f4..0000000 --- a/centipede/fixture/abis/CentipedeERC721.json +++ /dev/null @@ -1,423 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - }, - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/centipede/fixture/abis/CryptoKitties.json b/centipede/fixture/abis/CryptoKitties.json deleted file mode 100644 index 45f2309..0000000 --- a/centipede/fixture/abis/CryptoKitties.json +++ /dev/null @@ -1,1104 +0,0 @@ -[ - { - "constant": true, - "inputs": [ - { - "name": "_interfaceID", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "cfoAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_tokenId", - "type": "uint256" - }, - { - "name": "_preferredTransport", - "type": "string" - } - ], - "name": "tokenMetadata", - "outputs": [ - { - "name": "infoUrl", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "promoCreatedCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "ceoAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GEN0_STARTING_PRICE", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_address", - "type": "address" - } - ], - "name": "setSiringAuctionAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "pregnantKitties", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_kittyId", - "type": "uint256" - } - ], - "name": "isPregnant", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GEN0_AUCTION_DURATION", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "siringAuction", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_from", - "type": "address" - }, - { - "name": "_to", - "type": "address" - }, - { - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_address", - "type": "address" - } - ], - "name": "setGeneScienceAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_newCEO", - "type": "address" - } - ], - "name": "setCEO", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_newCOO", - "type": "address" - } - ], - "name": "setCOO", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_kittyId", - "type": "uint256" - }, - { - "name": "_startingPrice", - "type": "uint256" - }, - { - "name": "_endingPrice", - "type": "uint256" - }, - { - "name": "_duration", - "type": "uint256" - } - ], - "name": "createSaleAuction", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "unpause", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "sireAllowedToAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_matronId", - "type": "uint256" - }, - { - "name": "_sireId", - "type": "uint256" - } - ], - "name": "canBreedWith", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "kittyIndexToApproved", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_kittyId", - "type": "uint256" - }, - { - "name": "_startingPrice", - "type": "uint256" - }, - { - "name": "_endingPrice", - "type": "uint256" - }, - { - "name": "_duration", - "type": "uint256" - } - ], - "name": "createSiringAuction", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "val", - "type": "uint256" - } - ], - "name": "setAutoBirthFee", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_addr", - "type": "address" - }, - { - "name": "_sireId", - "type": "uint256" - } - ], - "name": "approveSiring", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_newCFO", - "type": "address" - } - ], - "name": "setCFO", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_genes", - "type": "uint256" - }, - { - "name": "_owner", - "type": "address" - } - ], - "name": "createPromoKitty", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "secs", - "type": "uint256" - } - ], - "name": "setSecondsPerBlock", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "paused", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "withdrawBalance", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "name": "owner", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "GEN0_CREATION_LIMIT", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "newContractAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_address", - "type": "address" - } - ], - "name": "setSaleAuctionAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "count", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_v2Address", - "type": "address" - } - ], - "name": "setNewAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "secondsPerBlock", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "pause", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_owner", - "type": "address" - } - ], - "name": "tokensOfOwner", - "outputs": [ - { - "name": "ownerTokens", - "type": "uint256[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_matronId", - "type": "uint256" - } - ], - "name": "giveBirth", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "withdrawAuctionBalances", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "cooldowns", - "outputs": [ - { - "name": "", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "uint256" - } - ], - "name": "kittyIndexToOwner", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_to", - "type": "address" - }, - { - "name": "_tokenId", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "cooAddress", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "autoBirthFee", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "erc721Metadata", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_genes", - "type": "uint256" - } - ], - "name": "createGen0Auction", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_kittyId", - "type": "uint256" - } - ], - "name": "isReadyToBreed", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PROMO_CREATION_LIMIT", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_contractAddress", - "type": "address" - } - ], - "name": "setMetadataAddress", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "saleAuction", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "_id", - "type": "uint256" - } - ], - "name": "getKitty", - "outputs": [ - { - "name": "isGestating", - "type": "bool" - }, - { - "name": "isReady", - "type": "bool" - }, - { - "name": "cooldownIndex", - "type": "uint256" - }, - { - "name": "nextActionAt", - "type": "uint256" - }, - { - "name": "siringWithId", - "type": "uint256" - }, - { - "name": "birthTime", - "type": "uint256" - }, - { - "name": "matronId", - "type": "uint256" - }, - { - "name": "sireId", - "type": "uint256" - }, - { - "name": "generation", - "type": "uint256" - }, - { - "name": "genes", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_sireId", - "type": "uint256" - }, - { - "name": "_matronId", - "type": "uint256" - } - ], - "name": "bidOnSiringAuction", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "gen0CreatedCount", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "geneScience", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "_matronId", - "type": "uint256" - }, - { - "name": "_sireId", - "type": "uint256" - } - ], - "name": "breedWithAuto", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "name": "matronId", - "type": "uint256" - }, - { - "indexed": false, - "name": "sireId", - "type": "uint256" - }, - { - "indexed": false, - "name": "cooldownEndBlock", - "type": "uint256" - } - ], - "name": "Pregnant", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "from", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "name": "approved", - "type": "address" - }, - { - "indexed": false, - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "name": "kittyId", - "type": "uint256" - }, - { - "indexed": false, - "name": "matronId", - "type": "uint256" - }, - { - "indexed": false, - "name": "sireId", - "type": "uint256" - }, - { - "indexed": false, - "name": "genes", - "type": "uint256" - } - ], - "name": "Birth", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newContract", - "type": "address" - } - ], - "name": "ContractUpgrade", - "type": "event" - } -] \ No newline at end of file diff --git a/centipede/fixture/abis/greetingabi.json b/centipede/fixture/abis/greetingabi.json deleted file mode 100644 index 4e8c3f9..0000000 --- a/centipede/fixture/abis/greetingabi.json +++ /dev/null @@ -1,59 +0,0 @@ -[ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "constant": true, - "inputs": [], - "name": "greet", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "greeting", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "string", - "name": "_greeting", - "type": "string" - } - ], - "name": "setGreeting", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/centipede/fixture/bytecodes/CentipedeERC1155.bin b/centipede/fixture/bytecodes/CentipedeERC1155.bin deleted file mode 100644 index 744af47..0000000 --- a/centipede/fixture/bytecodes/CentipedeERC1155.bin +++ /dev/null @@ -1 +0,0 @@ -60806040526005805460ff191690553480156200001b57600080fd5b5060405162002390380380620023908339810160408190526200003e916200034a565b816200004a8162000097565b506200005633620000b0565b83516200006b906006906020870190620001d7565b50825162000081906007906020860190620001d7565b506200008d8162000102565b505050506200043a565b8051620000ac906002906020840190620001d7565b5050565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6003546001600160a01b03163314620001625760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b6001600160a01b038116620001c95760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840162000159565b620001d481620000b0565b50565b828054620001e590620003fd565b90600052602060002090601f01602090048101928262000209576000855562000254565b82601f106200022457805160ff191683800117855562000254565b8280016001018555821562000254579182015b828111156200025457825182559160200191906001019062000237565b506200026292915062000266565b5090565b5b8082111562000262576000815560010162000267565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620002a557600080fd5b81516001600160401b0380821115620002c257620002c26200027d565b604051601f8301601f19908116603f01168101908282118183101715620002ed57620002ed6200027d565b816040528381526020925086838588010111156200030a57600080fd5b600091505b838210156200032e57858201830151818301840152908201906200030f565b83821115620003405760008385830101525b9695505050505050565b600080600080608085870312156200036157600080fd5b84516001600160401b03808211156200037957600080fd5b620003878883890162000293565b955060208701519150808211156200039e57600080fd5b620003ac8883890162000293565b94506040870151915080821115620003c357600080fd5b50620003d28782880162000293565b606087015190935090506001600160a01b0381168114620003f257600080fd5b939692955090935050565b600181811c908216806200041257607f821691505b602082108114156200043457634e487b7160e01b600052602260045260246000fd5b50919050565b611f46806200044a6000396000f3fe608060405234801561001057600080fd5b50600436106101205760003560e01c8063731133e9116100ad578063bcebbe8011610071578063bcebbe8014610244578063bd85b03914610257578063e985e9c514610277578063f242432a146102b3578063f2fde38b146102c657600080fd5b8063731133e9146101f35780638456cb59146102065780638da5cb5b1461020e57806395d89b4114610229578063a22cb4651461023157600080fd5b80632eb2c2d6116100f45780632eb2c2d6146101965780634e1273f4146101ab5780635aeb3d35146101cb5780635c975abb146101de578063715018a6146101eb57600080fd5b8062fdd58e1461012557806301ffc9a71461014b57806306fdde031461016e5780630e89341c14610183575b600080fd5b610138610133366004611497565b6102d9565b6040519081526020015b60405180910390f35b61015e6101593660046114d7565b610370565b6040519015158152602001610142565b6101766103c2565b6040516101429190611557565b61017661019136600461156a565b610450565b6101a96101a43660046116cc565b6104f2565b005b6101be6101b9366004611775565b610589565b604051610142919061187a565b6101a96101d93660046118d8565b6106b2565b60055461015e9060ff1681565b6101a9610781565b6101a96102013660046119a2565b6107b7565b6101a96108cc565b6003546040516001600160a01b039091168152602001610142565b61017661090a565b6101a961023f366004611a09565b610917565b610138610252366004611a45565b610926565b61013861026536600461156a565b60009081526009602052604090205490565b61015e610285366004611ab0565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6101a96102c1366004611ae3565b610a94565b6101a96102d4366004611b47565b610b1b565b60006001600160a01b03831661034a5760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b14806103a157506001600160e01b031982166303a24d0760e21b145b806103bc57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600680546103cf90611b62565b80601f01602080910402602001604051908101604052809291908181526020018280546103fb90611b62565b80156104485780601f1061041d57610100808354040283529160200191610448565b820191906000526020600020905b81548152906001019060200180831161042b57829003601f168201915b505050505081565b600081815260086020526040902080546060919061046d90611b62565b80601f016020809104026020016040519081016040528092919081815260200182805461049990611b62565b80156104e65780601f106104bb576101008083540402835291602001916104e6565b820191906000526020600020905b8154815290600101906020018083116104c957829003601f168201915b50505050509050919050565b6001600160a01b03851633148061050e575061050e8533610285565b6105755760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b6064820152608401610341565b6105828585858585610bb6565b5050505050565b606081518351146105ee5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610341565b600083516001600160401b0381111561060957610609611583565b604051908082528060200260200182016040528015610632578160200160208202803683370190505b50905060005b84518110156106aa5761067d85828151811061065657610656611b9d565b602002602001015185838151811061067057610670611b9d565b60200260200101516102d9565b82828151811061068f5761068f611b9d565b60209081029190910101526106a381611bc9565b9050610638565b509392505050565b60055460ff16156106ee5760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610341565b6003546001600160a01b031633146107185760405162461bcd60e51b815260040161034190611be4565b60005b84811015610777576107658787878481811061073957610739611b9d565b905060200201358686868681811061075357610753611b9d565b90506020028101906102019190611c19565b8061076f81611bc9565b91505061071b565b505b505050505050565b6003546001600160a01b031633146107ab5760405162461bcd60e51b815260040161034190611be4565b6107b56000610d8b565b565b60055460ff16156107f35760405162461bcd60e51b815260206004820152600660248201526514185d5cd95960d21b6044820152606401610341565b6003546001600160a01b0316331461081d5760405162461bcd60e51b815260040161034190611be4565b61082684610ddd565b6108645760405162461bcd60e51b815260206004820152600f60248201526e115c9c8e88125b9d985b1a59081251608a1b6044820152606401610341565b6108a685858585858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e0392505050565b60008481526009602052604081208054916108c083611bc9565b91905055505050505050565b6003546001600160a01b031633146108f65760405162461bcd60e51b815260040161034190611be4565b6005805460ff19811660ff90911615179055565b600780546103cf90611b62565b610922338383610f0d565b5050565b6003546000906001600160a01b031633146109535760405162461bcd60e51b815260040161034190611be4565b836109a05760405162461bcd60e51b815260206004820152601f60248201527f4572723a204d697373696e6720436f6e74656e74204964656e746966696572006044820152606401610341565b6109a8610fee565b90506109ed3382600086868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e0392505050565b6000610a2e86868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061100592505050565b60008381526008602090815260409091208251929350610a529290918401906113e2565b50817f6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529b82604051610a839190611557565b60405180910390a250949350505050565b6001600160a01b038516331480610ab05750610ab08533610285565b610b0e5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b6064820152608401610341565b610582858585858561103f565b6003546001600160a01b03163314610b455760405162461bcd60e51b815260040161034190611be4565b6001600160a01b038116610baa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610341565b610bb381610d8b565b50565b8151835114610c185760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608401610341565b6001600160a01b038416610c3e5760405162461bcd60e51b815260040161034190611c5f565b3360005b8451811015610d25576000858281518110610c5f57610c5f611b9d565b602002602001015190506000858381518110610c7d57610c7d611b9d565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015610ccd5760405162461bcd60e51b815260040161034190611ca4565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290610d0a908490611cee565b9250508190555050505080610d1e90611bc9565b9050610c42565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051610d75929190611d06565b60405180910390a4610779818787878787611153565b600380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008181526008602052604081208054829190610df990611b62565b9050119050919050565b6001600160a01b038416610e635760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608401610341565b33610e7d81600087610e74886112be565b610582886112be565b6000848152602081815260408083206001600160a01b038916845290915281208054859290610ead908490611cee565b909155505060408051858152602081018590526001600160a01b0380881692600092918516917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a461058281600087878787611309565b816001600160a01b0316836001600160a01b03161415610f815760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610341565b6001600160a01b03838116600081815260016020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6000610ffe600480546001019055565b5060045490565b6060600061101360006113d3565b90508083604051602001611028929190611d34565b604051602081830303815290604052915050919050565b6001600160a01b0384166110655760405162461bcd60e51b815260040161034190611c5f565b33611075818787610e74886112be565b6000848152602081815260408083206001600160a01b038a168452909152902054838110156110b65760405162461bcd60e51b815260040161034190611ca4565b6000858152602081815260408083206001600160a01b038b81168552925280832087850390559088168252812080548692906110f3908490611cee565b909155505060408051868152602081018690526001600160a01b03808916928a821692918616917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610777828888888888611309565b6001600160a01b0384163b156107795760405163bc197c8160e01b81526001600160a01b0385169063bc197c81906111979089908990889088908890600401611d63565b602060405180830381600087803b1580156111b157600080fd5b505af19250505080156111e1575060408051601f3d908101601f191682019092526111de91810190611dc1565b60015b61128e576111ed611dde565b806308c379a014156112275750611202611dfa565b8061120d5750611229565b8060405162461bcd60e51b81526004016103419190611557565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610341565b6001600160e01b0319811663bc197c8160e01b146107775760405162461bcd60e51b815260040161034190611e83565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106112f8576112f8611b9d565b602090810291909101015292915050565b6001600160a01b0384163b156107795760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061134d9089908990889088908890600401611ecb565b602060405180830381600087803b15801561136757600080fd5b505af1925050508015611397575060408051601f3d908101601f1916820190925261139491810190611dc1565b60015b6113a3576111ed611dde565b6001600160e01b0319811663f23a6e6160e01b146107775760405162461bcd60e51b815260040161034190611e83565b60606002805461046d90611b62565b8280546113ee90611b62565b90600052602060002090601f0160209004810192826114105760008555611456565b82601f1061142957805160ff1916838001178555611456565b82800160010185558215611456579182015b8281111561145657825182559160200191906001019061143b565b50611462929150611466565b5090565b5b808211156114625760008155600101611467565b80356001600160a01b038116811461149257600080fd5b919050565b600080604083850312156114aa57600080fd5b6114b38361147b565b946020939093013593505050565b6001600160e01b031981168114610bb357600080fd5b6000602082840312156114e957600080fd5b81356114f4816114c1565b9392505050565b60005b838110156115165781810151838201526020016114fe565b83811115611525576000848401525b50505050565b600081518084526115438160208601602086016114fb565b601f01601f19169290920160200192915050565b6020815260006114f4602083018461152b565b60006020828403121561157c57600080fd5b5035919050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b03811182821017156115be576115be611583565b6040525050565b60006001600160401b038211156115de576115de611583565b5060051b60200190565b600082601f8301126115f957600080fd5b81356020611606826115c5565b6040516116138282611599565b83815260059390931b850182019282810191508684111561163357600080fd5b8286015b8481101561164e5780358352918301918301611637565b509695505050505050565b600082601f83011261166a57600080fd5b81356001600160401b0381111561168357611683611583565b60405161169a601f8301601f191660200182611599565b8181528460208386010111156116af57600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080600060a086880312156116e457600080fd5b6116ed8661147b565b94506116fb6020870161147b565b935060408601356001600160401b038082111561171757600080fd5b61172389838a016115e8565b9450606088013591508082111561173957600080fd5b61174589838a016115e8565b9350608088013591508082111561175b57600080fd5b5061176888828901611659565b9150509295509295909350565b6000806040838503121561178857600080fd5b82356001600160401b038082111561179f57600080fd5b818501915085601f8301126117b357600080fd5b813560206117c0826115c5565b6040516117cd8282611599565b83815260059390931b85018201928281019150898411156117ed57600080fd5b948201945b83861015611812576118038661147b565b825294820194908201906117f2565b9650508601359250508082111561182857600080fd5b50611835858286016115e8565b9150509250929050565b600081518084526020808501945080840160005b8381101561186f57815187529582019590820190600101611853565b509495945050505050565b6020815260006114f4602083018461183f565b60008083601f84011261189f57600080fd5b5081356001600160401b038111156118b657600080fd5b6020830191508360208260051b85010111156118d157600080fd5b9250929050565b600080600080600080608087890312156118f157600080fd5b6118fa8761147b565b955060208701356001600160401b038082111561191657600080fd5b6119228a838b0161188d565b909750955060408901359450606089013591508082111561194257600080fd5b5061194f89828a0161188d565b979a9699509497509295939492505050565b60008083601f84011261197357600080fd5b5081356001600160401b0381111561198a57600080fd5b6020830191508360208285010111156118d157600080fd5b6000806000806000608086880312156119ba57600080fd5b6119c38661147b565b9450602086013593506040860135925060608601356001600160401b038111156119ec57600080fd5b6119f888828901611961565b969995985093965092949392505050565b60008060408385031215611a1c57600080fd5b611a258361147b565b915060208301358015158114611a3a57600080fd5b809150509250929050565b60008060008060408587031215611a5b57600080fd5b84356001600160401b0380821115611a7257600080fd5b611a7e88838901611961565b90965094506020870135915080821115611a9757600080fd5b50611aa487828801611961565b95989497509550505050565b60008060408385031215611ac357600080fd5b611acc8361147b565b9150611ada6020840161147b565b90509250929050565b600080600080600060a08688031215611afb57600080fd5b611b048661147b565b9450611b126020870161147b565b9350604086013592506060860135915060808601356001600160401b03811115611b3b57600080fd5b61176888828901611659565b600060208284031215611b5957600080fd5b6114f48261147b565b600181811c90821680611b7657607f821691505b60208210811415611b9757634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611bdd57611bdd611bb3565b5060010190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000808335601e19843603018112611c3057600080fd5b8301803591506001600160401b03821115611c4a57600080fd5b6020019150368190038213156118d157600080fd5b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60008219821115611d0157611d01611bb3565b500190565b604081526000611d19604083018561183f565b8281036020840152611d2b818561183f565b95945050505050565b60008351611d468184602088016114fb565b835190830190611d5a8183602088016114fb565b01949350505050565b6001600160a01b0386811682528516602082015260a060408201819052600090611d8f9083018661183f565b8281036060840152611da1818661183f565b90508281036080840152611db5818561152b565b98975050505050505050565b600060208284031215611dd357600080fd5b81516114f4816114c1565b600060033d1115611df75760046000803e5060005160e01c5b90565b600060443d1015611e085790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715611e3757505050505090565b8285019150815181811115611e4f5750505050505090565b843d8701016020828501011115611e695750505050505090565b611e7860208286010187611599565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090611f059083018461152b565b97965050505050505056fea2646970667358221220530b14bc03e2c07b2215c5be1b690ca3ee4754f091f0028306a25099ac16766f64736f6c63430008090033 \ No newline at end of file diff --git a/centipede/fixture/bytecodes/CentipedeERC20.bin b/centipede/fixture/bytecodes/CentipedeERC20.bin deleted file mode 100644 index adec078..0000000 --- a/centipede/fixture/bytecodes/CentipedeERC20.bin +++ /dev/null @@ -1 +0,0 @@ -60806040523480156200001157600080fd5b50604051620021d1380380620021d1833981810160405281019062000037919062000567565b8282816003908051906020019062000051929190620002b5565b5080600490805190602001906200006a929190620002b5565b5050506200008d62000081620000a760201b60201c565b620000af60201b60201c565b6200009e816200017560201b60201c565b50505062000781565b600033905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b62000185620000a760201b60201c565b73ffffffffffffffffffffffffffffffffffffffff16620001ab6200028b60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff161462000204576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001fb9062000662565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141562000277576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200026e90620006fa565b60405180910390fd5b6200028881620000af60201b60201c565b50565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b828054620002c3906200074b565b90600052602060002090601f016020900481019282620002e7576000855562000333565b82601f106200030257805160ff191683800117855562000333565b8280016001018555821562000333579182015b828111156200033257825182559160200191906001019062000315565b5b50905062000342919062000346565b5090565b5b808211156200036157600081600090555060010162000347565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620003ce8262000383565b810181811067ffffffffffffffff82111715620003f057620003ef62000394565b5b80604052505050565b60006200040562000365565b9050620004138282620003c3565b919050565b600067ffffffffffffffff82111562000436576200043562000394565b5b620004418262000383565b9050602081019050919050565b60005b838110156200046e57808201518184015260208101905062000451565b838111156200047e576000848401525b50505050565b60006200049b620004958462000418565b620003f9565b905082815260208101848484011115620004ba57620004b96200037e565b5b620004c78482856200044e565b509392505050565b600082601f830112620004e757620004e662000379565b5b8151620004f984826020860162000484565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200052f8262000502565b9050919050565b620005418162000522565b81146200054d57600080fd5b50565b600081519050620005618162000536565b92915050565b6000806000606084860312156200058357620005826200036f565b5b600084015167ffffffffffffffff811115620005a457620005a362000374565b5b620005b286828701620004cf565b935050602084015167ffffffffffffffff811115620005d657620005d562000374565b5b620005e486828701620004cf565b9250506040620005f78682870162000550565b9150509250925092565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006200064a60208362000601565b9150620006578262000612565b602082019050919050565b600060208201905081810360008301526200067d816200063b565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000620006e260268362000601565b9150620006ef8262000684565b604082019050919050565b600060208201905081810360008301526200071581620006d3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200076457607f821691505b602082108114156200077b576200077a6200071c565b5b50919050565b611a4080620007916000396000f3fe608060405234801561001057600080fd5b50600436106100f55760003560e01c806370a0823111610097578063a457c2d711610066578063a457c2d714610276578063a9059cbb146102a6578063dd62ed3e146102d6578063f2fde38b14610306576100f5565b806370a0823114610200578063715018a6146102305780638da5cb5b1461023a57806395d89b4114610258576100f5565b806323b872dd116100d357806323b872dd14610166578063313ce5671461019657806339509351146101b457806340c10f19146101e4576100f5565b806306fdde03146100fa578063095ea7b31461011857806318160ddd14610148575b600080fd5b610102610322565b60405161010f9190611140565b60405180910390f35b610132600480360381019061012d91906111fb565b6103b4565b60405161013f9190611256565b60405180910390f35b6101506103d2565b60405161015d9190611280565b60405180910390f35b610180600480360381019061017b919061129b565b6103dc565b60405161018d9190611256565b60405180910390f35b61019e6104d4565b6040516101ab919061130a565b60405180910390f35b6101ce60048036038101906101c991906111fb565b6104d9565b6040516101db9190611256565b60405180910390f35b6101fe60048036038101906101f991906111fb565b610585565b005b61021a60048036038101906102159190611325565b61060f565b6040516102279190611280565b60405180910390f35b610238610657565b005b6102426106df565b60405161024f9190611361565b60405180910390f35b610260610709565b60405161026d9190611140565b60405180910390f35b610290600480360381019061028b91906111fb565b61079b565b60405161029d9190611256565b60405180910390f35b6102c060048036038101906102bb91906111fb565b610886565b6040516102cd9190611256565b60405180910390f35b6102f060048036038101906102eb919061137c565b6108a4565b6040516102fd9190611280565b60405180910390f35b610320600480360381019061031b9190611325565b61092b565b005b606060038054610331906113eb565b80601f016020809104026020016040519081016040528092919081815260200182805461035d906113eb565b80156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050905090565b60006103c86103c1610a23565b8484610a2b565b6001905092915050565b6000600254905090565b60006103e9848484610bf6565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610434610a23565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050828110156104b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104ab9061148f565b60405180910390fd5b6104c8856104c0610a23565b858403610a2b565b60019150509392505050565b600090565b600061057b6104e6610a23565b8484600160006104f4610a23565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205461057691906114de565b610a2b565b6001905092915050565b61058d610a23565b73ffffffffffffffffffffffffffffffffffffffff166105ab6106df565b73ffffffffffffffffffffffffffffffffffffffff1614610601576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105f890611580565b60405180910390fd5b61060b8282610e77565b5050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b61065f610a23565b73ffffffffffffffffffffffffffffffffffffffff1661067d6106df565b73ffffffffffffffffffffffffffffffffffffffff16146106d3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106ca90611580565b60405180910390fd5b6106dd6000610fd7565b565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b606060048054610718906113eb565b80601f0160208091040260200160405190810160405280929190818152602001828054610744906113eb565b80156107915780601f1061076657610100808354040283529160200191610791565b820191906000526020600020905b81548152906001019060200180831161077457829003601f168201915b5050505050905090565b600080600160006107aa610a23565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610867576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085e90611612565b60405180910390fd5b61087b610872610a23565b85858403610a2b565b600191505092915050565b600061089a610893610a23565b8484610bf6565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b610933610a23565b73ffffffffffffffffffffffffffffffffffffffff166109516106df565b73ffffffffffffffffffffffffffffffffffffffff16146109a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161099e90611580565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610a17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a0e906116a4565b60405180910390fd5b610a2081610fd7565b50565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610a9b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a9290611736565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610b0b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b02906117c8565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92583604051610be99190611280565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610c66576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c5d9061185a565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610cd6576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ccd906118ec565b60405180910390fd5b610ce183838361109d565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610d67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610d5e9061197e565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610dfa91906114de565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610e5e9190611280565b60405180910390a3610e718484846110a2565b50505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ee7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ede906119ea565b60405180910390fd5b610ef36000838361109d565b8060026000828254610f0591906114de565b92505081905550806000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610f5a91906114de565b925050819055508173ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef83604051610fbf9190611280565b60405180910390a3610fd3600083836110a2565b5050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b505050565b505050565b600081519050919050565b600082825260208201905092915050565b60005b838110156110e15780820151818401526020810190506110c6565b838111156110f0576000848401525b50505050565b6000601f19601f8301169050919050565b6000611112826110a7565b61111c81856110b2565b935061112c8185602086016110c3565b611135816110f6565b840191505092915050565b6000602082019050818103600083015261115a8184611107565b905092915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061119282611167565b9050919050565b6111a281611187565b81146111ad57600080fd5b50565b6000813590506111bf81611199565b92915050565b6000819050919050565b6111d8816111c5565b81146111e357600080fd5b50565b6000813590506111f5816111cf565b92915050565b6000806040838503121561121257611211611162565b5b6000611220858286016111b0565b9250506020611231858286016111e6565b9150509250929050565b60008115159050919050565b6112508161123b565b82525050565b600060208201905061126b6000830184611247565b92915050565b61127a816111c5565b82525050565b60006020820190506112956000830184611271565b92915050565b6000806000606084860312156112b4576112b3611162565b5b60006112c2868287016111b0565b93505060206112d3868287016111b0565b92505060406112e4868287016111e6565b9150509250925092565b600060ff82169050919050565b611304816112ee565b82525050565b600060208201905061131f60008301846112fb565b92915050565b60006020828403121561133b5761133a611162565b5b6000611349848285016111b0565b91505092915050565b61135b81611187565b82525050565b60006020820190506113766000830184611352565b92915050565b6000806040838503121561139357611392611162565b5b60006113a1858286016111b0565b92505060206113b2858286016111b0565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061140357607f821691505b60208210811415611417576114166113bc565b5b50919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b60006114796028836110b2565b91506114848261141d565b604082019050919050565b600060208201905081810360008301526114a88161146c565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006114e9826111c5565b91506114f4836111c5565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115611529576115286114af565b5b828201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061156a6020836110b2565b915061157582611534565b602082019050919050565b600060208201905081810360008301526115998161155d565b9050919050565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b60006115fc6025836110b2565b9150611607826115a0565b604082019050919050565b6000602082019050818103600083015261162b816115ef565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061168e6026836110b2565b915061169982611632565b604082019050919050565b600060208201905081810360008301526116bd81611681565b9050919050565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b60006117206024836110b2565b915061172b826116c4565b604082019050919050565b6000602082019050818103600083015261174f81611713565b9050919050565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b60006117b26022836110b2565b91506117bd82611756565b604082019050919050565b600060208201905081810360008301526117e1816117a5565b9050919050565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b60006118446025836110b2565b915061184f826117e8565b604082019050919050565b6000602082019050818103600083015261187381611837565b9050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b60006118d66023836110b2565b91506118e18261187a565b604082019050919050565b60006020820190508181036000830152611905816118c9565b9050919050565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b60006119686026836110b2565b91506119738261190c565b604082019050919050565b600060208201905081810360008301526119978161195b565b9050919050565b7f45524332303a206d696e7420746f20746865207a65726f206164647265737300600082015250565b60006119d4601f836110b2565b91506119df8261199e565b602082019050919050565b60006020820190508181036000830152611a03816119c7565b905091905056fea2646970667358221220ed16dd894e35e4c2bd24c64f99d1c9be426c231d393504d476aed4d57d04cd0b64736f6c63430008090033 \ No newline at end of file diff --git a/centipede/fixture/bytecodes/CentipedeERC721.bin b/centipede/fixture/bytecodes/CentipedeERC721.bin deleted file mode 100644 index b48ee27..0000000 --- a/centipede/fixture/bytecodes/CentipedeERC721.bin +++ /dev/null @@ -1 +0,0 @@ -60806040523480156200001157600080fd5b506040516200331238038062003312833981810160405281019062000037919062000567565b8282816000908051906020019062000051929190620002b5565b5080600190805190602001906200006a929190620002b5565b5050506200008d62000081620000a760201b60201c565b620000af60201b60201c565b6200009e816200017560201b60201c565b50505062000781565b600033905090565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b62000185620000a760201b60201c565b73ffffffffffffffffffffffffffffffffffffffff16620001ab6200028b60201b60201c565b73ffffffffffffffffffffffffffffffffffffffff161462000204576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401620001fb9062000662565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141562000277576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016200026e90620006fa565b60405180910390fd5b6200028881620000af60201b60201c565b50565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b828054620002c3906200074b565b90600052602060002090601f016020900481019282620002e7576000855562000333565b82601f106200030257805160ff191683800117855562000333565b8280016001018555821562000333579182015b828111156200033257825182559160200191906001019062000315565b5b50905062000342919062000346565b5090565b5b808211156200036157600081600090555060010162000347565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620003ce8262000383565b810181811067ffffffffffffffff82111715620003f057620003ef62000394565b5b80604052505050565b60006200040562000365565b9050620004138282620003c3565b919050565b600067ffffffffffffffff82111562000436576200043562000394565b5b620004418262000383565b9050602081019050919050565b60005b838110156200046e57808201518184015260208101905062000451565b838111156200047e576000848401525b50505050565b60006200049b620004958462000418565b620003f9565b905082815260208101848484011115620004ba57620004b96200037e565b5b620004c78482856200044e565b509392505050565b600082601f830112620004e757620004e662000379565b5b8151620004f984826020860162000484565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200052f8262000502565b9050919050565b620005418162000522565b81146200054d57600080fd5b50565b600081519050620005618162000536565b92915050565b6000806000606084860312156200058357620005826200036f565b5b600084015167ffffffffffffffff811115620005a457620005a362000374565b5b620005b286828701620004cf565b935050602084015167ffffffffffffffff811115620005d657620005d562000374565b5b620005e486828701620004cf565b9250506040620005f78682870162000550565b9150509250925092565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006200064a60208362000601565b9150620006578262000612565b602082019050919050565b600060208201905081810360008301526200067d816200063b565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b6000620006e260268362000601565b9150620006ef8262000684565b604082019050919050565b600060208201905081810360008301526200071581620006d3565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200076457607f821691505b602082108114156200077b576200077a6200071c565b5b50919050565b612b8180620007916000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c806370a08231116100a2578063a22cb46511610071578063a22cb465146102a4578063b88d4fde146102c0578063c87b56dd146102dc578063e985e9c51461030c578063f2fde38b1461033c5761010b565b806370a082311461022e578063715018a61461025e5780638da5cb5b1461026857806395d89b41146102865761010b565b806323b872dd116100de57806323b872dd146101aa57806340c10f19146101c657806342842e0e146101e25780636352211e146101fe5761010b565b806301ffc9a71461011057806306fdde0314610140578063081812fc1461015e578063095ea7b31461018e575b600080fd5b61012a60048036038101906101259190611a06565b610358565b6040516101379190611a4e565b60405180910390f35b61014861043a565b6040516101559190611b02565b60405180910390f35b61017860048036038101906101739190611b5a565b6104cc565b6040516101859190611bc8565b60405180910390f35b6101a860048036038101906101a39190611c0f565b610551565b005b6101c460048036038101906101bf9190611c4f565b610669565b005b6101e060048036038101906101db9190611c0f565b6106c9565b005b6101fc60048036038101906101f79190611c4f565b610753565b005b61021860048036038101906102139190611b5a565b610773565b6040516102259190611bc8565b60405180910390f35b61024860048036038101906102439190611ca2565b610825565b6040516102559190611cde565b60405180910390f35b6102666108dd565b005b610270610965565b60405161027d9190611bc8565b60405180910390f35b61028e61098f565b60405161029b9190611b02565b60405180910390f35b6102be60048036038101906102b99190611d25565b610a21565b005b6102da60048036038101906102d59190611e9a565b610a37565b005b6102f660048036038101906102f19190611b5a565b610a99565b6040516103039190611b02565b60405180910390f35b61032660048036038101906103219190611f1d565b610b40565b6040516103339190611a4e565b60405180910390f35b61035660048036038101906103519190611ca2565b610bd4565b005b60007f80ac58cd000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061042357507f5b5e139f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80610433575061043282610ccc565b5b9050919050565b60606000805461044990611f8c565b80601f016020809104026020016040519081016040528092919081815260200182805461047590611f8c565b80156104c25780601f10610497576101008083540402835291602001916104c2565b820191906000526020600020905b8154815290600101906020018083116104a557829003601f168201915b5050505050905090565b60006104d782610d36565b610516576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161050d90612030565b60405180910390fd5b6004600083815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b600061055c82610773565b90508073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156105cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c4906120c2565b60405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff166105ec610da2565b73ffffffffffffffffffffffffffffffffffffffff16148061061b575061061a81610615610da2565b610b40565b5b61065a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161065190612154565b60405180910390fd5b6106648383610daa565b505050565b61067a610674610da2565b82610e63565b6106b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106b0906121e6565b60405180910390fd5b6106c4838383610f41565b505050565b6106d1610da2565b73ffffffffffffffffffffffffffffffffffffffff166106ef610965565b73ffffffffffffffffffffffffffffffffffffffff1614610745576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161073c90612252565b60405180910390fd5b61074f828261119d565b5050565b61076e83838360405180602001604052806000815250610a37565b505050565b6000806002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561081c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610813906122e4565b60405180910390fd5b80915050919050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610896576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161088d90612376565b60405180910390fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6108e5610da2565b73ffffffffffffffffffffffffffffffffffffffff16610903610965565b73ffffffffffffffffffffffffffffffffffffffff1614610959576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161095090612252565b60405180910390fd5b61096360006111bb565b565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60606001805461099e90611f8c565b80601f01602080910402602001604051908101604052809291908181526020018280546109ca90611f8c565b8015610a175780601f106109ec57610100808354040283529160200191610a17565b820191906000526020600020905b8154815290600101906020018083116109fa57829003601f168201915b5050505050905090565b610a33610a2c610da2565b8383611281565b5050565b610a48610a42610da2565b83610e63565b610a87576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a7e906121e6565b60405180910390fd5b610a93848484846113ee565b50505050565b6060610aa482610d36565b610ae3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ada90612408565b60405180910390fd5b6000610aed61144a565b90506000815111610b0d5760405180602001604052806000815250610b38565b80610b1784611461565b604051602001610b28929190612464565b6040516020818303038152906040525b915050919050565b6000600560008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610bdc610da2565b73ffffffffffffffffffffffffffffffffffffffff16610bfa610965565b73ffffffffffffffffffffffffffffffffffffffff1614610c50576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c4790612252565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415610cc0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610cb7906124fa565b60405180910390fd5b610cc9816111bb565b50565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60008073ffffffffffffffffffffffffffffffffffffffff166002600084815260200190815260200160002060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614159050919050565b600033905090565b816004600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16610e1d83610773565b73ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610e6e82610d36565b610ead576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ea49061258c565b60405180910390fd5b6000610eb883610773565b90508073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161480610f2757508373ffffffffffffffffffffffffffffffffffffffff16610f0f846104cc565b73ffffffffffffffffffffffffffffffffffffffff16145b80610f385750610f378185610b40565b5b91505092915050565b8273ffffffffffffffffffffffffffffffffffffffff16610f6182610773565b73ffffffffffffffffffffffffffffffffffffffff1614610fb7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fae9061261e565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611027576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161101e906126b0565b60405180910390fd5b6110328383836115c2565b61103d600082610daa565b6001600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600082825461108d91906126ff565b925050819055506001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546110e49190612733565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6111b78282604051806020016040528060008152506115c7565b5050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b8173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156112f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112e7906127d5565b60405180910390fd5b80600560008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31836040516113e19190611a4e565b60405180910390a3505050565b6113f9848484610f41565b61140584848484611622565b611444576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161143b90612867565b60405180910390fd5b50505050565b606060405180602001604052806000815250905090565b606060008214156114a9576040518060400160405280600181526020017f300000000000000000000000000000000000000000000000000000000000000081525090506115bd565b600082905060005b600082146114db5780806114c490612887565b915050600a826114d491906128ff565b91506114b1565b60008167ffffffffffffffff8111156114f7576114f6611d6f565b5b6040519080825280601f01601f1916602001820160405280156115295781602001600182028036833780820191505090505b5090505b600085146115b65760018261154291906126ff565b9150600a856115519190612930565b603061155d9190612733565b60f81b81838151811061157357611572612961565b5b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600a856115af91906128ff565b945061152d565b8093505050505b919050565b505050565b6115d183836117b9565b6115de6000848484611622565b61161d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161161490612867565b60405180910390fd5b505050565b60006116438473ffffffffffffffffffffffffffffffffffffffff16611987565b156117ac578373ffffffffffffffffffffffffffffffffffffffff1663150b7a0261166c610da2565b8786866040518563ffffffff1660e01b815260040161168e94939291906129e5565b602060405180830381600087803b1580156116a857600080fd5b505af19250505080156116d957506040513d601f19601f820116820180604052508101906116d69190612a46565b60015b61175c573d8060008114611709576040519150601f19603f3d011682016040523d82523d6000602084013e61170e565b606091505b50600081511415611754576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161174b90612867565b60405180910390fd5b805181602001fd5b63150b7a0260e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149150506117b1565b600190505b949350505050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415611829576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161182090612abf565b60405180910390fd5b61183281610d36565b15611872576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161186990612b2b565b60405180910390fd5b61187e600083836115c2565b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546118ce9190612733565b92505081905550816002600083815260200190815260200160002060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550808273ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a45050565b600080823b905060008111915050919050565b6000604051905090565b600080fd5b600080fd5b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6119e3816119ae565b81146119ee57600080fd5b50565b600081359050611a00816119da565b92915050565b600060208284031215611a1c57611a1b6119a4565b5b6000611a2a848285016119f1565b91505092915050565b60008115159050919050565b611a4881611a33565b82525050565b6000602082019050611a636000830184611a3f565b92915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015611aa3578082015181840152602081019050611a88565b83811115611ab2576000848401525b50505050565b6000601f19601f8301169050919050565b6000611ad482611a69565b611ade8185611a74565b9350611aee818560208601611a85565b611af781611ab8565b840191505092915050565b60006020820190508181036000830152611b1c8184611ac9565b905092915050565b6000819050919050565b611b3781611b24565b8114611b4257600080fd5b50565b600081359050611b5481611b2e565b92915050565b600060208284031215611b7057611b6f6119a4565b5b6000611b7e84828501611b45565b91505092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611bb282611b87565b9050919050565b611bc281611ba7565b82525050565b6000602082019050611bdd6000830184611bb9565b92915050565b611bec81611ba7565b8114611bf757600080fd5b50565b600081359050611c0981611be3565b92915050565b60008060408385031215611c2657611c256119a4565b5b6000611c3485828601611bfa565b9250506020611c4585828601611b45565b9150509250929050565b600080600060608486031215611c6857611c676119a4565b5b6000611c7686828701611bfa565b9350506020611c8786828701611bfa565b9250506040611c9886828701611b45565b9150509250925092565b600060208284031215611cb857611cb76119a4565b5b6000611cc684828501611bfa565b91505092915050565b611cd881611b24565b82525050565b6000602082019050611cf36000830184611ccf565b92915050565b611d0281611a33565b8114611d0d57600080fd5b50565b600081359050611d1f81611cf9565b92915050565b60008060408385031215611d3c57611d3b6119a4565b5b6000611d4a85828601611bfa565b9250506020611d5b85828601611d10565b9150509250929050565b600080fd5b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b611da782611ab8565b810181811067ffffffffffffffff82111715611dc657611dc5611d6f565b5b80604052505050565b6000611dd961199a565b9050611de58282611d9e565b919050565b600067ffffffffffffffff821115611e0557611e04611d6f565b5b611e0e82611ab8565b9050602081019050919050565b82818337600083830152505050565b6000611e3d611e3884611dea565b611dcf565b905082815260208101848484011115611e5957611e58611d6a565b5b611e64848285611e1b565b509392505050565b600082601f830112611e8157611e80611d65565b5b8135611e91848260208601611e2a565b91505092915050565b60008060008060808587031215611eb457611eb36119a4565b5b6000611ec287828801611bfa565b9450506020611ed387828801611bfa565b9350506040611ee487828801611b45565b925050606085013567ffffffffffffffff811115611f0557611f046119a9565b5b611f1187828801611e6c565b91505092959194509250565b60008060408385031215611f3457611f336119a4565b5b6000611f4285828601611bfa565b9250506020611f5385828601611bfa565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680611fa457607f821691505b60208210811415611fb857611fb7611f5d565b5b50919050565b7f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b600061201a602c83611a74565b915061202582611fbe565b604082019050919050565b600060208201905081810360008301526120498161200d565b9050919050565b7f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560008201527f7200000000000000000000000000000000000000000000000000000000000000602082015250565b60006120ac602183611a74565b91506120b782612050565b604082019050919050565b600060208201905081810360008301526120db8161209f565b9050919050565b7f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760008201527f6e6572206e6f7220617070726f76656420666f7220616c6c0000000000000000602082015250565b600061213e603883611a74565b9150612149826120e2565b604082019050919050565b6000602082019050818103600083015261216d81612131565b9050919050565b7f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f60008201527f776e6572206e6f7220617070726f766564000000000000000000000000000000602082015250565b60006121d0603183611a74565b91506121db82612174565b604082019050919050565b600060208201905081810360008301526121ff816121c3565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061223c602083611a74565b915061224782612206565b602082019050919050565b6000602082019050818103600083015261226b8161222f565b9050919050565b7f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460008201527f656e7420746f6b656e0000000000000000000000000000000000000000000000602082015250565b60006122ce602983611a74565b91506122d982612272565b604082019050919050565b600060208201905081810360008301526122fd816122c1565b9050919050565b7f4552433732313a2062616c616e636520717565727920666f7220746865207a6560008201527f726f206164647265737300000000000000000000000000000000000000000000602082015250565b6000612360602a83611a74565b915061236b82612304565b604082019050919050565b6000602082019050818103600083015261238f81612353565b9050919050565b7f4552433732314d657461646174613a2055524920717565727920666f72206e6f60008201527f6e6578697374656e7420746f6b656e0000000000000000000000000000000000602082015250565b60006123f2602f83611a74565b91506123fd82612396565b604082019050919050565b60006020820190508181036000830152612421816123e5565b9050919050565b600081905092915050565b600061243e82611a69565b6124488185612428565b9350612458818560208601611a85565b80840191505092915050565b60006124708285612433565b915061247c8284612433565b91508190509392505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006124e4602683611a74565b91506124ef82612488565b604082019050919050565b60006020820190508181036000830152612513816124d7565b9050919050565b7f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860008201527f697374656e7420746f6b656e0000000000000000000000000000000000000000602082015250565b6000612576602c83611a74565b91506125818261251a565b604082019050919050565b600060208201905081810360008301526125a581612569565b9050919050565b7f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960008201527f73206e6f74206f776e0000000000000000000000000000000000000000000000602082015250565b6000612608602983611a74565b9150612613826125ac565b604082019050919050565b60006020820190508181036000830152612637816125fb565b9050919050565b7f4552433732313a207472616e7366657220746f20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b600061269a602483611a74565b91506126a58261263e565b604082019050919050565b600060208201905081810360008301526126c98161268d565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061270a82611b24565b915061271583611b24565b925082821015612728576127276126d0565b5b828203905092915050565b600061273e82611b24565b915061274983611b24565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561277e5761277d6126d0565b5b828201905092915050565b7f4552433732313a20617070726f766520746f2063616c6c657200000000000000600082015250565b60006127bf601983611a74565b91506127ca82612789565b602082019050919050565b600060208201905081810360008301526127ee816127b2565b9050919050565b7f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560008201527f63656976657220696d706c656d656e7465720000000000000000000000000000602082015250565b6000612851603283611a74565b915061285c826127f5565b604082019050919050565b6000602082019050818103600083015261288081612844565b9050919050565b600061289282611b24565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8214156128c5576128c46126d0565b5b600182019050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061290a82611b24565b915061291583611b24565b925082612925576129246128d0565b5b828204905092915050565b600061293b82611b24565b915061294683611b24565b925082612956576129556128d0565b5b828206905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081519050919050565b600082825260208201905092915050565b60006129b782612990565b6129c1818561299b565b93506129d1818560208601611a85565b6129da81611ab8565b840191505092915050565b60006080820190506129fa6000830187611bb9565b612a076020830186611bb9565b612a146040830185611ccf565b8181036060830152612a2681846129ac565b905095945050505050565b600081519050612a40816119da565b92915050565b600060208284031215612a5c57612a5b6119a4565b5b6000612a6a84828501612a31565b91505092915050565b7f4552433732313a206d696e7420746f20746865207a65726f2061646472657373600082015250565b6000612aa9602083611a74565b9150612ab482612a73565b602082019050919050565b60006020820190508181036000830152612ad881612a9c565b9050919050565b7f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000600082015250565b6000612b15601c83611a74565b9150612b2082612adf565b602082019050919050565b60006020820190508181036000830152612b4481612b08565b905091905056fea2646970667358221220e937e256ff30856feb6f8c6da59117a0a7379de84051f46e807cf4dc18222c2e64736f6c63430008090033 \ No newline at end of file diff --git a/centipede/fixture/events_abi/events.sample.json b/centipede/fixture/events_abi/events.sample.json deleted file mode 100644 index a794bd9..0000000 --- a/centipede/fixture/events_abi/events.sample.json +++ /dev/null @@ -1,58 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "from", - "type": "address" - }, - { - "indexed": false, - "name": "to", - "type": "address" - }, - { - "indexed": false, - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "owner", - "type": "address" - }, - { - "indexed": false, - "name": "approved", - "type": "address" - }, - { - "indexed": false, - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "name": "newContract", - "type": "address" - } - ], - "name": "ContractUpgrade", - "type": "event" - } -] \ No newline at end of file diff --git a/centipede/fixture/smart_contracts/CentipedeERC1155.sol b/centipede/fixture/smart_contracts/CentipedeERC1155.sol deleted file mode 100644 index 56eb8de..0000000 --- a/centipede/fixture/smart_contracts/CentipedeERC1155.sol +++ /dev/null @@ -1,148 +0,0 @@ -///@notice This contract follows ERC1155, only owner can create and mint token -// SPDX-License-Identifier: GPL-2.0 - -pragma solidity ^0.8.0; -import "./openzeppelin-contracts/contracts/token/ERC1155/ERC1155.sol"; -import "./openzeppelin-contracts/contracts/access/Ownable.sol"; -import "./openzeppelin-contracts/contracts/utils/Counters.sol"; - -contract CentipedeERC1155 is ERC1155, Ownable { - using Counters for Counters.Counter; - Counters.Counter private ID; - - bool public paused = false; - string public name; - string public symbol; - - // Mapping from token ID to token URI - mapping(uint256 => string) private idToUri; - - // Mapping from token ID to token supply - mapping(uint256 => uint256) private tokenSupply; - - constructor( - string memory _name, - string memory _symbol, - string memory _uri, - address owner - ) ERC1155(_uri) { - name = _name; - symbol = _symbol; - - transferOwnership(owner); - } - - modifier pausable() { - if (paused) { - revert("Paused"); - } else { - _; - } - } - - /** - * @dev Creates a new NFT type - * @param _cid Content identifier - * @param _data Data to pass if receiver is contract - * @return _id The newly created token ID - */ - function create(string calldata _cid, bytes calldata _data) - external - onlyOwner - returns (uint256 _id) - { - require(bytes(_cid).length > 0, "Err: Missing Content Identifier"); - - _id = _nextId(); - - _mint(msg.sender, _id, 0, _data); - - string memory _uri = _createUri(_cid); - idToUri[_id] = _uri; - - emit URI(_uri, _id); - } - - /** - * @dev Mints an existing NFT type - * @notice Enforces a maximum of 1 minting event per NFT type per account - * @param _account Account to mint NFT to (i.e. the owner) - * @param _id ID (i.e. type) of NFT to mint - * // _signature Verified signature granting _account an NFT - * @param _data Data to pass if receiver is contract - */ - function mint( - address _account, - uint256 _id, - uint256 _amount, - bytes calldata _data - ) public pausable onlyOwner { - require(_exists(_id), "Err: Invalid ID"); - //require(verify(_account, _id, _signature), "Err: Invalid Signature"); - - _mint(_account, _id, _amount, _data); - - tokenSupply[_id] += _amount; - } - - /** - * @dev Batch mints multiple different existing NFT types - * @notice Enforces a maximum of 1 minting event per account per NFT type - * @param _account Account to mint NFT to (i.e. the owner) - * @param _ids IDs of the type of NFT to mint - * @param _data Data to pass if receiver is contract - */ - function batchMint( - address _account, - uint256[] calldata _ids, - uint256 _amount, - bytes[] calldata _data - ) external pausable onlyOwner { - for (uint256 i = 0; i < _ids.length; i++) { - mint(_account, _ids[i], _amount, _data[i]); - } - } - - function _createUri(string memory _cid) - internal - view - returns (string memory _uri) - { - string memory baseUri = super.uri(0); - return string(abi.encodePacked(baseUri, _cid)); - } - - function _nextId() internal returns (uint256 id) { - ID.increment(); - return ID.current(); - } - - function _exists(uint256 _id) internal view returns (bool) { - return (bytes(idToUri[_id]).length > 0); - } - - /** - * @dev Returns the uri of a token given its ID - * @param _id ID of the token to query - * @return uri of the token or an empty string if it does not exist - */ - function uri(uint256 _id) public view override returns (string memory) { - return idToUri[_id]; - } - - /** - * @dev Returns the total quantity for a token ID - * @param _id ID of the token to query - * @return amount of token in existence - */ - function totalSupply(uint256 _id) public view returns (uint256) { - return tokenSupply[_id]; - } - - /** - * @dev Pause or unpause the minting and creation of NFTs - */ - function pause() public onlyOwner { - paused = !paused; - } -} diff --git a/centipede/fixture/smart_contracts/CentipedeERC20.sol b/centipede/fixture/smart_contracts/CentipedeERC20.sol deleted file mode 100644 index 18110eb..0000000 --- a/centipede/fixture/smart_contracts/CentipedeERC20.sol +++ /dev/null @@ -1,24 +0,0 @@ -///@notice This contract follows ERC20, only owner can mint new tokens -// SPDX-License-Identifier: GPL-2.0 -pragma solidity ^0.8.0; - -import "./openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; -import "./openzeppelin-contracts/contracts/access/Ownable.sol"; - -contract CentipedeERC20 is ERC20, Ownable { - constructor( - string memory name_, - string memory symbol_, - address owner - ) ERC20(name_, symbol_) { - transferOwnership(owner); - } - - function mint(address account, uint256 amount) public onlyOwner { - _mint(account, amount); - } - - function decimals() public view virtual override returns (uint8) { - return 0; - } -} diff --git a/centipede/fixture/smart_contracts/CentipedeERC721.sol b/centipede/fixture/smart_contracts/CentipedeERC721.sol deleted file mode 100644 index a3e6374..0000000 --- a/centipede/fixture/smart_contracts/CentipedeERC721.sol +++ /dev/null @@ -1,20 +0,0 @@ -///@notice This contract follows ERC20, only owner can mint new tokens -// SPDX-License-Identifier: GPL-2.0 -pragma solidity ^0.8.0; - -import "./openzeppelin-contracts/contracts/token/ERC721/ERC721.sol"; -import "./openzeppelin-contracts/contracts/access/Ownable.sol"; - -contract CentipedeERC721 is ERC721, Ownable { - constructor( - string memory name_, - string memory symbol_, - address owner - ) ERC721(name_, symbol_) { - transferOwnership(owner); - } - - function mint(address to, uint256 tokenId) public onlyOwner { - _safeMint(to, tokenId); - } -} diff --git a/centipede/fixture/smart_contracts/Greeter.sol b/centipede/fixture/smart_contracts/Greeter.sol deleted file mode 100644 index c6bad8f..0000000 --- a/centipede/fixture/smart_contracts/Greeter.sol +++ /dev/null @@ -1,21 +0,0 @@ - pragma solidity >0.5.0; - - contract Greeter { - string public greeting; - - constructor() public { - greeting = 'Hello'; - } - - function setGreeting(string memory _greeting) public returns (string memory){ - greeting = _greeting; - return greeting; - } - - function greet() view public returns (string memory) { - return greeting; - } - function pr_greet() view private returns (string memory) { - return greeting; - } - } \ No newline at end of file diff --git a/centipede/fixture/smart_contracts/compile.sh b/centipede/fixture/smart_contracts/compile.sh deleted file mode 100755 index 6d31674..0000000 --- a/centipede/fixture/smart_contracts/compile.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env sh -#shitty script that compiles smart contract with solc -#and puts bytecode to ../bytecodes and abi to ../abis folder -tempdir="$(mktemp -d)" -solc --abi --bin $1 -o "$tempdir" -filename=${1%.*} -cp "$tempdir/$filename.bin" "../bytecodes/" -cp "$tempdir/$filename.abi" "../abis/$filename.json" -rm $tempdir -r \ No newline at end of file diff --git a/centipede/fixture/smart_contracts/openzeppelin-contracts b/centipede/fixture/smart_contracts/openzeppelin-contracts deleted file mode 160000 index 2b046d7..0000000 --- a/centipede/fixture/smart_contracts/openzeppelin-contracts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2b046d79e1a20b6e108e0675f7a08bfd76808993 diff --git a/centipede/generator.py b/centipede/generator.py deleted file mode 100644 index a12f98d..0000000 --- a/centipede/generator.py +++ /dev/null @@ -1,325 +0,0 @@ -import logging -import os -from typing import Any, Dict, List, Union -import keyword - -import libcst as cst -from web3.types import ABIFunction - -from .version import CENTIPEDE_VERSION - -CONTRACT_TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), "contract.py.template") -try: - with open(CONTRACT_TEMPLATE_PATH, "r") as ifp: - INTERFACE_FILE_TEMPLATE = ifp.read() -except Exception as e: - logging.warn( - f"WARNING: Could not load reporter template from {CONTRACT_TEMPLATE_PATH}:" - ) - logging.warn(e) - -CLI_TEMPLATE_PATH = os.path.join(os.path.dirname(__file__), "cli.py.template") -try: - with open(CLI_TEMPLATE_PATH, "r") as ifp: - CLI_FILE_TEMPLATE = ifp.read() -except Exception as e: - logging.warn(f"WARNING: Could not load reporter template from {CLI_TEMPLATE_PATH}:") - logging.warn(e) - - -def make_annotation(types: list): - if len(types) == 1: - return cst.Annotation(annotation=cst.Name(types[0])) - union_slice = [] - for _type in types: - union_slice.append( - cst.SubscriptElement( - slice=cst.Index( - value=cst.Name(_type), - ) - ), - ) - return cst.Annotation( - annotation=cst.Subscript(value=cst.Name("Union"), slice=union_slice) - ) - - -def normalize_abi_name(name: str) -> str: - if keyword.iskeyword(name): - return name + "_" - else: - return name - - -def python_type(evm_type: str) -> List[str]: - if evm_type.startswith(("uint", "int")): - return ["int"] - elif evm_type.startswith("bytes"): - return ["bytes"] - elif evm_type == "string": - return ["str"] - elif evm_type == "address": - return ["ChecksumAddress"] - elif evm_type == "bool": - return ["bool"] - else: - raise ValueError(f"Cannot convert to python type {evm_type}") - - -def generate_contract_class( - abi: List[Dict[str, Any]], -) -> cst.ClassDef: - class_name = "Contract" - class_constructor = cst.FunctionDef( - name=cst.Name("__init__"), - body=cst.IndentedBlock( - body=[ - cst.parse_statement("self.web3 = web3"), - cst.parse_statement("self.address = contract_address"), - cst.parse_statement( - "self.contract = web3.eth.contract(address=self.address, abi=CONTRACT_ABI)" - ), - ] - ), - params=cst.Parameters( - params=[ - cst.Param(name=cst.Name("self")), - cst.Param( - name=cst.Name("web3"), - annotation=cst.Annotation(annotation=cst.Name("Web3")), - ), - cst.Param( - name=cst.Name("contract_address"), - annotation=make_annotation(["Address", "ChecksumAddress"]), - ), - ] - ), - ) - contract_constructor = [c for c in abi if c["type"] == "constructor"][0] - contract_constructor["name"] = "constructor" - class_functions = ( - [class_constructor] - + [generate_contract_constructor_function(contract_constructor)] - + [ - generate_contract_function(function) - for function in abi - if function["type"] == "function" - ] - ) - return cst.ClassDef( - name=cst.Name(class_name), body=cst.IndentedBlock(body=class_functions) - ) - - -def generate_contract_constructor_function( - func_object: Union[Dict[str, Any], int] -) -> cst.FunctionDef: - default_param_name = "arg" - default_counter = 1 - func_params = [] - - param_names = [] - for param in func_object["inputs"]: - param_name = normalize_abi_name(param["name"]) - if param_name == "": - param_name = f"{default_param_name}{default_counter}" - default_counter += 1 - param_type = make_annotation(python_type(param["type"])) - param_names.append(param_name) - func_params.append( - cst.Param( - name=cst.Name(value=param_name), - annotation=param_type, - ) - ) - func_raw_name = normalize_abi_name(func_object["name"]) - func_name = cst.Name(func_raw_name) - - proxy_call_code = f"return ContractConstructor({','.join(param_names)})" - func_body = cst.IndentedBlock(body=[cst.parse_statement(proxy_call_code)]) - func_returns = cst.Annotation(annotation=cst.Name(value="ContractConstructor")) - - return cst.FunctionDef( - name=func_name, - decorators=[cst.Decorator(decorator=cst.Name("staticmethod"))], - params=cst.Parameters(params=func_params), - body=func_body, - returns=func_returns, - ) - - -def generate_contract_function( - func_object: Union[Dict[str, Any], int] -) -> cst.FunctionDef: - - default_param_name = "arg" - default_counter = 1 - func_params = [] - func_params.append(cst.Param(name=cst.Name("self"))) - - param_names = [] - for param in func_object["inputs"]: - param_name = normalize_abi_name(param["name"]) - if param_name == "": - param_name = f"{default_param_name}{default_counter}" - default_counter += 1 - param_type = make_annotation(python_type(param["type"])) - param_names.append(param_name) - func_params.append( - cst.Param( - name=cst.Name(value=param_name), - annotation=param_type, - ) - ) - func_raw_name = normalize_abi_name(func_object["name"]) - func_name = cst.Name(func_raw_name) - - proxy_call_code = ( - f"return self.contract.functions.{func_raw_name}({','.join(param_names)})" - ) - func_body = cst.IndentedBlock(body=[cst.parse_statement(proxy_call_code)]) - func_returns = cst.Annotation(annotation=cst.Name(value="ContractFunction")) - - return cst.FunctionDef( - name=func_name, - params=cst.Parameters(params=func_params), - body=func_body, - returns=func_returns, - ) - - -def generate_argument_parser_function(abi: Dict[str, Any]) -> cst.FunctionDef: - def generate_function_subparser( - function_abi: ABIFunction, - description: str, - ) -> List[cst.SimpleStatementLine]: - function_name = normalize_abi_name(function_abi["name"]) - subparser_init = [ - cst.parse_statement( - f'{function_name}_call = call_subcommands.add_parser("{function_name}", description="{description}")' - ), - cst.parse_statement( - f'{function_name}_transact = transact_subcommands.add_parser("{function_name}", description="{description}")' - ), - ] - argument_parsers = [] - # TODO(yhtiyar): Functions can have the same name, we will need to ressolve it - default_arg_counter = 1 - for arg in function_abi["inputs"]: - arg_name = normalize_abi_name(arg["name"]) - if arg_name == "": - arg_name = f"arg{default_arg_counter}" - default_arg_counter += 1 - argument_parsers.append( - cst.parse_statement( - f'{function_name}_call.add_argument("{arg_name}", help="Type:{arg["type"]}")' - ) - ) - argument_parsers.append( - cst.parse_statement( - f'{function_name}_transact.add_argument("{arg_name}", help="Type:{arg["type"]}")' - ) - ) - - return ( - subparser_init - + argument_parsers - + [ - cst.parse_statement( - f"populate_subparser_with_common_args({function_name}_call)" - ), - cst.parse_statement( - f"populate_subparser_with_common_args({function_name}_transact)" - ), - cst.EmptyLine(), - ] - ) - - parser_init = [ - cst.parse_statement( - f'parser = argparse.ArgumentParser(description="Your smart contract cli")' - ), - cst.parse_statement( - f'subcommands = parser.add_subparsers(dest="subcommand", required=True)' - ), - cst.parse_statement( - f'call = subcommands.add_parser("call",description="Call smart contract function")' - ), - cst.parse_statement( - f'call_subcommands = call.add_subparsers(dest="function_name", required=True)' - ), - cst.parse_statement( - f'transact = subcommands.add_parser("transact",description="Make transaction to smart contract function")' - ), - cst.parse_statement( - f'transact_subcommands = transact.add_subparsers(dest="function_name", required=True)' - ), - ] - - function_abis = [item for item in abi if item["type"] == "function"] - subparsers = [] - for function_abi in function_abis: - subparsers.extend(generate_function_subparser(function_abi, "description")) - - # Deploy argparser: - contract_constructor = [item for item in abi if item["type"] == "constructor"][0] - deploy_argument_parsers = [] - default_arg_counter = 1 - for arg in contract_constructor["inputs"]: - arg_name = normalize_abi_name(arg["name"]) - if arg_name == "": - arg_name = f"arg{default_arg_counter}" - default_arg_counter += 1 - deploy_argument_parsers.append( - cst.parse_statement( - f'deploy.add_argument("{arg_name}", help="Type:{arg["type"]}")' - ) - ) - deploy_parser = ( - [ - cst.parse_statement( - 'deploy = subcommands.add_parser("deploy", description="Deploy contract")' - ) - ] - + deploy_argument_parsers - + [cst.parse_statement("populate_deploy_subparser(deploy)")] - ) - return cst.FunctionDef( - name=cst.Name("generate_argument_parser"), - params=cst.Parameters(), - body=cst.IndentedBlock( - body=parser_init - + subparsers - + deploy_parser - + [cst.parse_statement("return parser")] - ), - returns=cst.Annotation( - annotation=cst.Attribute( - value=cst.Name("argparse"), attr=cst.Name("ArgumentParser") - ) - ), - ) - - -def generate_contract_interface_content(abi: Dict[str, Any], abi_file_name: str) -> str: - contract_body = cst.Module(body=[generate_contract_class(abi)]).code - - content = INTERFACE_FILE_TEMPLATE.format( - contract_body=contract_body, - centipede_version=CENTIPEDE_VERSION, - abi_file_name=abi_file_name, - ) - return content - - -def generate_contract_cli_content(abi: Dict[str, Any], abi_file_name: str) -> str: - - cli_body = cst.Module(body=[generate_argument_parser_function(abi)]).code - - content = CLI_FILE_TEMPLATE.format( - cli_content=cli_body, - centipede_version=CENTIPEDE_VERSION, - abi_file_name=abi_file_name, - ) - - return content diff --git a/centipede/manage.py b/centipede/manage.py deleted file mode 100644 index 23bdc2f..0000000 --- a/centipede/manage.py +++ /dev/null @@ -1,93 +0,0 @@ -from typing import Tuple - -from eth_typing.evm import ChecksumAddress -from hexbytes.main import HexBytes -from web3 import Web3 - -from centipede.contracts import ERC1155, ERC20, ERC721, CentipedeContract - -from .web3_util import deploy_contract - - -def _deploy_centipede_token_contract( - web3: Web3, - contract_class: CentipedeContract, - token_name: str, - token_symbol: str, - token_uri: str, - token_owner: ChecksumAddress, - deployer: ChecksumAddress, - deployer_private_key: str, -): - contract_abi = contract_class.abi() - contract_bytecode = contract_class.bytecode() - return deploy_contract( - web3, - contract_bytecode, - contract_abi, - deployer, - deployer_private_key, - [token_name, token_symbol, token_uri, token_owner], - ) - - -def deploy_ERC1155( - web3: Web3, - token_name: str, - token_symbol: str, - token_uri: str, - token_owner: ChecksumAddress, - deployer: ChecksumAddress, - deployer_private_key: str, -) -> Tuple[HexBytes, ChecksumAddress]: - return _deploy_centipede_token_contract( - web3, - ERC1155, - token_name, - token_symbol, - token_uri, - token_owner, - deployer, - deployer_private_key, - ) - - -def deploy_ERC20( - web3: Web3, - token_name: str, - token_symbol: str, - token_owner: ChecksumAddress, - deployer: ChecksumAddress, - deployer_private_key: str, -) -> Tuple[HexBytes, ChecksumAddress]: - contract_abi = ERC20.abi() - contract_bytecode = ERC20.bytecode() - return deploy_contract( - web3, - contract_bytecode, - contract_abi, - deployer, - deployer_private_key, - [token_name, token_symbol, token_owner], - ) - - -def deploy_ERC721( - web3: Web3, - token_name: str, - token_symbol: str, - token_uri: str, - token_owner: ChecksumAddress, - deployer: ChecksumAddress, - deployer_private_key: str, -) -> Tuple[HexBytes, ChecksumAddress]: - return _deploy_centipede_token_contract( - web3, - ERC721, - token_name, - token_symbol, - token_uri, - token_owner, - deployer, - deployer_private_key, - ) diff --git a/centipede/tests/__init__.py b/centipede/tests/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/centipede/tests/test_tester_provider.py b/centipede/tests/test_tester_provider.py deleted file mode 100644 index c1ee4b4..0000000 --- a/centipede/tests/test_tester_provider.py +++ /dev/null @@ -1,184 +0,0 @@ -import os -from typing import Tuple -import unittest - -from eth_typing.evm import ChecksumAddress -from web3 import Web3, EthereumTesterProvider -from ens import ENS - -from centipede.manage import deploy_ERC1155 -from ..web3_util import ( - build_transaction, - decode_transaction_input, - get_nonce, - submit_signed_raw_transaction, - submit_transaction, - wait_for_transaction_receipt, -) - -PK = "0x58d23b55bc9cdce1f18c2500f40ff4ab7245df9a89505e9b1fa4851f623d241d" -PK_ADDRESS = "0xdc544d1aa88ff8bbd2f2aec754b1f1e99e1812fd" - - -def get_web3_test_provider() -> Web3: - return Web3(EthereumTesterProvider()) - - -def airdrop_ether(web3: Web3, to_address: ChecksumAddress): - tx_hash = web3.eth.send_transaction( - { - "from": web3.eth.accounts[0], - "to": to_address, - "value": 100000000, - } - ) - web3.eth.wait_for_transaction_receipt(tx_hash) - - -class CentipedeEthTesterTestCase(unittest.TestCase): - def setUp(self) -> None: - self.basedir = os.path.dirname(os.path.dirname(__file__)) - self.web3 = get_web3_test_provider() - self.tester_address = Web3.toChecksumAddress(PK_ADDRESS) - self.tester_address_pk = PK - airdrop_ether(self.web3, self.tester_address) - - def check_eth_send( - self, - sender_previous_balance, - receiver_previous_balance, - sender_current_balance, - receiver_current_balance, - send_value, - tx_receipt, - ): - - assert receiver_current_balance == receiver_previous_balance + send_value - assert ( - sender_current_balance - == sender_previous_balance - send_value - tx_receipt["gasUsed"] - ) - - def test_submit_transaction(self) -> None: - - sender = Web3.toChecksumAddress(PK_ADDRESS) - self.web3.eth.send_transaction - receiver = Web3.toChecksumAddress(self.web3.eth.accounts[1]) - - sender_previous_balance = self.web3.eth.get_balance(sender) - receiver_previous_balance = self.web3.eth.get_balance(receiver) - send_value = 10 - transaction = { - "from": sender, - "to": receiver, - "value": send_value, - "nonce": get_nonce(self.web3, sender), - "gasPrice": 1, - } - transaction["gas"] = self.web3.eth.estimate_gas(transaction) - - tx_hash = submit_transaction( - self.web3, - transaction, - PK, - ) - tx_receipt = wait_for_transaction_receipt(self.web3, tx_hash) - sender_current_balance = self.web3.eth.get_balance(sender) - receiver_current_balance = self.web3.eth.get_balance(receiver) - self.check_eth_send( - sender_previous_balance, - receiver_previous_balance, - sender_current_balance, - receiver_current_balance, - send_value, - tx_receipt, - ) - - def test_submit_signed_transaction(self) -> None: - - sender = Web3.toChecksumAddress(PK_ADDRESS) - self.web3.eth.send_transaction - receiver = Web3.toChecksumAddress(self.web3.eth.accounts[1]) - - sender_previous_balance = self.web3.eth.get_balance(sender) - receiver_previous_balance = self.web3.eth.get_balance(receiver) - send_value = 10 - - transaction = { - "from": sender, - "to": receiver, - "value": send_value, - "nonce": get_nonce(self.web3, sender), - "gasPrice": 1, - } - transaction["gas"] = self.web3.eth.estimate_gas(transaction) - - signed_transaction = self.web3.eth.account.sign_transaction( - transaction, private_key=PK - ) - - tx_hash = submit_signed_raw_transaction( - self.web3, signed_transaction.rawTransaction - ) - tx_receipt = wait_for_transaction_receipt(self.web3, tx_hash) - sender_current_balance = self.web3.eth.get_balance(sender) - receiver_current_balance = self.web3.eth.get_balance(receiver) - self.check_eth_send( - sender_previous_balance, - receiver_previous_balance, - sender_current_balance, - receiver_current_balance, - send_value, - tx_receipt, - ) - - def test_deploy_erc1155(self): - TOKEN_NAME = "CENTIPEDE-TEST" - TOKEN_SYMBOL = "CNTPD" - TOKEN_URI = "moonstream.to/centipede/" - _, contract_address = deploy_ERC1155( - self.web3, - TOKEN_NAME, - TOKEN_SYMBOL, - TOKEN_URI, - self.tester_address, - self.tester_address, - self.tester_address_pk, - ) - - base_dir = self.basedir - contract_abi_path = os.path.join(base_dir, "fixture/abis/CentipedeERC1155.json") - with open(contract_abi_path, "r") as ifp: - contract_abi = ifp.read() - - contract = self.web3.eth.contract(contract_address, abi=contract_abi) - - assert ( - contract.functions["name"]().call() == TOKEN_NAME - ), "Token name in blockchain != set token name while deploying" - - assert ( - contract.functions["symbol"]().call() == TOKEN_SYMBOL - ), "Token name in blockchain != set token symbol while deploying" - - transaction = build_transaction( - self.web3, contract.functions["create"]("1", b""), self.tester_address - ) - tx_hash = submit_transaction(self.web3, transaction, self.tester_address_pk) - wait_for_transaction_receipt(self.web3, tx_hash) - - assert ( - contract.functions["uri"](1).call() == TOKEN_URI + "1" - ), "Token with id 1 is not created or has different uri from that is expected" - - def test_decode_tx_input(self): - base_dir = self.basedir - contract_abi_path = os.path.join(base_dir, "fixture/abis/CentipedeERC1155.json") - with open(contract_abi_path, "r") as ifp: - contract_abi = ifp.read() - tx_input = "0xf242432a0000000000000000000000004f9a8e7dddee5f9737bafad382fa3bb119fc80c4000000000000000000000000c2485a4a8fbabbb7c39fe7b459816f2f16c238840000000000000000000000000000000000000000000000000000000000000378000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000" - decode_transaction_input(self.web3, tx_input, contract_abi) - - -if __name__ == "__main__": - unittest.main() diff --git a/centipede/tests/test_testnet.py b/centipede/tests/test_testnet.py deleted file mode 100644 index 300b3e9..0000000 --- a/centipede/tests/test_testnet.py +++ /dev/null @@ -1,62 +0,0 @@ -from typing import Tuple -import os -import unittest -from unittest.case import TestCase - -from web3 import Web3 -from eth_typing.evm import ChecksumAddress -from ..manage import deploy_ERC1155 - - -def read_testnet_env_variables() -> Tuple[Web3, ChecksumAddress, str]: - provider_path = os.environ.get("CENTIPEDE_TESTNET_PATH") - if provider_path is None: - raise ValueError("CENTIPEDE_TESTNET_PATH env variable is not set") - raw_address = os.environ.get("CENTIPEDE_TEST_ETHEREUM_ADDRESS") - if raw_address is None: - raise ValueError("CENTIPEDE_TEST_ETHEREUM_ADDRESS env variable is not set") - private_key = os.environ.get("CENTIPEDE_TEST_ETHEREUM_ADDRESS_PRIVATE_KEY") - if raw_address is None: - raise ValueError( - "CENTIPEDE_TEST_ETHEREUM_ADDRESS_PRIVATE_KEY env variable is not set" - ) - return ( - Web3(Web3.HTTPProvider(provider_path)), - Web3.toChecksumAddress(raw_address), - private_key, - ) - - -class CentipedeTestnetTestCase(TestCase): - def setUp(self) -> None: - self.basedir = os.path.dirname(os.path.dirname(__file__)) - try: - ( - self.web3, - self.test_address, - self.test_address_pk, - ) = read_testnet_env_variables() - except Exception as e: - raise unittest.SkipTest(f"Skipping test because of : {str(e)}") - - def _deploy_contract(self) -> ChecksumAddress: - TOKEN_NAME = "CENTIPEDE-TEST" - TOKEN_SYMBOL = "CNTPD" - TOKEN_URI = "moonstream.to/centipede/" - _, contract_address = deploy_ERC1155( - self.web3, - TOKEN_NAME, - TOKEN_SYMBOL, - TOKEN_URI, - self.test_address, - self.test_address, - self.test_address_pk, - ) - return contract_address - - def test_deployment(self) -> None: - contract_address = self._deploy_contract() - - -if __name__ == "__main__": - unittest.main() diff --git a/centipede/version.py b/centipede/version.py deleted file mode 100644 index a36dd71..0000000 --- a/centipede/version.py +++ /dev/null @@ -1 +0,0 @@ -CENTIPEDE_VERSION = "0.0.1" diff --git a/centipede/web3_util.py b/centipede/web3_util.py deleted file mode 100644 index 689dd56..0000000 --- a/centipede/web3_util.py +++ /dev/null @@ -1,167 +0,0 @@ -from dataclasses import dataclass -from typing import Any, Callable, Dict, List, Optional, Tuple -import os -import getpass - -from eth_account.account import Account -from eth_typing.evm import ChecksumAddress -from hexbytes.main import HexBytes -from web3 import Web3, eth -from web3.contract import Contract, ContractFunction -from web3.types import Nonce, TxParams, TxReceipt, Wei - - -class ContractConstructor: - def __init__(self, *args: Any): - self.args = args - - -def build_transaction( - web3: Web3, - builder: ContractFunction, - sender: ChecksumAddress, -) -> Dict[str, Any]: - """ - Builds transaction json with the given arguments. It is not submitting transaction - Arguments: - - web3: Web3 client - - builder: ContractFunction or other class that has method buildTransaction(TxParams) - - sender: `from` value of transaction, address which is sending this transaction - - maxFeePerGas: Optional, max priority fee for dynamic fee transactions in Wei - - maxPriorityFeePerGas: Optional the part of the fee that goes to the miner - """ - transaction = builder.buildTransaction( - { - "from": sender, - "nonce": get_nonce(web3, sender), - } - ) - return transaction - - -def get_nonce(web3: Web3, address: ChecksumAddress) -> Nonce: - """ - Returns Nonce: number of transactions for given address - """ - nonce = web3.eth.get_transaction_count(address) - return nonce - - -def submit_transaction( - web3: Web3, transaction: Dict[str, Any], signer_private_key: str -) -> HexBytes: - """ - Signs and submits json transaction to blockchain from the name of signer - """ - signed_transaction = web3.eth.account.sign_transaction( - transaction, private_key=signer_private_key - ) - return submit_signed_raw_transaction(web3, signed_transaction.rawTransaction) - - -def submit_signed_raw_transaction( - web3: Web3, signed_raw_transaction: HexBytes -) -> HexBytes: - """ - Submits already signed raw transaction. - """ - transaction_hash = web3.eth.send_raw_transaction(signed_raw_transaction) - return transaction_hash - - -def wait_for_transaction_receipt(web3: Web3, transaction_hash: HexBytes): - return web3.eth.wait_for_transaction_receipt(transaction_hash) - - -def deploy_contract( - web3: Web3, - contract_bytecode: str, - contract_abi: Dict[str, Any], - deployer: ChecksumAddress, - deployer_private_key: str, - constructor_arguments: Optional[List[Any]] = None, -) -> Tuple[HexBytes, ChecksumAddress]: - """ - Deploys smart contract to blockchain - Arguments: - - web3: web3 client - - contract_bytecode: Compiled smart contract bytecode - - contract_abi: Json abi of contract. Must include `constructor` function - - deployer: Address which is deploying contract. Deployer will pay transaction fee - - deployer_private_key: Private key of deployer. Needed for signing and submitting transaction - - constructor_arguments: arguments that are passed to `constructor` function of the smart contract - """ - contract = web3.eth.contract(abi=contract_abi, bytecode=contract_bytecode) - transaction = build_transaction( - web3, contract.constructor(*constructor_arguments), deployer - ) - - transaction_hash = submit_transaction(web3, transaction, deployer_private_key) - transaction_receipt = wait_for_transaction_receipt(web3, transaction_hash) - contract_address = transaction_receipt.contractAddress - return transaction_hash, web3.toChecksumAddress(contract_address) - - -def deploy_contract_from_constructor_function( - web3: Web3, - contract_bytecode: str, - contract_abi: Dict[str, Any], - deployer: ChecksumAddress, - deployer_private_key: str, - constructor: ContractConstructor, -) -> Tuple[HexBytes, ChecksumAddress]: - """ - Deploys smart contract to blockchain from constructor ContractFunction - Arguments: - - web3: web3 client - - contract_bytecode: Compiled smart contract bytecode - - contract_abi: Json abi of contract. Must include `constructor` function - - deployer: Address which is deploying contract. Deployer will pay transaction fee - - deployer_private_key: Private key of deployer. Needed for signing and submitting transaction - - constructor:`constructor` function of the smart contract - """ - contract = web3.eth.contract(abi=contract_abi, bytecode=contract_bytecode) - transaction = build_transaction( - web3, contract.constructor(*constructor.args), deployer - ) - - transaction_hash = submit_transaction(web3, transaction, deployer_private_key) - transaction_receipt = wait_for_transaction_receipt(web3, transaction_hash) - contract_address = transaction_receipt.contractAddress - return transaction_hash, web3.toChecksumAddress(contract_address) - - -def decode_transaction_input(web3: Web3, transaction_input: str, abi: Dict[str, Any]): - contract = web3.eth.contract(abi=abi) - return contract.decode_function_input(transaction_input) - - -def read_keys_from_cli() -> Tuple[ChecksumAddress, str]: - private_key = getpass.getpass(prompt="Enter private key of your address:") - account = Account.from_key(private_key) - return (Web3.toChecksumAddress(account.address), private_key) - - -def read_keys_from_env() -> Tuple[ChecksumAddress, str]: - private_key = os.environ.get("CENTIPEDE_ETHEREUM_ADDRESS_PRIVATE_KEY") - if private_key is None: - raise ValueError( - "CENTIPEDE_ETHEREUM_ADDRESS_PRIVATE_KEY env variable is not set" - ) - account = Account.from_key(private_key) - return (Web3.toChecksumAddress(account), private_key) - - -def cast_to_python_type(evm_type: str) -> Callable: - if evm_type.startswith(("uint", "int")): - return int - elif evm_type.startswith("bytes"): - return bytes - elif evm_type == "string": - return str - elif evm_type == "address": - return Web3.toChecksumAddress - elif evm_type == "bool": - return bool - else: - raise ValueError(f"Cannot convert to python type {evm_type}")