Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
klkgraph
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
klkgraph
Commits
b3fbd531
Commit
b3fbd531
authored
Feb 19, 2025
by
vicotor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add code
parent
0eb1aaf2
Pipeline
#828
canceled with stages
Changes
7
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
5605 additions
and
21 deletions
+5605
-21
docker-compose.yml
docker-compose.yml
+18
-16
package-lock.json
package-lock.json
+5541
-0
package.json
package.json
+1
-1
schema.graphql
schema.graphql
+12
-0
drago.ts
src/drago.ts
+28
-1
start.sh
start.sh
+2
-0
subgraph.yaml
subgraph.yaml
+3
-3
No files found.
docker-compose.yml
View file @
b3fbd531
version
:
"
3"
version
:
'
3'
services
:
services
:
graph-node
:
graph-node
:
image
:
graphprotocol/graph-node
#image: graphprotocol/graph-node
image
:
graph-node:latest
ports
:
ports
:
-
"
8000:8000"
-
'
20000:8000'
-
"
8001:8001"
-
'
20001:8001'
-
"
8020:8020"
-
'
20020:8020'
-
"
8030:8030"
-
'
20030:8030'
-
"
8040:8040"
-
'
20040:8040'
depends_on
:
depends_on
:
-
ipfs
-
ipfs
-
postgres
-
postgres
extra_hosts
:
extra_hosts
:
-
host.docker.internal
:host-gateway
-
172.17.0.1
:host-gateway
environment
:
environment
:
postgres_host
:
postgres
postgres_host
:
postgres
postgres_user
:
graph-node
postgres_user
:
graph-node
postgres_pass
:
let-me-in
postgres_pass
:
let-me-in
postgres_db
:
graph-node
postgres_db
:
graph-node
ipfs
:
"
ipfs:5001"
ipfs
:
'
ipfs:5001'
ethereum
:
"
mainnet:http://host.docker.internal:8545"
ethereum
:
'
bsc:https://bsc.bitheart.org'
#ethereum: 'bsc:https://wispy-patient-theorem.bsc.quiknode.pro/577a2765b52de53ff763d821575dfe74d96a5fe2'
GRAPH_LOG
:
info
GRAPH_LOG
:
info
ipfs
:
ipfs
:
image
:
ipfs/kubo:v0.17.0
image
:
ipfs/kubo:v0.17.0
ports
:
ports
:
-
"
5001:5001"
-
'
25001:5001'
volumes
:
volumes
:
-
./data/ipfs:/data/ipfs
-
./data/ipfs:/data/ipfs
:Z
postgres
:
postgres
:
image
:
postgres
:14
image
:
postgres
ports
:
ports
:
-
"
5432:5432"
-
'
20432:5432'
command
:
command
:
[
[
"
postgres"
,
"
postgres"
,
"
-cshared_preload_libraries=pg_stat_statements"
,
"
-cshared_preload_libraries=pg_stat_statements"
,
"
-cmax_connections=200"
,
"
-cmax_connections=200"
]
]
environment
:
environment
:
POSTGRES_USER
:
graph-node
POSTGRES_USER
:
graph-node
...
@@ -47,4 +49,4 @@ services:
...
@@ -47,4 +49,4 @@ services:
PGDATA
:
"
/var/lib/postgresql/data"
PGDATA
:
"
/var/lib/postgresql/data"
POSTGRES_INITDB_ARGS
:
"
-E
UTF8
--locale=C"
POSTGRES_INITDB_ARGS
:
"
-E
UTF8
--locale=C"
volumes
:
volumes
:
-
./data/postgres:/var/lib/postgresql/data
-
./data/postgres:/var/lib/postgresql/data
:Z
package-lock.json
0 → 100644
View file @
b3fbd531
This diff is collapsed.
Click to expand it.
package.json
View file @
b3fbd531
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
"scripts"
:
{
"scripts"
:
{
"codegen"
:
"graph codegen"
,
"codegen"
:
"graph codegen"
,
"build"
:
"graph build"
,
"build"
:
"graph build"
,
"deploy"
:
"graph deploy --node http://127.0.0.1:
5
0020 polygon/nft-mint-test"
,
"deploy"
:
"graph deploy --node http://127.0.0.1:
3
0020 polygon/nft-mint-test"
,
"create-local"
:
"graph create --node http://localhost:8020/ polygon/nft-mint-test"
,
"create-local"
:
"graph create --node http://localhost:8020/ polygon/nft-mint-test"
,
"remove-local"
:
"graph remove --node http://localhost:8020/ polygon/nft-mint-test"
,
"remove-local"
:
"graph remove --node http://localhost:8020/ polygon/nft-mint-test"
,
"deploy-local"
:
"graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 polygon/nft-mint-test"
,
"deploy-local"
:
"graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 polygon/nft-mint-test"
,
...
...
schema.graphql
View file @
b3fbd531
...
@@ -8,6 +8,18 @@ type Transfer @entity(immutable: true) {
...
@@ -8,6 +8,18 @@ type Transfer @entity(immutable: true) {
transactionHash
:
Bytes
!
transactionHash
:
Bytes
!
}
}
type
Minted
@
entity
(
immutable
:
true
)
{
id
:
Bytes
!
from
:
Bytes
!
# address
to
:
Bytes
!
# address
tokenId
:
BigInt
!
# uint256
blockNumber
:
BigInt
!
blockTimestamp
:
BigInt
!
transactionHash
:
Bytes
!
sortHash
:
Bytes
!
# address
sortIndex
:
BigInt
!
# uint256
}
type
Approval
@
entity
(
immutable
:
true
)
{
type
Approval
@
entity
(
immutable
:
true
)
{
id
:
Bytes
!
id
:
Bytes
!
owner
:
Bytes
!
# address
owner
:
Bytes
!
# address
...
...
src/drago.ts
View file @
b3fbd531
...
@@ -3,12 +3,18 @@ import {
...
@@ -3,12 +3,18 @@ import {
Approval
as
ApprovalEvent
,
Approval
as
ApprovalEvent
,
ApprovalForAll
as
ApprovalForAllEvent
ApprovalForAll
as
ApprovalForAllEvent
}
from
"
../generated/Drago/Drago
"
}
from
"
../generated/Drago/Drago
"
import
{
Transfer
,
Approval
,
ApprovalForAll
}
from
"
../generated/schema
"
import
{
Transfer
,
Approval
,
ApprovalForAll
,
Minted
}
from
"
../generated/schema
"
import
{
store
,
Bytes
,
BigInt
,
}
from
"
@graphprotocol/graph-ts
"
;
export
function
handleTransfer
(
event
:
TransferEvent
):
void
{
export
function
handleTransfer
(
event
:
TransferEvent
):
void
{
let
entity
=
new
Transfer
(
let
entity
=
new
Transfer
(
event
.
transaction
.
hash
.
concatI32
(
event
.
logIndex
.
toI32
())
event
.
transaction
.
hash
.
concatI32
(
event
.
logIndex
.
toI32
())
)
)
entity
.
from
=
event
.
params
.
from
entity
.
from
=
event
.
params
.
from
entity
.
to
=
event
.
params
.
to
entity
.
to
=
event
.
params
.
to
entity
.
tokenId
=
event
.
params
.
tokenId
entity
.
tokenId
=
event
.
params
.
tokenId
...
@@ -18,6 +24,27 @@ export function handleTransfer(event: TransferEvent): void {
...
@@ -18,6 +24,27 @@ export function handleTransfer(event: TransferEvent): void {
entity
.
transactionHash
=
event
.
transaction
.
hash
entity
.
transactionHash
=
event
.
transaction
.
hash
entity
.
save
()
entity
.
save
()
if
(
event
.
params
.
from
.
toHexString
()
==
"
0x0000000000000000000000000000000000000000
"
)
{
// Mint
let
mintEntity
=
new
Minted
(
event
.
transaction
.
hash
.
concatI32
(
event
.
logIndex
.
toI32
())
)
mintEntity
.
from
=
event
.
params
.
from
mintEntity
.
to
=
event
.
params
.
to
mintEntity
.
tokenId
=
event
.
params
.
tokenId
mintEntity
.
blockNumber
=
event
.
block
.
number
mintEntity
.
blockTimestamp
=
event
.
block
.
timestamp
mintEntity
.
transactionHash
=
event
.
transaction
.
hash
// set new fields.
// set sort to transaction hash latest 6 bytes.
mintEntity
.
sortHash
=
Bytes
.
fromHexString
(
event
.
transaction
.
hash
.
toHexString
().
slice
(
-
12
))
mintEntity
.
sortIndex
=
event
.
logIndex
mintEntity
.
save
()
}
}
}
export
function
handleApproval
(
event
:
ApprovalEvent
):
void
{
export
function
handleApproval
(
event
:
ApprovalEvent
):
void
{
...
...
start.sh
0 → 100755
View file @
b3fbd531
#!/bin/bash
graph deploy klk-mint-bsc
--node
http://172.17.0.1:30020
--ipfs
http://172.17.0.1:35001
subgraph.yaml
View file @
b3fbd531
...
@@ -6,11 +6,11 @@ schema:
...
@@ -6,11 +6,11 @@ schema:
dataSources
:
dataSources
:
-
kind
:
ethereum
-
kind
:
ethereum
name
:
Drago
name
:
Drago
network
:
polygonmainnet
network
:
bsc
source
:
source
:
address
:
"
0x
9E8Ea82e76262E957D4cC24e04857A34B0D8f062
"
address
:
"
0x
a68C9DF9f8e27e0BDDfC27Ffd2AE21734D8e429a
"
abi
:
Drago
abi
:
Drago
startBlock
:
669000
00
startBlock
:
461611
00
mapping
:
mapping
:
kind
:
ethereum/events
kind
:
ethereum/events
apiVersion
:
0.0.7
apiVersion
:
0.0.7
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment