CryptoPunks
The CryptoPunks are 10,000 uniquely generated characters. No two are exactly alike, and each one of them can be officially owned by a single person on the Ethereum blockchain.
Subgraph url
https://thegraph.com/hosted-service/subgraph/itsjerryokolo/cryptopunks
GraphQL endpoint
Query the subgraph via its endpoint
https://api.thegraph.com/subgraphs/name/itsjerryokolo/cryptopunks
Entities
You'll find the description of the various fields in the schema.graphql
- ASK: This entity captures the ASKS for a punk or from a user. It also shows the
current ASK
of the Punk. An ask can beopen
orclosed
. You can also query when the ask wascreated
and when it wasremoved
- BID: This entity captures the BIDS for a punk or from a user. It also shows the
current BID
of the Punk. An ask can beopen
orclosed
. You can also query when the bid wascreated
and when it wasremoved
- PUNK: This entity holds useful information about the Punks;
traits
,accessories
,gender
,owner
etc - ACCOUNT: Account contains the user data;
Trades
,Hodlings
etc - CONTRACT: Contract metadata including
Trade Volume
- METADATA: Here, you can retrieve the punk tokenURI, image URI, traits, and other useful metadata
- SALE - Query punk sale events
Queries
See the Queries.md for example queries.
Query Owner Data
{
accounts(where: {id: "0x6aeda057364cc4aad943cac04a1c149d90e10a3b"}) {
id
nftsOwned {
id
}
bids{
id
}
asks{
id
created{
id
txHash
timestamp
}
}
bought{
id
timestamp
nft{
id
}
}
sent{
id
nft{
id
}
txHash
timestamp
}
received{
id
nft{
id
}
txHash
timestamp
}
assigned{
id
nft{id}
timestamp
txHash
}
}
}
Available Enums for Punk
- male
- female
- zombie
- alien
- ape
Query male Punks
{
punks(where: { type: male }) {
id
accessories
type
}
}
Run your local Graph Node
ETHEREUM_RPC=mainnet:https://eth-mainnet.alchemyapi.io/v2/${YOUR_API_KEY} docker compose up
Logic for Transfers/Wraps
- Regular PunkTransfer
- In handlePunkTransfer:
- decrement from
- increment to
- set owner
- create Transfer event
- In handlePunkTransfer:
- Mint/Wrap
- In handlePunkTransfer (to = WrappedPunkAddress):
- decrement from
- In handleWrappedPunkTransfer (from = ZeroAddress):
- increment to
- set owner
- create Wrap event
- In handlePunkTransfer (to = WrappedPunkAddress):
- Burn/Unwrap
- In handlePunkTransfer (from = WrappedPunkAddress):
- increment to
- set owner
- In handleWrappedPunkTransfer (to = ZeroAddress):
- decrement from
- create Unwrap event
- In handlePunkTransfer (from = WrappedPunkAddress):
- Wrapped Transfer
- In handleWrappedPunkTransfer:
- decrement from
- increment to
- set owner
- create Transfer event
- In handleWrappedPunkTransfer: