fetch_contract_deployment_block

Documentation for eth_defi.tokenised_fund.securitize.backfill.fetch_contract_deployment_block function.

fetch_contract_deployment_block(web3, address, end_block)

Find the first block where an address has deployed contract code.

The reviewed DSToken registry does not duplicate a manually maintained creation-block list. An archive-node binary search yields the first code block in logarithmic RPC calls and remains correct when a new product is added to the registry.

Parameters
  • web3 (web3.main.Web3) – Archive-capable connection for the product chain.

  • address (eth_typing.evm.HexAddress) – DSToken proxy address.

  • end_block (int) – Highest block that may be inspected.

Returns

First block with non-empty runtime code.

Raises

ValueError – If the address has no contract code at end_block.

Return type

int