From 064988cd14fae427bc6a5110a4ed587e196a3bd9 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 13 Mar 2024 21:23:42 +0100 Subject: [PATCH 1/6] feat(ids): hypercerts-org and chainID to graph --- graph/package.json | 22 +++++----- graph/schema.graphql | 40 ------------------ graph/src/utils.ts | 35 +++++++++++++++- graph/subgraph.yaml | 6 ++- pnpm-lock.yaml | 96 +++++++++++++++++++++++++++++++------------- 5 files changed, 118 insertions(+), 81 deletions(-) diff --git a/graph/package.json b/graph/package.json index 6eba6b35..3a8adc3e 100644 --- a/graph/package.json +++ b/graph/package.json @@ -11,21 +11,21 @@ "build:codegen": "graph codegen", "deploy:test": "pnpm auth && pnpm deploy:sepolia && pnpm deploy:base-sepolia", "deploy:prod": "pnpm auth && pnpm deploy:optimism && pnpm deploy:celo && pnpm deploy:base", - "deploy:base": "graph deploy --node https://api.thegraph.com/deploy/ --network base hypercerts-admin/hypercerts-base-mainnet", - "deploy:celo": "graph deploy --node https://api.thegraph.com/deploy/ --network celo hypercerts-admin/hypercerts-celo", - "deploy:optimism": "graph deploy --node https://api.thegraph.com/deploy/ --network optimism hypercerts-admin/hypercerts-optimism-mainnet", - "deploy:sepolia": "graph deploy --node https://api.thegraph.com/deploy/ --network sepolia hypercerts-admin/hypercerts-sepolia", - "deploy:base-sepolia": "graph deploy --node https://api.thegraph.com/deploy/ --network base-sepolia hypercerts-admin/hypercerts-base-sepolia", - "create-local": "graph create --node http://localhost:8020/ hypercerts-admin/hypercerts-testnet", - "remove-local": "graph remove --node http://localhost:8020/ hypercerts-admin/hypercerts-testnet", - "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 hypercerts-admin/hypercerts-testnet", + "deploy:base": "graph deploy --node https://api.thegraph.com/deploy/ --network base hypercerts-org/hypercerts-base-mainnet", + "deploy:celo": "graph deploy --node https://api.thegraph.com/deploy/ --network celo hypercerts-org/hypercerts-celo", + "deploy:optimism": "graph deploy --node https://api.thegraph.com/deploy/ --network optimism hypercerts-org/hypercerts-optimism-mainnet", + "deploy:sepolia": "graph deploy --node https://api.thegraph.com/deploy/ --network sepolia hypercerts-org/hypercerts-sepolia", + "deploy:base-sepolia": "graph deploy --node https://api.thegraph.com/deploy/ --network base-sepolia hypercerts-org/hypercerts-base-sepolia", + "create-local": "graph create --node http://localhost:8020/ hypercerts-org/hypercerts-testnet", + "remove-local": "graph remove --node http://localhost:8020/ hypercerts-org/hypercerts-testnet", + "deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 hypercerts-org/hypercerts-testnet", "graph": "graph", "test": "graph test" }, "devDependencies": { - "@graphprotocol/graph-cli": "0.60.0", - "@graphprotocol/graph-ts": "0.31.0", - "assemblyscript": "0.19.23", + "@graphprotocol/graph-cli": "0.68.5", + "@graphprotocol/graph-ts": "0.33.0", + "assemblyscript": "0.27.25", "matchstick-as": "0.6.0" }, "//": [ diff --git a/graph/schema.graphql b/graph/schema.graphql index d6ec32ef..c2c8b8d5 100644 --- a/graph/schema.graphql +++ b/graph/schema.graphql @@ -22,44 +22,4 @@ type ClaimToken @entity { claim: Claim! owner: Bytes! units: BigInt! - offers: [Offer!] @derivedFrom(field: "fractionID") -} - -type Token @entity { - id: String! - name: String! - symbol: String - decimals: BigInt -} - -type AcceptedToken @entity { - id: String! - token: Token! - minimumAmountPerUnit: BigInt! - accepted: Boolean! -} - -enum OfferStatus { - Open - Fulfilled - Cancelled -} - -type Offer @entity { - id: String! - fractionID: ClaimToken! - unitsAvailable: BigInt! - minUnitsPerTrade: BigInt! - maxUnitsPerTrade: BigInt! - status: OfferStatus! - acceptedTokens: [AcceptedToken!]! -} - -type Trade @entity { - id: String! - buyer: Bytes! - offerID: Offer! - unitsSold: BigInt! - token: Token! - amountPerUnit: BigInt! } diff --git a/graph/src/utils.ts b/graph/src/utils.ts index 592ded27..ed5a69c8 100644 --- a/graph/src/utils.ts +++ b/graph/src/utils.ts @@ -1,13 +1,46 @@ import { HypercertMinter } from "../generated/HypercertMinter/HypercertMinter"; import { Allowlist, Claim, ClaimToken } from "../generated/schema"; import { Address, BigInt, Bytes, log } from "@graphprotocol/graph-ts"; +import { dataSource } from "@graphprotocol/graph-ts"; + +// const chainIds = { +// base: "84531", +// "base-sepolia": "84532", +// celo: "42220", +// mainnet: "1", +// optimism: "10", +// sepolia: "11155111", +// } as const; export const ZERO_ADDRESS = Address.fromString( "0x0000000000000000000000000000000000000000", ); export function getID(tokenID: BigInt, contract: Address): string { - return contract.toHexString().concat("-".concat(tokenID.toString())); + const network = dataSource.network(); + + let chainId: string; + + // TODO fix this ugly hack because of the stupid type compile errors + if (network == "mainnet") { + chainId = "1"; + } else if (network == "celo") { + chainId = "42220"; + } else if (network == "optimism") { + chainId = "10"; + } else if (network == "sepolia") { + chainId = "11155111"; + } else if (network == "base") { + chainId = "84531"; + } else if (network == "base-sepolia") { + chainId = "84532"; + } else { + chainId = ""; + } + + return chainId.concat( + "-".concat(contract.toHexString().concat("-".concat(tokenID.toString()))), + ); } export function getOrCreateAllowlist( diff --git a/graph/subgraph.yaml b/graph/subgraph.yaml index df82bb3f..38924776 100644 --- a/graph/subgraph.yaml +++ b/graph/subgraph.yaml @@ -33,9 +33,11 @@ dataSources: handler: handleLeafClaimed - event: OwnershipTransferred(indexed address,indexed address) handler: handleOwnershipTransferred - - event: TransferBatch(indexed address,indexed address,indexed address,uint256[],uint256[]) + - event: TransferBatch(indexed address,indexed address,indexed + address,uint256[],uint256[]) handler: handleTransferBatch - - event: TransferSingle(indexed address,indexed address,indexed address,uint256,uint256) + - event: TransferSingle(indexed address,indexed address,indexed + address,uint256,uint256) handler: handleTransferSingle - event: URI(string,indexed uint256) handler: handleURI diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8ba87458..90db9228 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -544,14 +544,14 @@ importers: graph: devDependencies: '@graphprotocol/graph-cli': - specifier: 0.60.0 - version: 0.60.0(@types/node@18.18.7)(node-fetch@3.3.2)(typescript@4.9.5) + specifier: 0.68.5 + version: 0.68.5(@types/node@18.18.7)(node-fetch@3.3.2)(typescript@4.9.5) '@graphprotocol/graph-ts': - specifier: 0.31.0 - version: 0.31.0 + specifier: 0.33.0 + version: 0.33.0 assemblyscript: - specifier: 0.19.23 - version: 0.19.23 + specifier: 0.27.25 + version: 0.27.25 matchstick-as: specifier: 0.6.0 version: 0.6.0 @@ -5448,6 +5448,7 @@ packages: /@float-capital/float-subgraph-uncrashable@0.0.0-internal-testing.5: resolution: {integrity: sha512-yZ0H5e3EpAYKokX/AbtplzlvSxEJY7ZfpvQyDzyODkks0hakAAlDG6fQu1SlDJMWorY7bbq1j7fCiFeTWci6TA==} + hasBin: true dependencies: '@rescript/std': 9.0.0 graphql: 16.8.1 @@ -5606,9 +5607,10 @@ packages: tslib: 2.6.2 dev: false - /@graphprotocol/graph-cli@0.60.0(@types/node@18.18.7)(node-fetch@3.3.2)(typescript@4.9.5): - resolution: {integrity: sha512-8tGaQJ0EzAPtkDXCAijFGoVdJXM+pKFlGxjiU31TdG5bS4cIUoSB6yWojVsFFod0yETAwf+giel/0/8sudYsDw==} - engines: {node: '>=14'} + /@graphprotocol/graph-cli@0.68.5(@types/node@18.18.7)(node-fetch@3.3.2)(typescript@4.9.5): + resolution: {integrity: sha512-3GY2pYr5LksO6JY6s5nvePnSKVdtzDEn1CUGezyjCMR1uq9YIXMPXKqcnrzCX/DLugioEabiEi2+yOg9+rnFDQ==} + engines: {node: '>=18'} + hasBin: true dependencies: '@float-capital/float-subgraph-uncrashable': 0.0.0-internal-testing.5 '@oclif/core': 2.8.6(@types/node@18.18.7)(typescript@4.9.5) @@ -5624,14 +5626,13 @@ packages: dockerode: 2.5.8 fs-extra: 9.1.0 glob: 9.3.5 - gluegun: 5.1.2(debug@4.3.4) + gluegun: 5.1.6(debug@4.3.4) graphql: 15.5.0 immutable: 4.2.1 ipfs-http-client: 55.0.0(node-fetch@3.3.2) jayson: 4.0.0 js-yaml: 3.14.1 - prettier: 1.19.1 - request: 2.88.2 + prettier: 3.0.3 semver: 7.4.0 sync-request: 6.1.0 tmp-promise: 3.0.3 @@ -5650,8 +5651,8 @@ packages: - utf-8-validate dev: true - /@graphprotocol/graph-ts@0.31.0: - resolution: {integrity: sha512-xreRVM6ho2BtolyOh2flDkNoGZximybnzUnF53zJVp0+Ed0KnAlO1/KOCUYw06euVI9tk0c9nA2Z/D5SIQV2Rg==} + /@graphprotocol/graph-ts@0.33.0: + resolution: {integrity: sha512-HBUVblHUdjQZ/MEjjYPzVgmh+SiuF9VV0D8KubYfFAtzkqpVJlvdyk+RZTAJUiu8hpyYy0EVIcAnLEPtKlwMGQ==} dependencies: assemblyscript: 0.19.10 dev: true @@ -13324,6 +13325,7 @@ packages: /JSONStream@1.3.2: resolution: {integrity: sha512-mn0KSip7N4e0UDPZHnqDsHECo5uGQrixQKnAskOM1BIB8hd7QKbd6il8IPRPudPHOeHiECoCFqhyMaRO9+nWyA==} + hasBin: true dependencies: jsonparse: 1.3.1 through: 2.3.8 @@ -13991,6 +13993,7 @@ packages: /assemblyscript@0.19.10: resolution: {integrity: sha512-HavcUBXB3mBTRGJcpvaQjmnmaqKHBGREjSPNsIvnAk2f9dj78y4BkMaSSdvBQYWcDDzsHQjyUC8stICFkD1Odg==} + hasBin: true dependencies: binaryen: 101.0.0-nightly.20210723 long: 4.0.0 @@ -13998,12 +14001,22 @@ packages: /assemblyscript@0.19.23: resolution: {integrity: sha512-fwOQNZVTMga5KRsfY80g7cpOl4PsFQczMwHzdtgoqLXaYhkhavufKb0sB0l3T1DUxpAufA0KNhlbpuuhZUwxMA==} + hasBin: true dependencies: binaryen: 102.0.0-nightly.20211028 long: 5.2.3 source-map-support: 0.5.21 dev: true + /assemblyscript@0.27.25: + resolution: {integrity: sha512-hkx6Vz+EFVA2hqFfnTWfO14892scFIkJzdXyqfXUoBS76cLbar0PFJQ7yZuL9m/i5xpjFk9Bz2094uHLh7W5UA==} + engines: {node: '>=16', npm: '>=7'} + hasBin: true + dependencies: + binaryen: 116.0.0-nightly.20240114 + long: 5.2.3 + dev: true + /assert-plus@1.0.0: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} engines: {node: '>=0.8'} @@ -14490,12 +14503,18 @@ packages: /binaryen@101.0.0-nightly.20210723: resolution: {integrity: sha512-eioJNqhHlkguVSbblHOtLqlhtC882SOEPKmNFZaDuz1hzQjolxZ+eu3/kaS10n3sGPONsIZsO7R9fR00UyhEUA==} + hasBin: true dev: true /binaryen@102.0.0-nightly.20211028: resolution: {integrity: sha512-GCJBVB5exbxzzvyt8MGDv/MeUjs6gkXDvf4xOIItRBptYl0Tz5sm1o/uG95YK0L0VeG5ajDu3hRtkBP2kzqC5w==} dev: true + /binaryen@116.0.0-nightly.20240114: + resolution: {integrity: sha512-0GZrojJnuhoe+hiwji7QFaL3tBlJoA+KFUN7ouYSDGZLSo9CKM8swQX8n/UcbR0d1VuZKU+nhogNzv423JEu5A==} + hasBin: true + dev: true + /bind-decorator@1.0.11: resolution: {integrity: sha512-yzkH0uog6Vv/vQ9+rhSKxecnqGUZHYncg7qS7voz3Q76+TAi1SGiOKk2mlOvusQnFz9Dc4BC/NMkeXu11YgjJg==} dev: false @@ -14933,6 +14952,7 @@ packages: /cardinal@2.1.1: resolution: {integrity: sha512-JSr5eOgoEymtYHBjNWyjrMqet9Am2miJhlfKNdqLp6zoeAh0KN5dRAcxlecj5mAJrmQomgiOBj35xHLrFjqBpw==} + hasBin: true dependencies: ansicolors: 0.3.2 redeyed: 2.1.1 @@ -14966,6 +14986,7 @@ packages: /cborg@1.10.2: resolution: {integrity: sha512-b3tFPA9pUr2zCUiCfRd2+wok2/LBSNUMKOuRRok+WlvvAgEt/PlbgPTsZUcwCOs53IJvLgTp0eotwtosE6njug==} + hasBin: true dev: true /ccount@2.0.1: @@ -17374,9 +17395,10 @@ packages: /ee-first@1.1.1: resolution: {integrity: sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==} - /ejs@3.1.6: - resolution: {integrity: sha512-9lt9Zse4hPucPkoP7FHDF0LQAlGyF9JVpnClFLFH3aSSbxmyoqINRpp/9wePWJTUl4KOQwRL72Iw3InHPDkoGw==} + /ejs@3.1.8: + resolution: {integrity: sha512-/sXZeMlhS0ArkfX2Aw780gJzXSMPnKjtspYZv+f3NiKLlubezAHDU5+9xz6gd3/NhG3txQCo6xlglmTS+oTGEQ==} engines: {node: '>=0.10.0'} + hasBin: true dependencies: jake: 10.8.7 dev: true @@ -17384,6 +17406,7 @@ packages: /ejs@3.1.9: resolution: {integrity: sha512-rC+QVNMJWv+MtPgkt0y+0rVEIdbtxVADApW9JXrUVlzHetgcyczP/E7DJmWJ4fJCZF2cPcBk0laWO9ZHMG3DmQ==} engines: {node: '>=0.10.0'} + hasBin: true dependencies: jake: 10.8.7 dev: true @@ -19941,8 +19964,9 @@ packages: pinkie-promise: 2.0.1 dev: true - /gluegun@5.1.2(debug@4.3.4): - resolution: {integrity: sha512-Cwx/8S8Z4YQg07a6AFsaGnnnmd8mN17414NcPS3OoDtZRwxgsvwRNJNg69niD6fDa8oNwslCG0xH7rEpRNNE/g==} + /gluegun@5.1.6(debug@4.3.4): + resolution: {integrity: sha512-9zbi4EQWIVvSOftJWquWzr9gLX2kaDgPkNR5dYWbM53eVvCI3iKuxLlnKoHC0v4uPoq+Kr/+F569tjoFbA4DSA==} + hasBin: true dependencies: apisauce: 2.1.6(debug@4.3.4) app-module-path: 2.2.0 @@ -19950,7 +19974,7 @@ packages: colors: 1.4.0 cosmiconfig: 7.0.1 cross-spawn: 7.0.3 - ejs: 3.1.6 + ejs: 3.1.8 enquirer: 2.3.6 execa: 5.1.1 fs-jetpack: 4.3.1 @@ -20210,6 +20234,7 @@ packages: /har-validator@5.1.5: resolution: {integrity: sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==} engines: {node: '>=6'} + deprecated: this library is no longer supported dependencies: ajv: 6.12.6 har-schema: 2.0.0 @@ -21428,7 +21453,7 @@ packages: resolution: {integrity: sha512-AmCS+9CT34pp2u0QQVXjKztkuq3y5T+BIciuiHDDtDZucZD8VudosnSdUyXJV6IsRkN5jc4RFDhCk1O6Q3Gxjg==} dependencies: interface-store: 2.0.2 - nanoid: 3.3.6 + nanoid: 3.3.7 uint8arrays: 3.1.1 dev: true @@ -21516,6 +21541,7 @@ packages: /ipfs-core-types@0.9.0(node-fetch@3.3.2): resolution: {integrity: sha512-VJ8vJSHvI1Zm7/SxsZo03T+zzpsg8pkgiIi5hfwSJlsrJ1E2v68QPlnLshGHUSYw89Oxq0IbETYl2pGTFHTWfg==} + deprecated: js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details dependencies: interface-datastore: 6.1.1 multiaddr: 10.0.1(node-fetch@3.3.2) @@ -21527,6 +21553,7 @@ packages: /ipfs-core-utils@0.13.0(node-fetch@3.3.2): resolution: {integrity: sha512-HP5EafxU4/dLW3U13CFsgqVO5Ika8N4sRSIb/dTg16NjLOozMH31TXV0Grtu2ZWo1T10ahTzMvrfT5f4mhioXw==} + deprecated: js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details dependencies: any-signal: 2.1.2 blob-to-it: 1.0.4 @@ -21544,7 +21571,7 @@ packages: multiaddr: 10.0.1(node-fetch@3.3.2) multiaddr-to-uri: 8.0.0(node-fetch@3.3.2) multiformats: 9.9.0 - nanoid: 3.3.6 + nanoid: 3.3.7 parse-duration: 1.1.0 timeout-abort-controller: 2.0.0 uint8arrays: 3.1.1 @@ -21557,6 +21584,7 @@ packages: /ipfs-http-client@55.0.0(node-fetch@3.3.2): resolution: {integrity: sha512-GpvEs7C7WL9M6fN/kZbjeh4Y8YN7rY8b18tVWZnKxRsVwM25cIFrRI8CwNt3Ugin9yShieI3i9sPyzYGMrLNnQ==} engines: {node: '>=14.0.0', npm: '>=3.0.0'} + deprecated: js-IPFS has been deprecated in favour of Helia - please see https://github.com/ipfs/js-ipfs/issues/4336 for details dependencies: '@ipld/dag-cbor': 7.0.3 '@ipld/dag-json': 8.0.11 @@ -21606,7 +21634,7 @@ packages: it-glob: 1.0.2 it-to-stream: 1.0.0 merge-options: 3.0.4 - nanoid: 3.3.6 + nanoid: 3.3.7 native-fetch: 3.0.0(node-fetch@2.7.0) node-fetch: 2.7.0 react-native-fetch-api: 3.0.0 @@ -22324,6 +22352,7 @@ packages: /jake@10.8.7: resolution: {integrity: sha512-ZDi3aP+fG/LchyBzUM804VjddnwfSfsdeYkwt8NcbKRvo4rFkjhs456iLFn3k2ZUWvNe4i48WACDbza8fhq2+w==} engines: {node: '>=10'} + hasBin: true dependencies: async: 3.2.4 chalk: 4.1.2 @@ -22338,6 +22367,7 @@ packages: /jayson@4.0.0: resolution: {integrity: sha512-v2RNpDCMu45fnLzSk47vx7I+QUaOsox6f5X0CUlabAFwxoP+8MfAY0NQRFwOEYXIxm8Ih5y6OaEa5KYiQMkyAA==} engines: {node: '>=8'} + hasBin: true dependencies: '@types/connect': 3.4.37 '@types/node': 12.20.55 @@ -22871,6 +22901,7 @@ packages: /js-yaml@3.14.1: resolution: {integrity: sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==} + hasBin: true dependencies: argparse: 1.0.10 esprima: 4.0.1 @@ -25752,6 +25783,7 @@ packages: /multiaddr-to-uri@8.0.0(node-fetch@3.3.2): resolution: {integrity: sha512-dq4p/vsOOUdVEd1J1gl+R2GFrXJQH8yjLtz4hodqdVbieg39LvBOdMQRdQnfbg5LSM/q1BYNVf5CBbwZFFqBgA==} + deprecated: This module is deprecated, please upgrade to @multiformats/multiaddr-to-uri dependencies: multiaddr: 10.0.1(node-fetch@3.3.2) transitivePeerDependencies: @@ -25761,6 +25793,7 @@ packages: /multiaddr@10.0.1(node-fetch@3.3.2): resolution: {integrity: sha512-G5upNcGzEGuTHkzxezPrrD6CaIHR9uo+7MwqhNVcXTs33IInon4y7nMiGxl2CY5hG7chvYQUQhz5V52/Qe3cbg==} + deprecated: This module is deprecated, please upgrade to @multiformats/multiaddr dependencies: dns-over-http-resolver: 1.2.3(node-fetch@3.3.2) err-code: 3.0.1 @@ -27504,16 +27537,17 @@ packages: solidity-comments-extractor: 0.0.7 dev: true - /prettier@1.19.1: - resolution: {integrity: sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==} - engines: {node: '>=4'} - dev: true - /prettier@2.8.8: resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} engines: {node: '>=10.13.0'} dev: true + /prettier@3.0.3: + resolution: {integrity: sha512-L/4pUDMxcNa8R/EthV08Zt42WBO4h1rarVtK0K+QJG0X187OLo7l699jWw0GKuwzkPQ//jMFA/8Xm6Fh3J/DAg==} + engines: {node: '>=14'} + hasBin: true + dev: true + /pretty-bytes@5.6.0: resolution: {integrity: sha512-FFw039TmrBqFK8ma/7OL3sDz/VytdtJr044/QUJtH0wK9lb9jLq9tJyIxUwtQJHwar2BqtiA4iCWSwo9JLkzFg==} engines: {node: '>=6'} @@ -27671,6 +27705,7 @@ packages: /protobufjs@6.11.4: resolution: {integrity: sha512-5kQWPaJHi1WoCpjTGszzQ32PG2F4+wRY6BmAT4Vfw56Q2FZ4YZzK20xUYQH4YkfehY1e6QSICrJquM6xXZNcrw==} + hasBin: true requiresBuild: true dependencies: '@protobufjs/aspromise': 1.1.2 @@ -28783,6 +28818,7 @@ packages: /request@2.88.2: resolution: {integrity: sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==} engines: {node: '>= 6'} + deprecated: request has been deprecated, see https://github.com/request/request/issues/3142 dependencies: aws-sign2: 0.7.0 aws4: 1.12.0 @@ -29426,6 +29462,7 @@ packages: /semver@7.3.5: resolution: {integrity: sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==} engines: {node: '>=10'} + hasBin: true dependencies: lru-cache: 6.0.0 dev: true @@ -29433,6 +29470,7 @@ packages: /semver@7.4.0: resolution: {integrity: sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==} engines: {node: '>=10'} + hasBin: true dependencies: lru-cache: 6.0.0 dev: true @@ -32109,6 +32147,8 @@ packages: /uuid@3.4.0: resolution: {integrity: sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==} + deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. + hasBin: true dev: true /uuid@8.3.2: @@ -33290,12 +33330,14 @@ packages: /which@1.3.1: resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} + hasBin: true dependencies: isexe: 2.0.0 /which@2.0.2: resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} engines: {node: '>= 8'} + hasBin: true dependencies: isexe: 2.0.0 From a119c71821e514d5cc305832d68c8b1a183c4aa4 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 13 Mar 2024 21:27:32 +0100 Subject: [PATCH 2/6] fix(test): hardcoded assemblyscript version --- graph/package.json | 2 +- graph/tests/.latest.json | 2 +- pnpm-lock.yaml | 17 ++--------------- 3 files changed, 4 insertions(+), 17 deletions(-) diff --git a/graph/package.json b/graph/package.json index 3a8adc3e..c62202b7 100644 --- a/graph/package.json +++ b/graph/package.json @@ -25,7 +25,7 @@ "devDependencies": { "@graphprotocol/graph-cli": "0.68.5", "@graphprotocol/graph-ts": "0.33.0", - "assemblyscript": "0.27.25", + "assemblyscript": "0.19.23", "matchstick-as": "0.6.0" }, "//": [ diff --git a/graph/tests/.latest.json b/graph/tests/.latest.json index 69792a9d..e58ac693 100644 --- a/graph/tests/.latest.json +++ b/graph/tests/.latest.json @@ -1,4 +1,4 @@ { "version": "0.6.0", - "timestamp": 1705410292091 + "timestamp": 1710361554698 } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 90db9228..17a77b2f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -550,8 +550,8 @@ importers: specifier: 0.33.0 version: 0.33.0 assemblyscript: - specifier: 0.27.25 - version: 0.27.25 + specifier: 0.19.23 + version: 0.19.23 matchstick-as: specifier: 0.6.0 version: 0.6.0 @@ -14008,15 +14008,6 @@ packages: source-map-support: 0.5.21 dev: true - /assemblyscript@0.27.25: - resolution: {integrity: sha512-hkx6Vz+EFVA2hqFfnTWfO14892scFIkJzdXyqfXUoBS76cLbar0PFJQ7yZuL9m/i5xpjFk9Bz2094uHLh7W5UA==} - engines: {node: '>=16', npm: '>=7'} - hasBin: true - dependencies: - binaryen: 116.0.0-nightly.20240114 - long: 5.2.3 - dev: true - /assert-plus@1.0.0: resolution: {integrity: sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==} engines: {node: '>=0.8'} @@ -14508,10 +14499,6 @@ packages: /binaryen@102.0.0-nightly.20211028: resolution: {integrity: sha512-GCJBVB5exbxzzvyt8MGDv/MeUjs6gkXDvf4xOIItRBptYl0Tz5sm1o/uG95YK0L0VeG5ajDu3hRtkBP2kzqC5w==} - dev: true - - /binaryen@116.0.0-nightly.20240114: - resolution: {integrity: sha512-0GZrojJnuhoe+hiwji7QFaL3tBlJoA+KFUN7ouYSDGZLSo9CKM8swQX8n/UcbR0d1VuZKU+nhogNzv423JEu5A==} hasBin: true dev: true From f3530a2f11db411174f6b49af0e0bb011847283a Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 13 Mar 2024 21:34:20 +0100 Subject: [PATCH 3/6] fix(test): updated ids in tests --- graph/tests/hypercert-minter-burn.test.ts | 8 +- graph/tests/hypercert-minter-claim.test.ts | 8 +- graph/tests/hypercert-minter-fraction.test.ts | 77 +++++++++---------- 3 files changed, 46 insertions(+), 47 deletions(-) diff --git a/graph/tests/hypercert-minter-burn.test.ts b/graph/tests/hypercert-minter-burn.test.ts index 09d35de4..c06ee2f0 100644 --- a/graph/tests/hypercert-minter-burn.test.ts +++ b/graph/tests/hypercert-minter-burn.test.ts @@ -67,7 +67,9 @@ describe("Describe entity assertions", () => { handleValueTransfer(valueTransferEvent); - let fractionId = getDefaultContractAddress().toHexString().concat("-1"); + let fractionId = "1-".concat( + getDefaultContractAddress().toHexString().concat("-1"), + ); assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); @@ -144,7 +146,9 @@ describe("Describe entity assertions", () => { handleBatchValueTransfer(valueTransferEvent); - let fractionId = getDefaultContractAddress().toHexString().concat("-1"); + let fractionId = "1-".concat( + getDefaultContractAddress().toHexString().concat("-1"), + ); assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); diff --git a/graph/tests/hypercert-minter-claim.test.ts b/graph/tests/hypercert-minter-claim.test.ts index b7a6e45a..e9f1ddcf 100644 --- a/graph/tests/hypercert-minter-claim.test.ts +++ b/graph/tests/hypercert-minter-claim.test.ts @@ -34,9 +34,11 @@ describe("Describe entity assertions", () => { assert.entityCount("Claim", 1); assert.entityCount("ClaimFraction", 0); - let claimId = getDefaultContractAddress() - .toHexString() - .concat("-".concat(BigInt.fromI64(1).toString())); + let claimId = "1-".concat( + getDefaultContractAddress() + .toHexString() + .concat("-".concat(BigInt.fromI64(1).toString())), + ); assert.fieldEquals("Claim", claimId, "uri", "ipfs://exampleshash"); assert.fieldEquals( diff --git a/graph/tests/hypercert-minter-fraction.test.ts b/graph/tests/hypercert-minter-fraction.test.ts index cf916bed..1c7ad235 100644 --- a/graph/tests/hypercert-minter-fraction.test.ts +++ b/graph/tests/hypercert-minter-fraction.test.ts @@ -37,7 +37,7 @@ describe("Describe entity assertions", () => { let from = Address.fromString("0x0000000000000000000000000000000000000001"); let to = Address.fromString("0x0000000000000000000000000000000000000002"); let operator = Address.fromString( - "0x0000000000000000000000000000000000000003" + "0x0000000000000000000000000000000000000003", ); let transferSingleEvent = createTransferSingleEvent( @@ -45,7 +45,7 @@ describe("Describe entity assertions", () => { from, to, BigInt.fromI64(1), - BigInt.fromI64(1) + BigInt.fromI64(1), ); handleTransferSingle(transferSingleEvent); @@ -68,13 +68,13 @@ describe("Describe entity assertions", () => { claimID, fromID, toID, - units + units, ); createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(toID)]) .returns([ethereum.Value.fromAddress(from)]); @@ -82,16 +82,16 @@ describe("Describe entity assertions", () => { createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(fromID)]) .returns([ethereum.Value.fromAddress(from)]); handleValueTransfer(valueTransferEvent); - let fractionId = getDefaultContractAddress() - .toHexString() - .concat("-1"); + let fractionId = "1-".concat( + getDefaultContractAddress().toHexString().concat("-1"), + ); assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); @@ -100,7 +100,7 @@ describe("Describe entity assertions", () => { from, to, BigInt.fromI64(1), - BigInt.fromI64(1) + BigInt.fromI64(1), ); handleTransferSingle(transferSingleEvent); @@ -122,13 +122,13 @@ describe("Describe entity assertions", () => { claimID, fromID, toID, - units + units, ); createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(toID)]) .returns([ethereum.Value.fromAddress(from)]); @@ -136,7 +136,7 @@ describe("Describe entity assertions", () => { createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(fromID)]) .returns([ethereum.Value.fromAddress(from)]); @@ -148,18 +148,16 @@ describe("Describe entity assertions", () => { //TODO also generates claim base token, should this only mint 1 fraction? assert.entityCount("ClaimToken", 2); - let fractionId = getDefaultContractAddress() - .toHexString() - .concat("-1"); + let fractionId = "1-".concat( + getDefaultContractAddress().toHexString().concat("-1"), + ); assert.fieldEquals("ClaimToken", fractionId, "tokenID", "1"); assert.fieldEquals( "ClaimToken", fractionId, "claim", - getDefaultContractAddress() - .toHexString() - .concat("-1") + getDefaultContractAddress().toHexString().concat("-1"), ); assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); @@ -178,13 +176,13 @@ describe("Describe entity assertions", () => { claimID, fromID, toID, - units + units, ); createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(toID)]) .returns([ethereum.Value.fromAddress(from)]); @@ -192,7 +190,7 @@ describe("Describe entity assertions", () => { createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(fromID)]) .returns([ethereum.Value.fromAddress(from)]); @@ -201,13 +199,13 @@ describe("Describe entity assertions", () => { assert.entityCount("ClaimToken", 2); - let fractionIdZero = getDefaultContractAddress() - .toHexString() - .concat("-0"); + let fractionIdZero = "1-".concat( + getDefaultContractAddress().toHexString().concat("-0"), + ); - let fractionIdOne = getDefaultContractAddress() - .toHexString() - .concat("-1"); + let fractionIdOne = "1-".concat( + getDefaultContractAddress().toHexString().concat("-1"), + ); assert.fieldEquals("ClaimToken", fractionIdZero, "tokenID", "0"); assert.fieldEquals("ClaimToken", fractionIdZero, "units", "0"); @@ -220,17 +218,15 @@ describe("Describe entity assertions", () => { claimID, toID, newTokenID, - units + units, ); - let fractionIdTwo = getDefaultContractAddress() - .toHexString() - .concat("-2"); + let fractionIdTwo = getDefaultContractAddress().toHexString().concat("-2"); createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(newTokenID)]) .returns([ethereum.Value.fromAddress(from)]); @@ -261,14 +257,14 @@ describe("Describe entity assertions", () => { claimIDs, fromIDs, toIDs, - values + values, ); for (let i = 0; i < size.toI64(); i++) { createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(toIDs[i])]) .returns([ethereum.Value.fromAddress(from)]); @@ -276,7 +272,7 @@ describe("Describe entity assertions", () => { createMockedFunction( getDefaultContractAddress(), "ownerOf", - "ownerOf(uint256):(address)" + "ownerOf(uint256):(address)", ) .withArgs([ethereum.Value.fromUnsignedBigInt(fromIDs[i])]) .returns([ethereum.Value.fromAddress(from)]); @@ -289,18 +285,15 @@ describe("Describe entity assertions", () => { //TODO also build 0 token.. assert.entityCount("ClaimToken", 6); - let fractionId = getDefaultContractAddress() - .toHexString() - .concat("-1"); - + let fractionId = "1-".concat( + getDefaultContractAddress().toHexString().concat("-0"), + ); assert.fieldEquals("ClaimToken", fractionId, "tokenID", "1"); assert.fieldEquals( "ClaimToken", fractionId, "claim", - getDefaultContractAddress() - .toHexString() - .concat("-1") + getDefaultContractAddress().toHexString().concat("-1"), ); assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); assert.fieldEquals("ClaimToken", fractionId, "units", "200"); //function of buildValues (100 + i * 100) From fc0087cd989d92c370bb95e8e3aea7f27af7b9d2 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 13 Mar 2024 21:43:44 +0100 Subject: [PATCH 4/6] fix(test): yada yada --- graph/tests/hypercert-minter-fraction.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/graph/tests/hypercert-minter-fraction.test.ts b/graph/tests/hypercert-minter-fraction.test.ts index 1c7ad235..7eb3c8c2 100644 --- a/graph/tests/hypercert-minter-fraction.test.ts +++ b/graph/tests/hypercert-minter-fraction.test.ts @@ -221,7 +221,9 @@ describe("Describe entity assertions", () => { units, ); - let fractionIdTwo = getDefaultContractAddress().toHexString().concat("-2"); + let fractionIdTwo = "1-".concat( + getDefaultContractAddress().toHexString().concat("-2"), + ); createMockedFunction( getDefaultContractAddress(), @@ -293,7 +295,7 @@ describe("Describe entity assertions", () => { "ClaimToken", fractionId, "claim", - getDefaultContractAddress().toHexString().concat("-1"), + "1-".concat(getDefaultContractAddress().toHexString().concat("-1")), ); assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); assert.fieldEquals("ClaimToken", fractionId, "units", "200"); //function of buildValues (100 + i * 100) From 5b73030fa8e8835af8159686058ddd17a7af559b Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 13 Mar 2024 21:50:03 +0100 Subject: [PATCH 5/6] fix(test): bla bla --- graph/tests/hypercert-minter-allowlist.test.ts | 12 +++++++----- graph/tests/hypercert-minter-fraction.test.ts | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/graph/tests/hypercert-minter-allowlist.test.ts b/graph/tests/hypercert-minter-allowlist.test.ts index 11462087..21825b0a 100644 --- a/graph/tests/hypercert-minter-allowlist.test.ts +++ b/graph/tests/hypercert-minter-allowlist.test.ts @@ -21,7 +21,7 @@ describe("Describe entity assertions", () => { let allowlistCreatedEvent = createAllowlistCreatedEvent( tokenID, - Bytes.fromUTF8("MerkleRoot") + Bytes.fromUTF8("MerkleRoot"), ); handleAllowlistCreated(allowlistCreatedEvent); @@ -33,9 +33,11 @@ describe("Describe entity assertions", () => { test("AllowlistCreated generates one allowlist entity", () => { let merkleRoot = Bytes.fromUTF8("MerkleRoot"); - let allowlistID = getDefaultContractAddress() - .toHexString() - .concat("-".concat(BigInt.fromI64(1).toString())); + let allowlistID = "1-".concat( + getDefaultContractAddress() + .toHexString() + .concat("-".concat(BigInt.fromI64(1).toString())), + ); assert.entityCount("Allowlist", 1); assert.entityCount("Claim", 0); @@ -46,7 +48,7 @@ describe("Describe entity assertions", () => { "Allowlist", allowlistID, "root", - merkleRoot.toHexString() + merkleRoot.toHexString(), ); assert.fieldEquals("Allowlist", allowlistID, "claim", allowlistID); }); diff --git a/graph/tests/hypercert-minter-fraction.test.ts b/graph/tests/hypercert-minter-fraction.test.ts index 7eb3c8c2..1cdfb26f 100644 --- a/graph/tests/hypercert-minter-fraction.test.ts +++ b/graph/tests/hypercert-minter-fraction.test.ts @@ -157,7 +157,7 @@ describe("Describe entity assertions", () => { "ClaimToken", fractionId, "claim", - getDefaultContractAddress().toHexString().concat("-1"), + "1-".concat(getDefaultContractAddress().toHexString().concat("-1")), ); assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); From 6c5ac61463632dde0304b774171fc96fa85797c1 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Wed, 13 Mar 2024 21:56:06 +0100 Subject: [PATCH 6/6] fix(test): whop whop --- graph/tests/hypercert-minter-fraction.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graph/tests/hypercert-minter-fraction.test.ts b/graph/tests/hypercert-minter-fraction.test.ts index 1cdfb26f..961dc347 100644 --- a/graph/tests/hypercert-minter-fraction.test.ts +++ b/graph/tests/hypercert-minter-fraction.test.ts @@ -288,7 +288,7 @@ describe("Describe entity assertions", () => { assert.entityCount("ClaimToken", 6); let fractionId = "1-".concat( - getDefaultContractAddress().toHexString().concat("-0"), + getDefaultContractAddress().toHexString().concat("-1"), ); assert.fieldEquals("ClaimToken", fractionId, "tokenID", "1"); assert.fieldEquals(