Skip to content

Latest commit

 

History

History
134 lines (106 loc) · 3.65 KB

README.md

File metadata and controls

134 lines (106 loc) · 3.65 KB

Subgraph: Contract Creation

Tracks smart contract creation events.

Data Includes

  • Contract Address
  • Creator Deployer & Factory
  • Creator Transaction Hash & Index
  • Contract Code bytecode & Hash
  • Contract Input (init) bytecode

Subgraphs

Chain Subgraph ID Start Block
Ethereum EEWpgBNwW9TzJeHppqyGfRxeK6UuXErg3VVn6EoWjsuc 0
Arbitrum One 6w6xFpTo9HHKYYyL7d4HNDy28bG2fMNBiZLcwymoKwAh 22208966
BNB 7H7M2G2XSLBy7rzWcysC8DpCkEqJQNxMjUKFpgSgMCLc 0
Optimism 7RdSF6qXBh1HPFD9A9QV6UvqKCZhrWCXAsGWnCYaWeWE 105239153

GraphQL

{
  contract_creation(
    orderBy: block_number
    orderDirection: desc
  ) {
    address
    deployer
    code
    code_hash
    from
    to
    factory
    input
    ordinal
    block_hash
    block_number
    block_time
    block_date
    block_month
    transaction_hash
    transaction_index
  }
}

Graph

graph TD;
  map_contract_creation[map: map_contract_creation];
  sf.substreams.v1.Clock[source: sf.substreams.v1.Clock] --> map_contract_creation;
  block_index:map_block_index --> map_contract_creation;
  graph_out[map: graph_out];
  map_contract_creation --> graph_out;
  block_index:map_block_index[map: block_index:map_block_index];
  sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> block_index:map_block_index;
Loading

Modules

Name: map_contract_creation
Initial block: 0
Kind: map
Input: source: sf.substreams.v1.Clock
Input: map: block_index:map_block_index
Output Type: proto:contract_creation.v1.Events
Hash: a003944925bdeca9470fd20078f042e158a1191c

Name: graph_out
Initial block: 0
Kind: map
Input: map: map_contract_creation
Output Type: proto:sf.substreams.sink.entity.v1.EntityChanges
Hash: 1a168932f997af5283526d4bf56cc2311649818c

Name: block_index:map_block_index
Initial block: 0
Kind: map
Input: source: sf.ethereum.type.v2.Block
Output Type: proto:sf.ethereum.type.v2.Block
Hash: 6c09d386577f8c62fe1b3f1cf50622bb0f08a48a

Subgraph deployment

graph indexer rules prepare --network arbitrum-one <Qm>
graph indexer allocations create <Qm> arbitrum-one 100

Build

Docker

docker build -t subgraph-contract-creation
docker run -it subgraph-contract-creation

Local

Important

Requires substreams, buf and graph CLIs installed as well as Rust with wasm32-unknown-unknown target.

make [all]

Contract creation substream

make spkg-build

Contract creation block index

make block-index

Subgraphs

make subgraph-build-[mainnet|...|all]