Skip to content

Commit

Permalink
Merge pull request #10 from balancer/gyro-pools
Browse files Browse the repository at this point in the history
add gyro pools to sepolia
  • Loading branch information
mendesfabio authored Jan 28, 2025
2 parents 0d46e57 + c0e1708 commit e2709d0
Show file tree
Hide file tree
Showing 16 changed files with 1,552 additions and 16 deletions.
8 changes: 8 additions & 0 deletions networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@
"StablePoolFactory": {
"address": "0xd67F485C07D258B3e93835a3799d862ffcB55923",
"startBlock": 7216947
},
"Gyro2CLPPoolFactory": {
"address": "0x97701aa7c9ae4497874C54B1C779221d6F1081C9",
"startBlock": 7563127
},
"GyroECLPPoolFactory": {
"address": "0xaC06eD505b0d85e46Bf90590f835A12E5EAac86E",
"startBlock": 7563132
}
},
"arbitrum-one": {
Expand Down
18 changes: 14 additions & 4 deletions scripts/generate-manifests.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
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)) {
result = result.replace(new RegExp(`{{ ${contractName}\\.address }}`, 'g'), contractData.address);
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 => {
Expand All @@ -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`);
Expand All @@ -33,4 +43,4 @@ function replacePlaceholders(template, network, networkData) {
});
});

console.log('🎉 v3 subgraphs successfully generated\n');
console.log('🎉 v3 subgraphs successfully generated\n');
Loading

0 comments on commit e2709d0

Please sign in to comment.