Releases: pinax-network/subgraph-contract-creation
v0.3.0
What's Changed
- add Subgraph
optimism
network - remove
db_out
map modules (in favour of usingsink-files
for SQL support) - FIX:
.header
toblock-index
(was causing issues withsink-files
) - Add
Result<>
to map modules - Add additional fields to map event protobuf
- transaction hash & index
- block_month
- from/to/deployer/factory
- code_hash
- input
Protobuf
syntax = "proto3";
package contract_creation.v1;
import "google/protobuf/timestamp.proto";
message Events {
repeated ContractCreation contract_creations = 1;
}
message ContractCreation {
// -- block --
google.protobuf.Timestamp block_time = 1;
string block_hash = 2;
uint64 block_number = 3;
string block_date = 4;
string block_month = 5;
// -- transaction --
string transaction_hash = 6;
uint32 transaction_index = 7;
// -- contract creation --
uint64 ordinal = 8; // The block's global ordinal when the code change was recorded, refer to [Block] documentation for further information about ordinals and total ordering.
string address = 9;
string from = 10;
string to = 11;
string deployer = 12; // The address of the account that deployed the contract.
optional string factory = 13;
optional string code = 14;
optional string code_hash = 15;
optional string input = 16;
}
v0.2.2
- add
Optimism
network to./subgraphs
- add
init
field to map events
message ContractCreation {
// block
string block_hash = 1;
uint64 block_number = 2;
int64 block_time = 3;
string block_date = 4;
// contract creation
string contract_address = 5;
string creator_address = 6;
string creator_factory = 7;
string creator_tx = 8;
optional string code = 9;
optional string init = 10;
}
v0.2.1
- Add
block-index
to improve caching performance (still needs to cache once)
Subgraph: Contract Creation
This function will filter out all the transaction traces that are not contract creations.
Improves Substreams caching performance by reducing the amount of bytes that needs to be read.
How to use?
Upate your substreams.yaml
with the following:
imports:
block_index: ./block-index/contract-creation-block-index-v0.2.0.spkg
modules:
- name: map_contract_creation
kind: map
inputs:
- source: sf.substreams.v1.Clock
- map: block_index:map_block_index
output :
type: proto:contract_creation.v1.Events
v0.2.0
Package name: evm_contract_creation_tracker
Version: v0.2.0
Doc: Tracking contract creation information
Modules
graph TD;
map_contract_creation[map: map_contract_creation];
sf.ethereum.type.v2.Block[source: sf.ethereum.type.v2.Block] --> map_contract_creation;
db_out[map: db_out];
map_contract_creation --> db_out;
graph_out[map: graph_out];
map_contract_creation --> graph_out;
Name: map_contract_creation
Initial block: 0
Kind: map
Input: source: sf.ethereum.type.v2.Block Output Type:
proto:EVMContractCreation.v1.EVMContractCreations`
Hash: 9ddc52c6db2f7c50f5b120621ced8d46f836fc8f
Name: db_out
Initial block: 0
Kind: map
Input: map: map_contract_creation
Output Type: proto:sf.substreams.sink.database.v1.DatabaseChanges
Hash: 48fd36758de82b2d2d296afc4a7763fd7e0a9f79
Name: graph_out
Initial block: 0
Kind: map
Input: map: map_contract_creation
Output Type: proto:sf.substreams.sink.database.v1.EntityChanges
Hash: 5a55c7fa95d9b15053306eb7955a7694e087a979
Protobuf
message ContractCreationInfo {
string block_hash = 1;
uint64 block_number = 2;
uint64 block_timestamp_seconds = 3;
string contract_address = 4;
string creator_address = 5;
string creator_factory = 6;
string creator_tx = 7;
bytes contract_init_bytecode = 8;
bytes contract_bytecode = 9;
}
Full Changelog: v0.1.3...v0.2.0
v0.1.3
Full Changelog: v0.1.2...v0.1.3
v0.1.2
Full Changelog: v0.1.1...v0.1.2
v0.1.1
Tracking EVM contract creation
db_out
{
"@module": "db_out",
"@block": <value>,
"@type": "sf.substreams.sink.database.v1.DatabaseChanges",
"@data": {
"tableChanges": [
{
"table": "contract_creation",
"operation": "OPERATION_CREATE",
"fields": [
{
"name": "block_hash",
"newValue": "<value>"
},
{
"name": "block_number",
"newValue": "<value>"
},
{
"name": "block_timestamp",
"newValue": "<value>"
},
{
"name": "contract_address",
"newValue": "<value>"
},
{
"name": "creator_address",
"newValue": "<value>"
},
{
"name": "creator_tx",
"newValue": "<value>"
},
{
"name": "creation_bytecode",
"newValue": "0x60806040[...]"
}
],
"compositePk": {
"keys": {
"block_hash": "<value>",
"contract_address": "<value>"
}
}
},
]
}
}
Full Changelog: v0.1.0...v0.1.1
v0.1.0
Tracking EVM contract creation
db_out
{
"@module": "db_out",
"@block": <value>,
"@type": "sf.substreams.sink.database.v1.DatabaseChanges",
"@data": {
"tableChanges": [
{
"table": "contract_creation",
"pk": "<value>",
"operation": "OPERATION_CREATE",
"fields": [
{
"name": "block_hash",
"newValue": "<value>"
},
{
"name": "block_number",
"newValue": "<value>"
},
{
"name": "block_timestamp",
"newValue": "<value>"
},
{
"name": "contract_address",
"newValue": "<value>"
},
{
"name": "creator_address",
"newValue": "<value>"
},
{
"name": "creator_tx",
"newValue": "<value>"
},
{
"name": "creation_bytecode",
"newValue": "0x60806040[...]"
}
]
},
]
}
}
graph_out
{
"@module": "graph_out",
"@unknown": "sf.substreams.sink.database.v1.EntityChanges",
"@str": "[...]",
"@bytes": "[...]"
}
Full Changelog: https://github.com/pinax-network/subgraph-contract-creation/commits/v0.1.0