Skip to content

Commit

Permalink
Merge pull request #69 from kodadot/main
Browse files Browse the repository at this point in the history
🔖 Basick v13
  • Loading branch information
vikiival authored Sep 17, 2024
2 parents 8902b66 + 5161b2f commit cb60c39
Show file tree
Hide file tree
Showing 20 changed files with 164 additions and 95 deletions.
2 changes: 1 addition & 1 deletion basick.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
manifestVersion: subsquid.io/v0.1
name: basick
version: 12
version: 13
description: 'SubSquid indexer for Base'
build:
deploy:
Expand Down
27 changes: 27 additions & 0 deletions db/migrations/1726474217825-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = class Data1726474217825 {
name = 'Data1726474217825'

async up(db) {
await db.query(`ALTER TABLE "nft_entity" DROP COLUMN "sn"`)
await db.query(`ALTER TABLE "nft_entity" ADD "sn" numeric NOT NULL`)
await db.query(`CREATE INDEX "IDX_8fed68c917920ff529994c2c65" ON "nft_entity" ("block_number") `)
await db.query(`CREATE INDEX "IDX_f0abf665028feb26e32d4201c5" ON "nft_entity" ("created_at") `)
await db.query(`CREATE INDEX "IDX_fb5a810a729fee4b0b0d3301eb" ON "nft_entity" ("sn") `)
await db.query(`CREATE INDEX "IDX_703bf1a1b47a340c5675fdda85" ON "collection_entity" ("block_number") `)
await db.query(`CREATE INDEX "IDX_b09e3db203a007fa67648832be" ON "collection_entity" ("created_at") `)
await db.query(`CREATE INDEX "IDX_8ae50565da6e56f122ccad6c57" ON "collection_entity" ("supply") `)
await db.query(`CREATE INDEX "IDX_fba85326b71638259b87a35197" ON "collection_entity" ("updated_at") `)
}

async down(db) {
await db.query(`ALTER TABLE "nft_entity" ADD "sn" text NOT NULL`)
await db.query(`ALTER TABLE "nft_entity" DROP COLUMN "sn"`)
await db.query(`DROP INDEX "public"."IDX_8fed68c917920ff529994c2c65"`)
await db.query(`DROP INDEX "public"."IDX_f0abf665028feb26e32d4201c5"`)
await db.query(`DROP INDEX "public"."IDX_fb5a810a729fee4b0b0d3301eb"`)
await db.query(`DROP INDEX "public"."IDX_703bf1a1b47a340c5675fdda85"`)
await db.query(`DROP INDEX "public"."IDX_b09e3db203a007fa67648832be"`)
await db.query(`DROP INDEX "public"."IDX_8ae50565da6e56f122ccad6c57"`)
await db.query(`DROP INDEX "public"."IDX_fba85326b71638259b87a35197"`)
}
}
15 changes: 15 additions & 0 deletions db/migrations/1726484389986-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = class Data1726484389986 {
name = 'Data1726484389986'

async up(db) {
await db.query(`ALTER TABLE "metadata_entity" ADD "banner" text`)
await db.query(`ALTER TABLE "metadata_entity" ADD "kind" character varying(6)`)
await db.query(`ALTER TABLE "collection_entity" ADD "kind" character varying(6)`)
}

async down(db) {
await db.query(`ALTER TABLE "metadata_entity" DROP COLUMN "banner"`)
await db.query(`ALTER TABLE "metadata_entity" DROP COLUMN "kind"`)
await db.query(`ALTER TABLE "collection_entity" DROP COLUMN "kind"`)
}
}
2 changes: 1 addition & 1 deletion flock.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
manifestVersion: subsquid.io/v0.1
name: flock
version: 2
version: 3
description: 'SubSquid indexer for Mantle'
build:
deploy:
Expand Down
64 changes: 32 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"update": "npx npm-check-updates --filter /subsquid/ --upgrade && npm i -f"
},
"dependencies": {
"@kodadot1/hyperdata": "^0.0.1-rc.4",
"@kodadot1/hyperdata": "^0.0.1-rc.5",
"@kodadot1/metasquid": "^0.3.0-rc.0",
"@kodadot1/minipfs": "^0.4.3-rc.2",
"@subsquid/archive-registry": "^3.3.2",
"@subsquid/evm-processor": "^1.19.2",
"@subsquid/evm-processor": "^1.21.1",
"@subsquid/graphql-server": "^4.7.0",
"@subsquid/typeorm-migration": "^1.3.0",
"@subsquid/typeorm-store": "^1.5.1",
Expand Down
76 changes: 37 additions & 39 deletions schema.graphql
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
type CollectionEntity @entity {
blockNumber: BigInt
createdAt: DateTime!
baseUri: String
blockNumber: BigInt @index
# burned: Boolean!
createdAt: DateTime! @index
currentOwner: String!
distribution: Int! # dummy
events: [CollectionEvent!] @derivedFrom(field: "collection")
floor: BigInt! # dummy
floor: BigInt! #@index dummy
hash: String! @unique
highestSale: BigInt! # dummy
highestSale: BigInt! #@index dummy
id: ID!
image: String
issuer: String!
kind: Kind
max: Int
media: String
meta: MetadataEntity
metadata: String
name: String @index
nftCount: Int! # dummy
nftCount: Int! #@index dummy
nfts: [NFTEntity!] @derivedFrom(field: "collection")
ownerCount: Int! # dummy
supply: Int! # dummy
baseUri: String
supply: Int! @index # dummy
symbol: String # dummy
type: CollectionType!
updatedAt: DateTime!
updatedAt: DateTime! @index
version: Int! # dummy
volume: BigInt! # dummy
volume: BigInt! #@index dummy
}

type NFTEntity @entity {
blockNumber: BigInt
blockNumber: BigInt @index
burned: Boolean!
collection: CollectionEntity!
createdAt: DateTime!
createdAt: DateTime! @index
currentOwner: String! @index
events: [Event!] @derivedFrom(field: "nft")
hash: String! @index
Expand All @@ -43,13 +45,13 @@ type NFTEntity @entity {
meta: MetadataEntity
metadata: String
name: String @index
price: BigInt
price: BigInt #@index
recipient: String
royalty: Float
sn: String!
sn: BigInt! @index
updatedAt: DateTime!
version: Int!
token: TokenEntity!
token: TokenEntity
}

type TokenEntity @entity {
Expand All @@ -74,6 +76,8 @@ type MetadataEntity @entity {
attributes: [Attribute!]
animationUrl: String
type: String
banner: String
kind: Kind
}

type Attribute @jsonField {
Expand Down Expand Up @@ -130,33 +134,27 @@ enum Interaction {
MINT
SEND
UNLIST
# LOCK
}
# type Owner @entity {
# id: ID! # owner address
# ownedTokens: [Token!]! @derivedFrom(field: "owner")
# }

# type Token @entity {
# id: ID! # string form of tokenId
# tokenId: BigInt!
# owner: Owner!
# uri: String!
# image: String
# attributes: [Attribute!]
# transfers: [Transfer!]! @derivedFrom(field: "token")
# }
enum Kind {
poap
pfp
genart
mixed
# audio
# video
}

# type Attribute {
# traitType: String!
# value: String!
# type AssetEntity @entity {
# id: ID!
# name: String
# symbol: String
# decimals: Int
# }

# type Transfer @entity {
# id: ID!
# token: Token!
# from: Owner!
# to: Owner!
# timestamp: DateTime!
# blockNumber: Int!
# txHash: String! @index
# }
# Entity to represent when the cache was last updated
# type CacheStatus @entity {
# id: ID!
# lastBlockTimestamp: DateTime!
# }
2 changes: 1 addition & 1 deletion src/mappings/erc721/mint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function handleTokenCreate({ to, tokenId }: Transfer, context: Log): Item
createdAt: base.timestamp,
blockNumber: BigInt(base.blockNumber),
hash: md5(id),
sn: tokenId.toString(),
sn: tokenId,
price: 0n,
burned: false,
lewd: false,
Expand Down
1 change: 1 addition & 0 deletions src/mappings/erc7572/setMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export async function handleCollectionMetadataSet(context: Log, process: Context
final.name = metadata?.name || final.name
final.image = metadata?.image || final.image
final.media = metadata?.animationUrl || final.media
final.kind = metadata?.kind || final.kind
}

await process.store.save(final)
Expand Down
3 changes: 2 additions & 1 deletion src/mappings/registry/add.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { create, getOrCreate } from '@kodadot1/metasquid/entity'
import md5 from 'md5'
import { CollectionEntity as CE, CollectionType } from '../../model'
import { CollectionEntity as CE, CollectionType, Kind } from '../../model'
import { handleMetadata } from '../shared/metadata'
import { contractOf, unwrap } from '../utils/extract'
import { debug, pending, success } from '../utils/logger'
Expand Down Expand Up @@ -50,6 +50,7 @@ export async function handleCollectionAdd(context: Log, process: Context): Promi
final.name = metadata?.name || final.name
final.image = metadata?.image || final.image
final.media = metadata?.animationUrl || final.media
final.kind = metadata?.kind || final.kind
}

await process.store.save(final)
Expand Down
Loading

0 comments on commit cb60c39

Please sign in to comment.