Skip to content

Commit

Permalink
Add Mints Manager and Mints Addresses to Subgraph (#330)
Browse files Browse the repository at this point in the history
* feat: add new zora sepolia addresses

* feat: add zora mainnet addresses

* feat: add mintsManagerImpl to index MintComments

* fix: update changeset
  • Loading branch information
IsabellaSmallcombe authored Apr 10, 2024
1 parent a014d74 commit 5888fd2
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/orange-poems-do.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@zoralabs/nft-creator-subgraph": minor
---

Adds Mints and Mints Manager Addresses for Zora Mainnet and Zora Sepolia. Also allows for indexing of MintComment events from the Mints Manager contract.
8 changes: 8 additions & 0 deletions packages/creator-subgraph/config/zora-mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,11 @@ erc20Minter:
- address: "0x777777E8850d8D6d98De2B5f64fae401F96eFF31"
startBlock: "12389159"
version: "1"
zoraMints:
- address: "0x7777777d57c1c6e472fa379b7b3b6c6ba3835073"
startBlock: "12827178"
version: "1"
mintsManager:
- address: "0x77777770ca269366c7208afcf36fe2c6f7f7608b"
startBlock: "12827178"
version: "1"
8 changes: 6 additions & 2 deletions packages/creator-subgraph/config/zora-sepolia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ reserveAuctionV3:
startBlock: "992417"
version: "1"
zoraMints:
- address: "0x7777777EBF55Ec642acCBCfe1342C2B7A384Afe4"
startBlock: "7126708"
- address: "0x7777777d57c1C6e472fa379b7b3B6c6ba3835073"
startBlock: "7129497"
version: "1"
mintsManager:
- address: "0x77777770ca269366c7208afcf36fe2c6f7f7608b"
startBlock: "7129497"
version: "1"
erc20Minter:
- address: "0x777777E8850d8D6d98De2B5f64fae401F96eFF31"
Expand Down
3 changes: 2 additions & 1 deletion packages/creator-subgraph/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,8 @@ type MintToken @entity {
id: ID!
tokenId: BigInt!
pricePerToken: BigInt!
tokenAddress: Bytes!
# Marking tokenAddress as potentially nullable in order to graft as the field did not exist on earlier versions
tokenAddress: Bytes
}

type MintAccountBalance @entity {
Expand Down
6 changes: 5 additions & 1 deletion packages/creator-subgraph/scripts/extract-abis.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import {
zoraCreatorRedeemMinterStrategyABI,
protocolRewardsABI,
} from "@zoralabs/zora-1155-contracts";
import { zoraMints1155ABI } from "@zoralabs/mints-contracts";
import {
zoraMints1155ABI,
zoraMintsManagerImplABI,
} from "@zoralabs/mints-contracts";
import erc721Drop from "@zoralabs/nft-drop-contracts/dist/artifacts/ERC721Drop.sol/ERC721Drop.json" assert { type: "json" };
import zoraNFTCreatorV1 from "@zoralabs/nft-drop-contracts/dist/artifacts/ZoraNFTCreatorV1.sol/ZoraNFTCreatorV1.json" assert { type: "json" };
import editionMetadataRenderer from "@zoralabs/nft-drop-contracts/dist/artifacts/EditionMetadataRenderer.sol/EditionMetadataRenderer.json" assert { type: "json" };
Expand Down Expand Up @@ -59,3 +62,4 @@ output_abi(
output_abi("ProtocolRewards", protocolRewardsABI);

output_abi("ZoraMints1155", zoraMints1155ABI);
output_abi("ZoraMintsManagerImpl", zoraMintsManagerImplABI);
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { MintComment as MintsManagerMintComment } from "../../generated/MintsManager/MintsManager";
import { getMintCommentId } from "../common/getMintCommentId";
import { MintComment } from "../../generated/schema";
import { getTokenId } from "../common/getTokenId";
import { makeTransaction } from "../common/makeTransaction";

export function handleMintComment(event: MintsManagerMintComment): void {
const mintComment = new MintComment(getMintCommentId(event));
const tokenAndContract = getTokenId(
event.params.tokenContract,
event.params.tokenId,
);
mintComment.tokenAndContract = tokenAndContract;
mintComment.sender = event.params.sender;
mintComment.comment = event.params.comment;
mintComment.mintQuantity = event.params.quantity;
mintComment.tokenId = event.params.tokenId;

mintComment.txn = makeTransaction(event);
mintComment.block = event.block.number;
mintComment.timestamp = event.block.timestamp;
mintComment.address = event.address;

mintComment.save();
}
22 changes: 22 additions & 0 deletions packages/creator-subgraph/subgraph.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,28 @@ dataSources:
- event: TransferBatch(indexed address,indexed address,indexed address,uint256[],uint256[])
handler: handleTransferBatch
{{/zoraMints}}
{{#mintsManager}}
- name: MintsManager
kind: ethereum/contract
network: {{network}}
source:
abi: MintsManager
address: "{{address}}"
startBlock: {{startBlock}}
mapping:
kind: ethereum/events
apiVersion: 0.0.7
entities:
- MintComment
language: wasm/assemblyscript
file: ./src/MintsMappings/mintsManagerMappings.ts
abis:
- name: MintsManager
file: ./abis/ZoraMintsManagerImpl.json
eventHandlers:
- event: MintComment(indexed address,indexed address,indexed uint256,uint256,string)
handler: handleMintComment
{{/mintsManager}}
{{#erc20Minter}}
- name: ERC20Minter
kind: ethereum/contract
Expand Down

0 comments on commit 5888fd2

Please sign in to comment.