-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
* tech debt refactor - remove config files - new script for retrieving hosted service networks - new script for building network config file - modify deploy.sh to use new network config builder - build hosted service network json in necessary workflow files * Delete hosted-service-networks.json * fix up workflow
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,5 @@ tasks/config | |
src/addresses.ts | ||
**/*.wasm | ||
**/*.latest.json | ||
tests/.bin | ||
tests/.bin | ||
hosted-service-networks.json |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <NETWORK_NAME> | ||
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(); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |