diff --git a/.github/workflows/call.check-query-schema-against-subgraph.yml b/.github/workflows/call.check-query-schema-against-subgraph.yml index 6aafa0714f..95e4a659ac 100644 --- a/.github/workflows/call.check-query-schema-against-subgraph.yml +++ b/.github/workflows/call.check-query-schema-against-subgraph.yml @@ -34,6 +34,10 @@ jobs: run: yarn build working-directory: ./packages/ethereum-contracts + - name: Get Hosted Service Networks from metadata + run: npx ts-node ./scripts/getHostedServiceNetworks.ts + working-directory: ./packages/subgraph + - name: Run schema check run: | ./tasks/setupTestEnvironment.sh diff --git a/.github/workflows/call.deploy-subgraph.yml b/.github/workflows/call.deploy-subgraph.yml index 82d5f0c22e..c97e28b380 100644 --- a/.github/workflows/call.deploy-subgraph.yml +++ b/.github/workflows/call.deploy-subgraph.yml @@ -97,6 +97,10 @@ jobs: run: "yarn codegen" working-directory: ${{ env.subgraph-working-directory }} + - name: Get Hosted Service Networks from metadata + run: npx ts-node ./scripts/getHostedServiceNetworks.ts + working-directory: ${{ env.subgraph-working-directory }} + # - name: Ensure deployment_env property is passed # run: | # if [ "${{ inputs.deployment_env }}" == "" ];then diff --git a/.github/workflows/call.test-local-subgraph.yml b/.github/workflows/call.test-local-subgraph.yml index ac3e767415..0d55f56848 100644 --- a/.github/workflows/call.test-local-subgraph.yml +++ b/.github/workflows/call.test-local-subgraph.yml @@ -8,6 +8,9 @@ jobs: name: Run subgraph unit tests runs-on: ubuntu-latest + env: + subgraph-working-directory: ./packages/subgraph + defaults: run: shell: nix develop -c bash -xe {0} @@ -34,10 +37,14 @@ jobs: - name: "Build contracts" run: yarn build working-directory: ./packages/ethereum-contracts + + - name: "Build" + run: npx ts-node scripts/buildNetworkConfig.ts polygon-mainnet + working-directory: ${{ env.subgraph-working-directory }} - name: "Run unit tests" run: yarn matchstick - working-directory: ./packages/subgraph + working-directory: ${{ env.subgraph-working-directory }} subgraph-end-to-end-integration: name: Run subgraph integration tests diff --git a/packages/metadata/module/networks/list.d.ts b/packages/metadata/module/networks/list.d.ts index ea2ecef4f6..620a360eeb 100644 --- a/packages/metadata/module/networks/list.d.ts +++ b/packages/metadata/module/networks/list.d.ts @@ -23,7 +23,7 @@ interface ContractAddresses { } interface SubgraphData { readonly name: string; - readonly hostedEndpoint: string; + readonly hostedEndpoint?: string; readonly satsumaEndpoint?: string; } export interface NetworkMetaData { diff --git a/packages/subgraph/.gitignore b/packages/subgraph/.gitignore index aa483013e4..ece682f377 100644 --- a/packages/subgraph/.gitignore +++ b/packages/subgraph/.gitignore @@ -8,4 +8,5 @@ tasks/config src/addresses.ts **/*.wasm **/*.latest.json -tests/.bin \ No newline at end of file +tests/.bin +hosted-service-networks.json \ No newline at end of file diff --git a/packages/subgraph/config/arbitrum-goerli.json b/packages/subgraph/config/arbitrum-goerli.json deleted file mode 100644 index 428b8a27ef..0000000000 --- a/packages/subgraph/config/arbitrum-goerli.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "arbitrum-goerli", - "hostStartBlock": 93000, - "hostAddress": "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", - "cfaAddress": "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", - "idaAddress": "0x96215257F2FcbB00135578f766c0449d239bd92F", - "superTokenFactoryAddress": "0x9aCc39d15e3f168c111a1D4F80271a9E526c9a9F", - "resolverV1Address": "0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136", - "nativeAssetSuperTokenAddress": "0xE01F8743677Da897F4e7De9073b57Bf034FC2433" -} \ No newline at end of file diff --git a/packages/subgraph/config/arbitrum-one.json b/packages/subgraph/config/arbitrum-one.json deleted file mode 100644 index 68a1bdf0cc..0000000000 --- a/packages/subgraph/config/arbitrum-one.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "arbitrum-one", - "hostStartBlock": 7600000, - "hostAddress": "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192", - "cfaAddress": "0x731FdBB12944973B500518aea61942381d7e240D", - "idaAddress": "0x2319C7e07EB063340D2a0E36709B0D65fda75986", - "superTokenFactoryAddress": "0x1C21Ead77fd45C84a4c916Db7A6635D0C6FF09D6", - "resolverV1Address": "0x609b9d9d6Ee9C3200745A79B9d3398DBd63d509F", - "nativeAssetSuperTokenAddress": "0xe6c8d111337d0052b9d88bf5d7d55b7f8385acd3" -} diff --git a/packages/subgraph/config/avalanche-c.json b/packages/subgraph/config/avalanche-c.json deleted file mode 100644 index d6515a63a2..0000000000 --- a/packages/subgraph/config/avalanche-c.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "avalanche", - "hostStartBlock": 14701205, - "hostAddress": "0x60377C7016E4cdB03C87EF474896C11cB560752C", - "cfaAddress": "0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58", - "idaAddress": "0x1fA9fFe8Db73F701454B195151Db4Abb18423cf2", - "superTokenFactoryAddress": "0x464AADdBB2B80f3Cb666522EB7381bE610F638b4", - "resolverV1Address": "0x24a3F04F70B7f07B9673EadD3e146391BcfEa5c1", - "nativeAssetSuperTokenAddress": "0xbe916845d8678b5d2f7ad79525a62d7c08abba7e" -} \ No newline at end of file diff --git a/packages/subgraph/config/avalanche-fuji.json b/packages/subgraph/config/avalanche-fuji.json deleted file mode 100644 index 43f22f1b19..0000000000 --- a/packages/subgraph/config/avalanche-fuji.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "fuji", - "hostStartBlock": 21012000, - "hostAddress": "0x85Fe79b998509B77BF10A8BD4001D58475D29386", - "cfaAddress": "0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A", - "idaAddress": "0xA44dEC7A0Dde1a56AeDe4143C1ef89cf5d956782", - "superTokenFactoryAddress": "0x1C92042426B6bAAe497bEf461B6d8342D03aEc92", - "resolverV1Address": "0xf0ec6A8842Ca72Aec8A4D4573E731242389e18A8", - "nativeAssetSuperTokenAddress": "0xfFD0f6d73ee52c68BF1b01C8AfA2529C97ca17F3" -} \ No newline at end of file diff --git a/packages/subgraph/config/base-goerli.json b/packages/subgraph/config/base-goerli.json deleted file mode 100644 index 0742a2c3e7..0000000000 --- a/packages/subgraph/config/base-goerli.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "base-testnet", - "hostStartBlock": 5249500, - "hostAddress": "0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6", - "cfaAddress": "0x4C476F2Fb27272680F2f6f2592E94d9e704691bC", - "idaAddress": "0xaa4FCc799B8857FA87b2945Dc6572D5d76b35485", - "superTokenFactoryAddress": "0x1015BE31D7711D95d2c3444708FB53cC851ba856", - "resolverV1Address": "0x598D5dB9902cbBd6e8Ee9CDb3A231377cdA2f018", - "nativeAssetSuperTokenAddress": "0x7fFCE315B2014546bA461d54eDed7AAc70DF4f53" -} \ No newline at end of file diff --git a/packages/subgraph/config/base-mainnet.json b/packages/subgraph/config/base-mainnet.json deleted file mode 100644 index 5596f2d45c..0000000000 --- a/packages/subgraph/config/base-mainnet.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "base", - "hostStartBlock": 1000000, - "hostAddress": "0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74", - "cfaAddress": "0x19ba78B9cDB05A877718841c574325fdB53601bb", - "idaAddress": "0x66DF3f8e14CF870361378d8F61356D15d9F425C4", - "superTokenFactoryAddress": "0xe20B9a38E0c96F61d1bA6b42a61512D56Fea1Eb3", - "resolverV1Address": "0x6a214c324553F96F04eFBDd66908685525Da0E0d", - "nativeAssetSuperTokenAddress": "0x46fd5cfB4c12D87acD3a13e92BAa53240C661D93" -} \ No newline at end of file diff --git a/packages/subgraph/config/bsc-mainnet.json b/packages/subgraph/config/bsc-mainnet.json deleted file mode 100644 index 24fefe9cfa..0000000000 --- a/packages/subgraph/config/bsc-mainnet.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "network": "bsc", - "hostStartBlock": 18803461, - "hostAddress": "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E", - "cfaAddress": "0x49c38108870e74Cb9420C0991a85D3edd6363F75", - "idaAddress": "0x594ed9Cd773584B645aC1F5B11020d3b32cDF07d", - "superTokenFactoryAddress": "0x8bde47397301F0Cd31b9000032fD517a39c946Eb", - "superfluidGovernanceAddress": "0xee07D9fce4Cf2a891BC979E9d365929506C2982f", - "resolverV1Address": "0x69604aA4e9e8BF44A73C680997205Edb03A92E41", - "nativeAssetSuperTokenAddress": "0x529a4116f160c833c61311569d6b33dff41fd657" -} \ No newline at end of file diff --git a/packages/subgraph/config/celo-mainnet.json b/packages/subgraph/config/celo-mainnet.json deleted file mode 100644 index 81ca7261e7..0000000000 --- a/packages/subgraph/config/celo-mainnet.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "celo", - "hostStartBlock": 16393000, - "hostAddress": "0xA4Ff07cF81C02CFD356184879D953970cA957585", - "cfaAddress": "0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad", - "idaAddress": "0x26747Fe93fAC8bF28E1e24A558a2bC7E4d9846cA", - "superTokenFactoryAddress": "0x36be86dEe6BC726Ed0Cbd170ccD2F21760BC73D9", - "resolverV1Address": "0x05eE721BD4D803d6d477Aa7607395452B65373FF", - "nativeAssetSuperTokenAddress": "0x671425Ae1f272Bc6F79beC3ed5C4b00e9c628240" -} \ No newline at end of file diff --git a/packages/subgraph/config/eth-goerli.json b/packages/subgraph/config/eth-goerli.json deleted file mode 100644 index 2d133e9ccc..0000000000 --- a/packages/subgraph/config/eth-goerli.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "goerli", - "hostStartBlock": 4103102, - "hostAddress": "0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9", - "cfaAddress": "0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8", - "idaAddress": "0xfDdcdac21D64B639546f3Ce2868C7EF06036990c", - "superTokenFactoryAddress": "0x94f26B4c8AD12B18c12f38E878618f7664bdcCE2", - "resolverV1Address": "0x3710AB3fDE2B61736B8BB0CE845D6c61F667a78E", - "nativeAssetSuperTokenAddress": "0x5943f705abb6834cad767e6e4bb258bc48d9c947" -} diff --git a/packages/subgraph/config/eth-mainnet.json b/packages/subgraph/config/eth-mainnet.json deleted file mode 100644 index 97f28df431..0000000000 --- a/packages/subgraph/config/eth-mainnet.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "mainnet", - "hostStartBlock": 15870000, - "hostAddress": "0x4E583d9390082B65Bef884b629DFA426114CED6d", - "cfaAddress": "0x2844c1BBdA121E9E43105630b9C8310e5c72744b", - "idaAddress": "0xbCF9cfA8Da20B591790dF27DE65C1254Bf91563d", - "superTokenFactoryAddress": "0x0422689cc4087b6B7280e0a7e7F655200ec86Ae1", - "resolverV1Address": "0xeE4cD028f5fdaAdeA99f8fc38e8bA8A57c90Be53", - "nativeAssetSuperTokenAddress": "0xc22bea0be9872d8b7b3933cec70ece4d53a900da" -} diff --git a/packages/subgraph/config/eth-sepolia.json b/packages/subgraph/config/eth-sepolia.json deleted file mode 100644 index dc4b130696..0000000000 --- a/packages/subgraph/config/eth-sepolia.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "sepolia", - "hostStartBlock": 3322400, - "hostAddress": "0x109412E3C84f0539b43d39dB691B08c90f58dC7c", - "cfaAddress": "0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef", - "idaAddress": "0x9358C7dCCc6B8CA6F526311e8ac266F8C861B7ea", - "superTokenFactoryAddress": "0x53F4f44C813Dc380182d0b2b67fe5832A12B97f8", - "resolverV1Address": "0x6813edE4E78ecb830d380d0F7F684c12aAc95F02", - "nativeAssetSuperTokenAddress": "0x30a6933Ca9230361972E413a15dC8114c952414e" -} \ No newline at end of file diff --git a/packages/subgraph/config/goerli.json b/packages/subgraph/config/goerli.json deleted file mode 120000 index b1fa8b26d6..0000000000 --- a/packages/subgraph/config/goerli.json +++ /dev/null @@ -1 +0,0 @@ -eth-goerli.json \ No newline at end of file diff --git a/packages/subgraph/config/matic.json b/packages/subgraph/config/matic.json deleted file mode 120000 index 2e2ee58a1c..0000000000 --- a/packages/subgraph/config/matic.json +++ /dev/null @@ -1 +0,0 @@ -polygon-mainnet.json \ No newline at end of file diff --git a/packages/subgraph/config/mumbai.json b/packages/subgraph/config/mumbai.json deleted file mode 120000 index d88c6eff9b..0000000000 --- a/packages/subgraph/config/mumbai.json +++ /dev/null @@ -1 +0,0 @@ -polygon-mumbai.json \ No newline at end of file diff --git a/packages/subgraph/config/optimism-goerli.json b/packages/subgraph/config/optimism-goerli.json deleted file mode 100644 index 925e97b531..0000000000 --- a/packages/subgraph/config/optimism-goerli.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "optimism-goerli", - "hostStartBlock": 340000, - "hostAddress": "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", - "cfaAddress": "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", - "idaAddress": "0x96215257F2FcbB00135578f766c0449d239bd92F", - "superTokenFactoryAddress": "0x9aCc39d15e3f168c111a1D4F80271a9E526c9a9F", - "resolverV1Address": "0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136", - "nativeAssetSuperTokenAddress": "0xE01F8743677Da897F4e7De9073b57Bf034FC2433" -} \ No newline at end of file diff --git a/packages/subgraph/config/optimism-mainnet.json b/packages/subgraph/config/optimism-mainnet.json deleted file mode 100644 index aedd5cd6ab..0000000000 --- a/packages/subgraph/config/optimism-mainnet.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "optimism", - "hostStartBlock": 4300000, - "hostAddress": "0x567c4B141ED61923967cA25Ef4906C8781069a10", - "cfaAddress": "0x204C6f131bb7F258b2Ea1593f5309911d8E458eD", - "idaAddress": "0xc4ce5118C3B20950ee288f086cb7FC166d222D4c", - "superTokenFactoryAddress": "0x8276469A443D5C6B7146BED45e2abCaD3B6adad9", - "resolverV1Address": "0x743B5f46BC86caF41bE4956d9275721E0531B186", - "nativeAssetSuperTokenAddress": "0x4ac8bd1bdae47beef2d1c6aa62229509b962aa0d" -} diff --git a/packages/subgraph/config/polygon-mainnet.json b/packages/subgraph/config/polygon-mainnet.json deleted file mode 100644 index b1dcee648f..0000000000 --- a/packages/subgraph/config/polygon-mainnet.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "matic", - "hostStartBlock": 11650607, - "hostAddress": "0x3E14dC1b13c488a8d5D310918780c983bD5982E7", - "cfaAddress": "0x6EeE6060f715257b970700bc2656De21dEdF074C", - "idaAddress": "0xB0aABBA4B2783A72C52956CDEF62d438ecA2d7a1", - "superTokenFactoryAddress": "0x2C90719f25B10Fc5646c82DA3240C76Fa5BcCF34", - "resolverV1Address": "0xE0cc76334405EE8b39213E620587d815967af39C", - "nativeAssetSuperTokenAddress": "0x3ad736904e9e65189c3000c7dd2c8ac8bb7cd4e3" -} diff --git a/packages/subgraph/config/polygon-mumbai.json b/packages/subgraph/config/polygon-mumbai.json deleted file mode 100644 index d787c406cf..0000000000 --- a/packages/subgraph/config/polygon-mumbai.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "mumbai", - "hostStartBlock": 9343671, - "hostAddress": "0xEB796bdb90fFA0f28255275e16936D25d3418603", - "cfaAddress": "0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873", - "idaAddress": "0x804348D4960a61f2d5F9ce9103027A3E849E09b8", - "superTokenFactoryAddress": "0x200657E2f123761662567A1744f9ACAe50dF47E6", - "resolverV1Address": "0x8C54C83FbDe3C59e59dd6E324531FB93d4F504d3", - "nativeAssetSuperTokenAddress": "0x96b82b65acf7072efeb00502f45757f254c2a0d4" -} diff --git a/packages/subgraph/config/polygon-zkevm-testnet.json b/packages/subgraph/config/polygon-zkevm-testnet.json deleted file mode 100644 index d88a049095..0000000000 --- a/packages/subgraph/config/polygon-zkevm-testnet.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "polygon-zkevm-testnet", - "hostStartBlock": 726000, - "hostAddress": "0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704", - "cfaAddress": "0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee", - "idaAddress": "0xBf22019a4A4430bA67D3B0c8B4d5Edc48F913301", - "superTokenFactoryAddress": "0x0F3B163623F05b2BfF42956f7C7bd31456bd83a2", - "resolverV1Address": "0x642332562BC60a4Bd9681E7bb1588f7456A497aC", - "nativeAssetSuperTokenAddress": "0x6345Aa6cec42a85160CF436810F97661e28c1876" -} \ No newline at end of file diff --git a/packages/subgraph/config/xdai-mainnet.json b/packages/subgraph/config/xdai-mainnet.json deleted file mode 100644 index e69484442f..0000000000 --- a/packages/subgraph/config/xdai-mainnet.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "network": "gnosis", - "hostStartBlock": 14829086, - "hostAddress": "0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7", - "cfaAddress": "0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D", - "idaAddress": "0x7888ac96F987Eb10E291F34851ae0266eF912081", - "superTokenFactoryAddress": "0x23410e2659380784498509698ed70E414D384880", - "resolverV1Address": "0xD2009765189164b495c110D61e4D301729079911", - "nativeAssetSuperTokenAddress": "0x59988e47a3503aafaa0368b9def095c818fdca01" -} diff --git a/packages/subgraph/config/xdai.json b/packages/subgraph/config/xdai.json deleted file mode 120000 index 8aa5dc56a6..0000000000 --- a/packages/subgraph/config/xdai.json +++ /dev/null @@ -1 +0,0 @@ -xdai-mainnet.json \ No newline at end of file diff --git a/packages/subgraph/hosted-service-networks.json b/packages/subgraph/hosted-service-networks.json deleted file mode 100644 index e67ca35d9a..0000000000 --- a/packages/subgraph/hosted-service-networks.json +++ /dev/null @@ -1,15 +0,0 @@ -[ - "eth-mainnet", - "polygon-mainnet", - "xdai-mainnet", - "optimism-mainnet", - "arbitrum-one", - "avalanche-c", - "eth-goerli", - "polygon-mumbai", - "arbitrum-goerli", - "optimism-goerli", - "avalanche-fuji", - "bsc-mainnet", - "celo-mainnet" -] diff --git a/packages/subgraph/package.json b/packages/subgraph/package.json index 1775a24946..d6b81e54fc 100644 --- a/packages/subgraph/package.json +++ b/packages/subgraph/package.json @@ -18,8 +18,8 @@ "pretest": "yarn testenv:start", "test": "npx hardhat test", "matchstick": "run-s matchstick:*", - "matchstick:prepare-manifest": "mustache config/matic.json subgraph.template.yaml > subgraph.yaml", - "matchstick:prepare-addresses": "mustache config/matic.json src/addresses.template.ts > src/addresses.ts", + "matchstick:prepare-manifest": "mustache config/polygon-mainnet.json subgraph.template.yaml > subgraph.yaml", + "matchstick:prepare-addresses": "mustache config/polygon-mainnet.json src/addresses.template.ts > src/addresses.ts", "matchstick:prepare-generated": "yarn getAbi && yarn codegen && yarn generate-sf-meta-local", "matchstick:test": "graph test", "dev": "nodemon -e ts -x yarn matchstick:test", diff --git a/packages/subgraph/scripts/buildNetworkConfig.ts b/packages/subgraph/scripts/buildNetworkConfig.ts new file mode 100644 index 0000000000..35a073eba6 --- /dev/null +++ b/packages/subgraph/scripts/buildNetworkConfig.ts @@ -0,0 +1,48 @@ +import fs from "fs"; +import metadata from "@superfluid-finance/metadata"; + +interface SubgraphConfig { + readonly network: string; + readonly hostStartBlock: number; + readonly hostAddress: string; + readonly cfaAddress: string; + readonly idaAddress: string; + readonly superTokenFactoryAddress: string; + readonly resolverV1Address: string; + readonly nativeAssetSuperTokenAddress: string; +} + +// script usage: npx ts-node ./scripts/buildNetworkConfig.ts +function main() { + const networkName = process.argv[2]; + + const networkMetadata = metadata.getNetworkByName(networkName); + + if (!networkMetadata) { + throw new Error("No metadata found"); + } + const newThing: SubgraphConfig = { + network: networkMetadata.shortName, + hostStartBlock: networkMetadata.startBlockV1, + hostAddress: networkMetadata.contractsV1.host, + cfaAddress: networkMetadata.contractsV1.cfaV1, + idaAddress: networkMetadata.contractsV1.idaV1, + superTokenFactoryAddress: networkMetadata.contractsV1.superTokenFactory, + resolverV1Address: networkMetadata.contractsV1.resolver, + nativeAssetSuperTokenAddress: networkMetadata.nativeTokenWrapper, + }; + + const writeToDir = + __dirname.split("subgraph")[0] + `subgraph/config/${networkName}.json`; + + fs.writeFile(writeToDir, JSON.stringify(newThing), (err) => { + if (err) { + console.log(err); + process.exit(1); + } else { + process.exit(0); + } + }); +} + +main(); diff --git a/packages/subgraph/scripts/getHostedServiceNetworks.ts b/packages/subgraph/scripts/getHostedServiceNetworks.ts new file mode 100644 index 0000000000..8ecdb6ba00 --- /dev/null +++ b/packages/subgraph/scripts/getHostedServiceNetworks.ts @@ -0,0 +1,28 @@ +import fs from "fs"; +import metadata from "@superfluid-finance/metadata"; + +// This script is used to retrieve the list of networks which have a hosted +// service endpoint. +// script usage: npx ts-node ./scripts/getHostedServiceNetworks.ts +function main() { + const networks = JSON.stringify( + metadata.networks + .filter((x) => x.subgraphV1.hostedEndpoint != null) + .map((x) => x.name) + ); + + const writeToDir = + __dirname.split("subgraph")[0] + + "subgraph/hosted-service-networks.json"; + + fs.writeFile(writeToDir, networks, (err) => { + if (err) { + console.log(err); + process.exit(1); + } else { + process.exit(0); + } + }); +} + +main(); diff --git a/packages/subgraph/tasks/deploy.sh b/packages/subgraph/tasks/deploy.sh index 42af53f1bd..6bede4eab7 100755 --- a/packages/subgraph/tasks/deploy.sh +++ b/packages/subgraph/tasks/deploy.sh @@ -111,7 +111,9 @@ deploy_to_superfluid() { } # Vendor specific function dispatcher -# Expected arguments: vendor, canonical network name +# Expected arguments: +# $1 - vendor +# $2 - canonical network name deploy_to() { local vendor="$1" local network="$2" @@ -125,6 +127,8 @@ deploy_to() { exit 1 fi + npx ts-node ./scripts/buildNetworkConfig.ts "$network" + # prepare the manifest prior to deployment # this generates the subgraph.yaml and # inputs the correct addresses for the specified network ($2)