Skip to content

Commit c2a48d1

Browse files
sevenzingaka-yz
andauthored
feat(bens): add story subgraph (#1266)
* commit story tld subgraph * commit story tld subgraph * docker-compose add story rpc * add story config and update settings to disable protocols * update story metadata --------- Co-authored-by: aka-yz <[email protected]>
1 parent ada184b commit c2a48d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+21438
-2
lines changed

blockscout-ens/bens-logic/src/subgraph/reader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ impl SubgraphReader {
102102
.into_iter()
103103
.partition(|protocol_name| protocols.contains_key(protocol_name));
104104
if !unknown_protocols.is_empty() {
105-
tracing::warn!("found unknown protocols for network with id={chain_id}: {unknown_protocols:?}")
105+
tracing::warn!("found unknown or disabled protocols for network with id={chain_id}: {unknown_protocols:?}")
106106
}
107107
(chain_id, Network {
108108
blockscout_client: network.blockscout_client,

blockscout-ens/bens-server/config/dev.json

+33
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,19 @@
5353
"d3-connect-ape-mainnet"
5454
],
5555
"rpc_url": "https://rpc.apechain.com/"
56+
},
57+
"1514": {
58+
"blockscout": {
59+
"url": "https://www.storyscan.xyz/"
60+
},
61+
"use_protocols": [
62+
"story"
63+
]
5664
}
5765
},
5866
"protocols": {
5967
"ens": {
68+
"disabled": true,
6069
"tld_list": [
6170
"eth"
6271
],
@@ -78,6 +87,7 @@
7887
}
7988
},
8089
"ens-sepolia": {
90+
"disabled": true,
8191
"tld_list": ["eth"],
8292
"network_id": 11155111,
8393
"subgraph_name": "ens-sepolia-subgraph",
@@ -97,6 +107,7 @@
97107
}
98108
},
99109
"d3-connect-shib": {
110+
"disabled": true,
100111
"tld_list": ["shib"],
101112
"network_id": 109,
102113
"subgraph_name": "d3-connect-shib-subgraph",
@@ -115,6 +126,7 @@
115126
}
116127
},
117128
"d3-connect-shib-testnet": {
129+
"disabled": true,
118130
"tld_list": ["shib"],
119131
"network_id": 157,
120132
"subgraph_name": "d3-connect-shib-testnet-subgraph",
@@ -133,6 +145,7 @@
133145
}
134146
},
135147
"d3-connect-ape-testnet": {
148+
"disabled": true,
136149
"tld_list": ["ape"],
137150
"network_id": 33111,
138151
"subgraph_name": "d3-connect-ape-testnet-subgraph",
@@ -151,6 +164,7 @@
151164
}
152165
},
153166
"d3-connect-ape-mainnet": {
167+
"disabled": true,
154168
"tld_list": ["ape"],
155169
"network_id": 33139,
156170
"subgraph_name": "d3-connect-ape-mainnet-subgraph",
@@ -167,6 +181,25 @@
167181
"icon_url": "https://i.imgur.com/cD6VIXk.png",
168182
"docs_url": "https://docs.d3.app/"
169183
}
184+
},
185+
"story": {
186+
"disabled": true,
187+
"tld_list": ["ip"],
188+
"network_id": 1514,
189+
"subgraph_name": "story-subgraph",
190+
"address_resolve_technique": "reverse_registry",
191+
"specific": {
192+
"type": "ens_like",
193+
"native_token_contract": "0xff829d3ea4d8f25bf8be2d8774c080a8046cb7e1",
194+
"empty_label_hash": "0x699d90c22b22a5d5d34ff98b3e55748d93f2f4564862200c93b7d5d90b511710"
195+
},
196+
"meta": {
197+
"short_name": "SPACE ID",
198+
"title": "SPACE ID",
199+
"description": "SPACE ID is a universal domain name and identity platform",
200+
"icon_url": "https://i.imgur.com/yYc2C6V.png",
201+
"docs_url": "https://docs.space.id/"
202+
}
170203
}
171204
}
172205
}

blockscout-ens/bens-server/config/prod.json

+26
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@
7373
"ens"
7474
]
7575
},
76+
"1514": {
77+
"blockscout": {
78+
"url": "https://www.storyscan.xyz/"
79+
},
80+
"use_protocols": [
81+
"story"
82+
]
83+
},
7684
"10200": {
7785
"blockscout": {
7886
"url": "https://gnosis-chiado.blockscout.com"
@@ -509,6 +517,24 @@
509517
"icon_url": "https://i.imgur.com/cD6VIXk.png",
510518
"docs_url": "https://docs.d3.app/"
511519
}
520+
},
521+
"story": {
522+
"tld_list": ["ip"],
523+
"network_id": 1514,
524+
"subgraph_name": "story-subgraph",
525+
"address_resolve_technique": "reverse_registry",
526+
"specific": {
527+
"type": "ens_like",
528+
"native_token_contract": "0xff829d3ea4d8f25bf8be2d8774c080a8046cb7e1",
529+
"empty_label_hash": "0x699d90c22b22a5d5d34ff98b3e55748d93f2f4564862200c93b7d5d90b511710"
530+
},
531+
"meta": {
532+
"short_name": "SPACE ID",
533+
"title": "SPACE ID",
534+
"description": "SPACE ID is a universal domain name and identity platform",
535+
"icon_url": "https://i.imgur.com/yYc2C6V.png",
536+
"docs_url": "https://docs.space.id/"
537+
}
512538
}
513539
}
514540
}

blockscout-ens/bens-server/src/server.rs

+1
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub async fn run(settings: Settings) -> Result<(), anyhow::Error> {
9797
.subgraphs_reader
9898
.protocols
9999
.into_iter()
100+
.filter(|(_, p)| !p.disabled)
100101
.map(|(name, p)| {
101102
(
102103
name.clone(),

blockscout-ens/bens-server/src/settings.rs

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ impl Default for SubgraphsReaderSettings {
5757
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)]
5858
#[serde(deny_unknown_fields)]
5959
pub struct ProtocolSettings {
60+
#[serde(default)]
61+
pub disabled: bool,
6062
pub tld_list: NonEmpty<Tld>,
6163
pub network_id: i64,
6264
pub subgraph_name: String,

blockscout-ens/graph-node/config.toml

+8-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,11 @@ shard = "primary"
6060
provider = [
6161
{ label = "ape-testnet", url = "https://curtis.rpc.caldera.xyz/http", features = [] }
6262
]
63-
shard = "primary"
63+
shard = "primary"
64+
65+
[chains.story-mainnet]
66+
provider = [
67+
{ label = "story-mainnet", url = "https://frequent-hidden-telescope.story-mainnet.quiknode.pro/9934ef7bc4e5bcc89ef9768b5ca2f39fcb937c46", features = [] }
68+
]
69+
shard = "primary"
70+

blockscout-ens/graph-node/deployer/config.json

+5
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@
8484
"subgraph_path": "../subgraphs/zns-subgraph",
8585
"subgraph_name": "zns-ink-subgraph",
8686
"network": "ink-mainnet"
87+
},
88+
"story": {
89+
"subgraph_path": "../subgraphs/story-subgraph",
90+
"subgraph_name": "story-subgraph",
91+
"network": "story-mainnet"
8792
}
8893
}
8994
}

blockscout-ens/graph-node/subgraph-writer/protocols/story.yaml

+39
Large diffs are not rendered by default.

blockscout-ens/graph-node/subgraph-writer/templater/{{cookiecutter.short_name}}-subgraph/schema.graphql

+5
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ type Domain @entity {
4343

4444
"The events associated with the domain"
4545
events: [DomainEvent!]! @derivedFrom(field: "domain")
46+
47+
"Is domain stored offchain"
48+
storedOffchain: Boolean!
49+
"Is domain resolved with wildcard"
50+
resolvedWithWildcard: Boolean!
4651
}
4752

4853
interface DomainEvent {

blockscout-ens/graph-node/subgraph-writer/templater/{{cookiecutter.short_name}}-subgraph/src/{{cookiecutter.registry_name}}.ts

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ function createDomain(node: string, timestamp: BigInt): Domain {
2121
domain.isMigrated = true;
2222
domain.createdAt = timestamp;
2323
domain.subdomainCount = 0;
24+
domain.storedOffchain = false;
25+
domain.resolvedWithWildcard = false;
2426
}
2527
return domain;
2628
}
@@ -81,6 +83,8 @@ function _handleNewOwner(event: NewOwnerEvent, isMigrated: boolean): void {
8183
domain = new Domain(subnode);
8284
domain.createdAt = event.block.timestamp;
8385
domain.subdomainCount = 0;
86+
domain.storedOffchain = false;
87+
domain.resolvedWithWildcard = false;
8488
}
8589

8690
if (domain.parent === null && parent !== null) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Graph cli generated
2+
.docker
3+
generated
4+
build/
5+
.DS_STORE
6+
data
7+
# Logs
8+
logs
9+
*.log
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Built output
15+
dist
16+
17+
# Runtime data
18+
pids
19+
*.pid
20+
*.seed
21+
*.pid.lock
22+
23+
# Directory for instrumented libs generated by jscoverage/JSCover
24+
lib-cov
25+
26+
# Coverage directory used by tools like istanbul
27+
coverage
28+
29+
# nyc test coverage
30+
.nyc_output
31+
32+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
33+
.grunt
34+
35+
# Bower dependency directory (https://bower.io/)
36+
bower_components
37+
38+
# node-waf configuration
39+
.lock-wscript
40+
41+
# Compiled binary addons (https://nodejs.org/api/addons.html)
42+
build/Release
43+
44+
# Dependency directories
45+
node_modules/
46+
jspm_packages/
47+
dist/
48+
49+
50+
# TypeScript v1 declaration files
51+
typings/
52+
53+
# Optional npm cache directory
54+
.npm
55+
56+
# Optional eslint cache
57+
.eslintcache
58+
59+
# Optional REPL history
60+
.node_repl_history
61+
62+
# Output of 'npm pack'
63+
*.tgz
64+
65+
# Yarn Integrity file
66+
.yarn-integrity
67+
68+
# dotenv environment variables file
69+
.env
70+
71+
# next.js build output
72+
.next
73+
74+
# intellij
75+
.idea
76+
77+
/tests/.bin
78+
79+
*.xlsx
80+
*.csv
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Story Subgraph

0 commit comments

Comments
 (0)