diff --git a/subgraph/package.json b/subgraph/package.json index 55a2d535..a75abf8e 100644 --- a/subgraph/package.json +++ b/subgraph/package.json @@ -8,7 +8,7 @@ "build:sepolia": "graph codegen && graph build --network sepolia", "build:mainnet": "graph codegen && graph build --network mainnet", "deploy:local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 moleculeprotocol/ipnft-subgraph", - "deploy:sepolia": "env-cmd -x -f ../.env graph deploy ip-nft-sepolia --version-label 1.1.0 --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz --deploy-key \\$SATSUMA_DEPLOY_KEY", + "deploy:sepolia": "env-cmd -x -f ../.env graph deploy ip-nft-sepolia --version-label 1.1.1 --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz --deploy-key \\$SATSUMA_DEPLOY_KEY", "deploy:mainnet": "env-cmd -x -f ../.env graph deploy ip-nft-mainnet --version-label 1.0.0 --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz --deploy-key \\$SATSUMA_DEPLOY_KEY", "create:local": "graph create --node http://localhost:8020/ moleculeprotocol/ipnft-subgraph", "remove:local": "graph remove --node http://localhost:8020/ moleculeprotocol/ipnft-subgraph", diff --git a/subgraph/schema.graphql b/subgraph/schema.graphql index f11b8ca7..9501460b 100644 --- a/subgraph/schema.graphql +++ b/subgraph/schema.graphql @@ -19,6 +19,7 @@ type IPT @entity { # these will be updated by the underlying IPT subgraph template totalIssued: BigInt! #the highest amount of IPTs issued, this can be raised by the owner circulatingSupply: BigInt! #the amount of unburnt IPTs + capped: Boolean! #whether the IPT is capped # paymentToken: Bytes #address ERC20 Token # paidPrice: BigInt #the price paid for the original ipnft # claimedShares: BigInt! # the amount of shares that have already been claimed. This needs to have a fulfilledListingId to be set diff --git a/subgraph/src/iptMapping.ts b/subgraph/src/iptMapping.ts index eb35258f..37efb185 100644 --- a/subgraph/src/iptMapping.ts +++ b/subgraph/src/iptMapping.ts @@ -1,6 +1,6 @@ import { Address, BigInt, log } from '@graphprotocol/graph-ts' import { IPT, IPTBalance } from '../generated/schema' -import { Transfer as TransferEvent } from '../generated/templates/IPToken/IPToken' +import { Transfer as TransferEvent, Capped as CappedEvent } from '../generated/templates/IPToken/IPToken' function createOrUpdateBalances( owner: Address, @@ -21,6 +21,16 @@ function createOrUpdateBalances( balance.save() } +export function handleCapped(event: CappedEvent): void { + let ipt = IPT.load(event.address.toHexString()) + if (!ipt) { + log.error('[IPT] Ipnft not found for id: {}', [event.address.toHexString()]) + return + } + ipt.capped = true + ipt.save() +} + export function handleTransfer(event: TransferEvent): void { let from = event.params.from let to = event.params.to diff --git a/subgraph/src/tokenizerMapping.ts b/subgraph/src/tokenizerMapping.ts index bb8c2223..9e24f1f3 100644 --- a/subgraph/src/tokenizerMapping.ts +++ b/subgraph/src/tokenizerMapping.ts @@ -19,6 +19,7 @@ export function handleIPTsCreated(event: TokensCreatedEvent): void { //these will be updated by the underlying IPT subgraph template ipt.totalIssued = BigInt.fromU32(0) ipt.circulatingSupply = BigInt.fromU32(0) + ipt.capped = false; IPToken.create(event.params.tokenContract) ipt.save()