Skip to content

Commit

Permalink
Merge pull request #195 from Kwenta/v3-arb
Browse files Browse the repository at this point in the history
Snx arb config
  • Loading branch information
avclarke authored Sep 10, 2024
2 parents a12e733 + 017a34e commit f238b1d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 15 deletions.
20 changes: 16 additions & 4 deletions scripts/deploy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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...'));
Expand Down
37 changes: 26 additions & 11 deletions subgraphs/perps-v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit f238b1d

Please sign in to comment.