diff --git a/scripts/generate-manifests.js b/scripts/generate-manifests.js index b125957..aa50b19 100644 --- a/scripts/generate-manifests.js +++ b/scripts/generate-manifests.js @@ -1,10 +1,16 @@ const fs = require('fs'); const path = require('path'); -const yaml = require('js-yaml'); const networksData = JSON.parse(fs.readFileSync('networks.json', 'utf8')); function replacePlaceholders(template, network, networkData) { + template = template.replace(/{{#if ([^}]+)}}([\s\S]*?){{\/if}}/g, (match, factoryName, content) => { + if (networkData[factoryName]) { + return content; + } + return ''; + }); + let result = template.replace(/{{ network }}/g, network); for (const [contractName, contractData] of Object.entries(networkData)) { @@ -12,7 +18,12 @@ function replacePlaceholders(template, network, networkData) { result = result.replace(new RegExp(`{{ ${contractName}\\.startBlock }}`, 'g'), contractData.startBlock.toString()); } - return result; + result = result + .split('\n') + .filter(line => line.trim() !== '') + .join('\n'); + + return result + '\n'; } ['v3-pools', 'v3-vault'].forEach(subgraph => { @@ -24,7 +35,6 @@ function replacePlaceholders(template, network, networkData) { } const template = fs.readFileSync(templatePath, 'utf8'); - Object.entries(networksData).forEach(([network, networkData]) => { const config = replacePlaceholders(template, network, networkData); const outputPath = path.join('subgraphs', subgraph, `subgraph${network === 'mainnet' ? '' : `.${network}`}.yaml`); @@ -33,4 +43,4 @@ function replacePlaceholders(template, network, networkData) { }); }); -console.log('🎉 v3 subgraphs successfully generated\n'); +console.log('🎉 v3 subgraphs successfully generated\n'); \ No newline at end of file diff --git a/subgraphs/v3-pools/subgraph.sepolia.yaml b/subgraphs/v3-pools/subgraph.sepolia.yaml index d3995af..cd1ee8c 100644 --- a/subgraphs/v3-pools/subgraph.sepolia.yaml +++ b/subgraphs/v3-pools/subgraph.sepolia.yaml @@ -48,3 +48,49 @@ dataSources: - event: PoolCreated(indexed address) handler: handleStablePoolCreated file: ./src/mappings/stable.ts + - kind: ethereum + name: Gyro2CLPPoolFactory + network: sepolia + source: + abi: BasePoolFactory + address: "0x97701aa7c9ae4497874C54B1C779221d6F1081C9" + startBlock: 7563127 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Factory + - Pool + abis: + - name: Gyro2CLPPool + file: ./abis/Gyro2CLPPool.json + - name: BasePoolFactory + file: ./abis/BasePoolFactory.json + eventHandlers: + - event: PoolCreated(indexed address) + handler: handleGyro2PoolCreated + file: ./src/mappings/gyro2.ts + - kind: ethereum + name: GyroECLPPoolFactory + network: sepolia + source: + abi: BasePoolFactory + address: "0xaC06eD505b0d85e46Bf90590f835A12E5EAac86E" + startBlock: 7563132 + mapping: + kind: ethereum/events + apiVersion: 0.0.7 + language: wasm/assemblyscript + entities: + - Factory + - Pool + abis: + - name: GyroECLPPool + file: ./abis/GyroECLPPool.json + - name: BasePoolFactory + file: ./abis/BasePoolFactory.json + eventHandlers: + - event: PoolCreated(indexed address) + handler: handleGyroEPoolCreated + file: ./src/mappings/gyroE.ts diff --git a/subgraphs/v3-pools/template.yaml b/subgraphs/v3-pools/template.yaml index c36771f..ce830a6 100644 --- a/subgraphs/v3-pools/template.yaml +++ b/subgraphs/v3-pools/template.yaml @@ -2,6 +2,7 @@ specVersion: 1.0.0 schema: file: ./schema.graphql dataSources: + {{#if WeightedPoolFactory}} - kind: ethereum name: WeightedPoolFactory network: {{ network }} @@ -25,6 +26,8 @@ dataSources: - event: PoolCreated(indexed address) handler: handleWeightedPoolCreated file: ./src/mappings/weighted.ts + {{/if}} + {{#if StablePoolFactory}} - kind: ethereum name: StablePoolFactory network: {{ network }} @@ -48,6 +51,8 @@ dataSources: - event: PoolCreated(indexed address) handler: handleStablePoolCreated file: ./src/mappings/stable.ts + {{/if}} + {{#if Gyro2CLPPoolFactory}} - kind: ethereum name: Gyro2CLPPoolFactory network: {{ network }} @@ -71,6 +76,8 @@ dataSources: - event: PoolCreated(indexed address) handler: handleGyro2PoolCreated file: ./src/mappings/gyro2.ts + {{/if}} + {{#if GyroECLPPoolFactory}} - kind: ethereum name: GyroECLPPoolFactory network: {{ network }} @@ -94,3 +101,4 @@ dataSources: - event: PoolCreated(indexed address) handler: handleGyroEPoolCreated file: ./src/mappings/gyroE.ts + {{/if}} \ No newline at end of file diff --git a/subgraphs/v3-vault/subgraph.arbitrum-one.yaml b/subgraphs/v3-vault/subgraph.arbitrum-one.yaml index 816857d..9f35015 100644 --- a/subgraphs/v3-vault/subgraph.arbitrum-one.yaml +++ b/subgraphs/v3-vault/subgraph.arbitrum-one.yaml @@ -45,7 +45,6 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts - - kind: ethereum name: ProtocolFeeController network: arbitrum-one @@ -83,7 +82,6 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts - templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.base.yaml b/subgraphs/v3-vault/subgraph.base.yaml index 7757227..a413733 100644 --- a/subgraphs/v3-vault/subgraph.base.yaml +++ b/subgraphs/v3-vault/subgraph.base.yaml @@ -45,7 +45,6 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts - - kind: ethereum name: ProtocolFeeController network: base @@ -83,7 +82,6 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts - templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.gnosis.yaml b/subgraphs/v3-vault/subgraph.gnosis.yaml index 32b6a93..0d1c5e8 100644 --- a/subgraphs/v3-vault/subgraph.gnosis.yaml +++ b/subgraphs/v3-vault/subgraph.gnosis.yaml @@ -45,7 +45,6 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts - - kind: ethereum name: ProtocolFeeController network: gnosis @@ -83,7 +82,6 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts - templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.sepolia.yaml b/subgraphs/v3-vault/subgraph.sepolia.yaml index 51252f2..1efebab 100644 --- a/subgraphs/v3-vault/subgraph.sepolia.yaml +++ b/subgraphs/v3-vault/subgraph.sepolia.yaml @@ -45,7 +45,6 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts - - kind: ethereum name: ProtocolFeeController network: sepolia @@ -83,7 +82,6 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts - templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.sonic.yaml b/subgraphs/v3-vault/subgraph.sonic.yaml index 1553e29..a5f22e0 100644 --- a/subgraphs/v3-vault/subgraph.sonic.yaml +++ b/subgraphs/v3-vault/subgraph.sonic.yaml @@ -45,7 +45,6 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts - - kind: ethereum name: ProtocolFeeController network: sonic @@ -83,7 +82,6 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts - templates: - kind: ethereum/contract name: BPT diff --git a/subgraphs/v3-vault/subgraph.yaml b/subgraphs/v3-vault/subgraph.yaml index 17d5d8c..c5a345e 100644 --- a/subgraphs/v3-vault/subgraph.yaml +++ b/subgraphs/v3-vault/subgraph.yaml @@ -45,7 +45,6 @@ dataSources: - event: Unwrap(indexed address,uint256,uint256,bytes32) handler: handleUnwrap file: ./src/mappings/vault.ts - - kind: ethereum name: ProtocolFeeController network: mainnet @@ -83,7 +82,6 @@ dataSources: - event: ProtocolFeesWithdrawn(indexed address,indexed address,indexed address,uint256) handler: handleProtocolFeesWithdrawn file: ./src/mappings/controller.ts - templates: - kind: ethereum/contract name: BPT