Skip to content

Commit 6ebd482

Browse files
committed
updated scripts to use alchemy subgraph
1 parent 11ae275 commit 6ebd482

File tree

8 files changed

+9679
-7061
lines changed

8 files changed

+9679
-7061
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,7 @@ yarn-error.log*
126126
# subgraph
127127
packages/subgraph/build/
128128
packages/subgraph/src/types/
129+
130+
131+
# yarn
132+
.yarn

.yarnrc.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
nmHoistingLimits: workspaces
2+
3+
nodeLinker: node-modules
4+
5+
plugins:
6+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
7+
spec: "@yarnpkg/plugin-workspace-tools"
8+
9+
yarnPath: .yarn/releases/yarn-3.2.1.cjs

package.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,9 @@
88
"workspaces",
99
"yarn"
1010
],
11-
"scripts": {
12-
"sdk": "yarn workspace @ampleforthorg/sdk",
13-
"subgraph": "yarn workspace @ampleforthorg/subgraph"
14-
},
15-
"private": true,
16-
"workspaces": {
17-
"packages": [
18-
"*"
19-
]
20-
}
11+
"packageManager": "[email protected]",
12+
"workspaces": [
13+
"sdk",
14+
"subgraph"
15+
]
2116
}

subgraph/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ docker-compose up
2121

2222
Setup project:
2323
```
24-
yarn global add mustache
2524
yarn
2625
```
2726

@@ -32,9 +31,9 @@ To build and deploy the subgraph to the graph hosted service:
3231
./scripts/deploy.sh mainnet ampleforth/staging
3332
3433
# testnet deployment
35-
./scripts/deploy.sh goerli ampleforth/ampleforth-core-goerli
34+
./scripts/deploy.sh goerli ampleforth-core-goerli
3635
3736
# production deployment
38-
./scripts/deploy.sh mainnet ampleforth/ampleforth-core
39-
./scripts/deploy.sh avalanche ampleforth/ampleforth-core-avalanche
37+
./scripts/deploy.sh mainnet ampleforth-core
38+
./scripts/deploy.sh avalanche ampleforth-core-avalanche
4039
```

subgraph/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"@typescript-eslint/parser": "^2.0.0",
1919
"eslint": "^6.2.2",
2020
"eslint-config-prettier": "^6.1.0",
21+
"mustache": "^4.2.0",
2122
"prettier": "^1.18.2",
2223
"typescript": "^3.5.2"
2324
},

subgraph/scripts/deploy.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/bin/bash
22
set -e
33

4-
mustache ./configs/$1.json subgraph.template.yaml > ./subgraph.yaml
5-
6-
yarn auth $GRAPH_AUTH
4+
yarn mustache ./configs/$1.json subgraph.template.yaml > ./subgraph.yaml
75

86
yarn codegen
97

108
yarn build
119

12-
yarn graph deploy \
13-
--product hosted-service \
14-
--access-token $GRAPH_AUTH $2
10+
yarn graph deploy $2 \
11+
--node https://subgraphs.alchemy.com/api/subgraphs/deploy \
12+
--deploy-key $GRAPH_AUTH \
13+
--ipfs https://ipfs.satsuma.xyz

subgraph/src/datasources/token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export function handleTransfer(event: Transfer): void {
4040
let scaledRecepientBalance = fetchTokenBalance(token, event.params.to)
4141
let scaledAmountExact = token.balanceScalar.times(event.params.value)
4242

43-
if (event.params.from.toHexString() != constants.ADDRESS_ZERO) {
43+
if (event.params.from != constants.ADDRESS_ZERO) {
4444
scaledSenderBalance.valueExact =
4545
scaledSenderBalance.valueExact.minus(scaledAmountExact)
4646
scaledSenderBalance.value = formatAMPL(scaledSenderBalance.valueExact)

0 commit comments

Comments
 (0)