diff --git a/README.md b/README.md index 5162b12..26fe119 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,14 @@ pip install web3 tqdm The Ghost Preclaim Snapshot Tool provides a straightforward command-line interface for collecting NFT snapshot data across multiple blockchain networks. Before running the tool, ensure you have properly configured your environment with the necessary RPC endpoints and network access credentials. ```bash -usage: finder.py [-h] --rpc RPC [--bonus BONUS] [--delay DELAY] +usage: finder.py [-h] --rpc RPC [--block BLOCK] [--bonus BONUS] [--delay DELAY] EVM NFT Snapshot Collector for Ghostchain Preclaims options: -h, --help show this help message and exit --rpc RPC EVM JSON-RPC Node URL + --block BLOCK Target block number or 'latest' (default: latest) --bonus BONUS Additional JML ownership amounton top of the collateral (default: 6.9 CSPR) --delay DELAY Delay between RPC requests in seconds (default: 0.3) ``` diff --git a/finder.py b/finder.py index ee6167c..115f555 100644 --- a/finder.py +++ b/finder.py @@ -12,7 +12,8 @@ GMV_ADDRESS = "0x7EF911f8ef130F73D166468c0068753932357B17" def parse_arguments(): parser = argparse.ArgumentParser(description="EVM NFT Snapshot Collector for Ghostchain Preclaims") parser.add_argument("--rpc", required=True, help="EVM JSON-RPC Node URL") - parser.add_argument("--bonus", default=6900000000000000000, help="Additional JML ownership amounton top of the collateral (default: 6.9 CSPR)") + parser.add_argument("--block", default="latest", help="Target block number or 'latest' (default: latest)") + parser.add_argument("--bonus", type=int, default=6900000000000000000, help="Additional JML ownership amounton top of the collateral (default: 6.9 CSPR)") parser.add_argument("--delay", type=float, default=0.3, help="Delay between RPC requests in seconds (default: 0.3)") return parser.parse_args() @@ -75,8 +76,11 @@ def main(): chain_id = w3.eth.chain_id print(f"[+] Successfully connected to [{chain_id}] over {args.rpc}.") + target_block = int(args.block) if args.block.isdigit() else args.block + print(f"[+] Snapshot target block: {target_block}") + contract = get_contract_instance(w3) - total_supply = contract.functions.totalSupply().call() + total_supply = contract.functions.totalSupply().call(block_identifier=target_block) print(f"[+] Current totalSupply: {total_supply}") time.sleep(args.delay) @@ -93,9 +97,9 @@ def main(): current_index = len(snapshot) for token_id in tqdm(range(start_token_id, total_supply), desc=f"Scanning {chain_id}"): try: - owner = contract.functions.ownerOf(token_id).call() + owner = contract.functions.ownerOf(token_id).call(block_identifier=target_block) time.sleep(args.delay) - shares = contract.functions.collateralBalances(token_id, GMV_ADDRESS).call() + shares = contract.functions.collateralBalances(token_id, GMV_ADDRESS).call(block_identifier=target_block) time.sleep(args.delay) snapshot.append({