Skip to content

Commit

Permalink
Showing 7 changed files with 16 additions and 13 deletions.
16 changes: 6 additions & 10 deletions inabox/deploy/subgraph.go
Original file line number Diff line number Diff line change
@@ -118,30 +118,26 @@ func (env *Config) deploySubgraphs(startBlock int) {
return
}

currDir, _ := os.Getwd()
changeDirectory("../subgraphs")
defer changeDirectory(currDir)

fmt.Println("Deploying Subgraph")
env.deploySubgraph(eigenDAOperatorStateSubgraphUpdater{c: env}, "eigenda-operator-state", startBlock)
env.deploySubgraph(eigenDAUIMonitoringUpdater{c: env}, "eigenda-batch-metadata", startBlock)
}

func (env *Config) deploySubgraph(updater subgraphUpdater, path string, startBlock int) {
execBashCmd(fmt.Sprintf(`cp -r "%s" "%s"`, path, env.Path))

currDir, _ := os.Getwd()
changeDirectory(filepath.Join(env.Path, path))
defer changeDirectory(currDir)
subgraphPath := filepath.Join(env.rootPath, "subgraphs", path)
changeDirectory(subgraphPath)

execBashCmd(`cp "./templates/subgraph.yaml" "./"`)
execBashCmd(`cp "./templates/networks.json" "./"`)

subgraphPath := filepath.Join(env.Path, path)
env.updateSubgraph(updater, subgraphPath, startBlock)

execYarnCmd("install")
execYarnCmd("codegen")
execYarnCmd("remove-local")
execYarnCmd("create-local")
execBashCmd("yarn deploy-local --version-label=v0.0.1")
execYarnCmd("deploy-local", "--version-label", "v0.0.1")
}

func (env *Config) updateSubgraph(updater subgraphUpdater, path string, startBlock int) {
5 changes: 3 additions & 2 deletions inabox/deploy/utils.go
Original file line number Diff line number Diff line change
@@ -98,10 +98,11 @@ func changeDirectory(path string) {
}

// Execute yarn command
func execYarnCmd(command string) {
func execYarnCmd(command string, args ...string) {
log.Printf("Executing yarn with command: %s", command)

cmd := exec.Command("yarn", command)
args = append([]string{command}, args...)
cmd := exec.Command("yarn", args...)

var out bytes.Buffer
var stderr bytes.Buffer
8 changes: 7 additions & 1 deletion subgraphs/.gitignore
Original file line number Diff line number Diff line change
@@ -2,4 +2,10 @@
**/generated
**/tests/.bin
**/tests/*.json
**/build
**/build

eigenda-operator-state/networks.json
eigenda-operator-state/subgraph.yaml

eigenda-batch-metadata/networks.json
eigenda-batch-metadata/subgraph.yaml

0 comments on commit a46bd99

Please sign in to comment.