From 017a34e00d0b16bfffca8fa62f0544c5424f8bb0 Mon Sep 17 00:00:00 2001 From: Adam Clarke Date: Mon, 9 Sep 2024 14:52:09 +0100 Subject: [PATCH] Snx arb --- scripts/deploy.js | 20 ++++++++++++++++---- subgraphs/perps-v3.js | 37 ++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/scripts/deploy.js b/scripts/deploy.js index cb2747ed..a3ab1c5d 100644 --- a/scripts/deploy.js +++ b/scripts/deploy.js @@ -36,7 +36,15 @@ program program.action(async () => { const MAIN_SUBGRAPH_EXCLUDE = []; - const NETWORK_CHOICES = ['mainnet', 'goerli', 'optimism', 'optimism-sepolia', 'base', 'base-sepolia']; + const NETWORK_CHOICES = [ + 'mainnet', + 'optimism', + 'optimism-sepolia', + 'base', + 'base-sepolia', + 'arbitrum-one', + 'arbitrum-sepolia', + ]; const SUBGRAPH_CHOICES = await fs.readdirSync(path.join(__dirname, '../subgraphs')).reduce((acc, val) => { if (val.endsWith('.js') && val !== 'main.js') { acc.push(val.slice(0, -3)); @@ -137,9 +145,13 @@ program.action(async () => { console.log(cyan('Running The Graph’s codegen...')); for (let i = 0; i < SUBGRAPH_CHOICES.length; i++) { const subgraph = SUBGRAPH_CHOICES[i]; - await exec( - `NETWORK=mainnet SUBGRAPH=${subgraph} ./node_modules/.bin/graph codegen ./subgraphs/${subgraph}.js -o ./generated/subgraphs/${subgraph}`, - ); + try { + await exec( + `NETWORK=${settings.network} SUBGRAPH=${subgraph} ./node_modules/.bin/graph codegen ./subgraphs/${subgraph}.js -o ./generated/subgraphs/${subgraph}`, + ); + } catch (err) { + console.error(err); + } } console.log(cyan('Creating contracts...')); diff --git a/subgraphs/perps-v3.js b/subgraphs/perps-v3.js index 4acb0e0c..9e97a9c3 100644 --- a/subgraphs/perps-v3.js +++ b/subgraphs/perps-v3.js @@ -5,21 +5,36 @@ const manifest = []; // get config const currentNetwork = getCurrentNetwork(); -const mainnetConfig = { - marketProxy: { - address: '0x0A2AF931eFFd34b81ebcc57E3d3c9B1E1dE1C9Ce', - startBlock: 4382, +const configs = { + ['base-sepolia']: { + marketProxy: { + address: '0xf53Ca60F031FAf0E347D44FbaA4870da68250c8d', + startBlock: 8157661, + }, }, -}; - -const sepoliaConfig = { - marketProxy: { - address: '0xf53Ca60F031FAf0E347D44FbaA4870da68250c8d', - startBlock: 8157661, + ['arbitrum-sepolia']: { + marketProxy: { + address: '0xA73A7B754Ec870b3738D0654cA75b7d0eEbdb460', + startBlock: 68535378, + }, + }, + base: { + marketProxy: { + address: '0x0A2AF931eFFd34b81ebcc57E3d3c9B1E1dE1C9Ce', + startBlock: 4382, + }, + }, + ['arbitrum-one']: { + marketProxy: { + address: '0xd762960c31210Cf1bDf75b06A5192d395EEDC659', + startBlock: 218273200, + }, }, }; -const config = currentNetwork === 'base' ? mainnetConfig : sepoliaConfig; +const config = configs[currentNetwork]; + +if (!config) throw new Error(`Config not found for network ${currentNetwork}`); manifest.push({ kind: 'ethereum/contract',