Skip to content

Commit

Permalink
Deploy scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Mar 23, 2024
1 parent d616b09 commit 51c6e73
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 15 deletions.
22 changes: 22 additions & 0 deletions bin/deploy_0xgraph.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash

CHAIN=$1

if [ -z "$CHAIN" ]; then
echo "Usage: $0 <chain>"
exit 1
fi

SUBGRAPH=beefyfinance/clm-$CHAIN

yarn prepare:$CHAIN
yarn codegen
yarn build

yarn run graph remove $SUBGRAPH --node https://api.0xgraph.xyz/deploy
sleep 5

yarn run graph create $SUBGRAPH --node https://api.0xgraph.xyz/deploy
sleep 5

yarn run graph deploy $SUBGRAPH --node https://api.0xgraph.xyz/deploy --ipfs https://api.0xgraph.xyz/ipfs --version-label=v0.0.1
19 changes: 19 additions & 0 deletions bin/deploy_goldsky.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

CHAIN=$1

if [ -z "$CHAIN" ]; then
echo "Usage: $0 <chain>"
exit 1
fi

SUBGRAPH=beefyfinance/clm-$CHAIN

yarn prepare:$CHAIN
yarn codegen
yarn build

goldsky subgraph delete $SUBGRAPH/0.0.1
sleep 5

goldsky subgraph deploy $SUBGRAPH/0.0.1 --path .
13 changes: 13 additions & 0 deletions bin/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

CHAIN=$1

if [ -z "$CHAIN" ]; then
echo "Usage: $0 <chain>"
exit 1
fi

set -e

yarn --silent run mustache config/$CHAIN.json subgraph.template.yaml > subgraph.yaml
yarn --silent run mustache config/$CHAIN.json src/config.template.ts > src/config.ts
22 changes: 9 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@
"create-local": "graph create beefyfinance/beefy-cl --node http://127.0.0.1:8020",
"deploy-local": "graph deploy beefyfinance/beefy-cl --node http://127.0.0.1:8020 --ipfs http://localhost:5001",
"remove-local": "graph remove beefyfinance/beefy-cl --node http://127.0.0.1:8020",
"prepare:arbitrum": "mustache config/arbitrum.json subgraph.template.yaml > subgraph.yaml && mustache config/arbitrum.json src/config.template.ts > src/config.ts ",
"prepare:optimism": "mustache config/optimism.json subgraph.template.yaml > subgraph.yaml && mustache config/optimism.json src/config.template.ts > src/config.ts ",
"deploy:all": "yarn --silent deploy:all:0xgraph && yarn --silent deploy:all:goldsky",
"deploy:all:0xgraph": "yarn --silent deploy:arbitrum:0xgraph && yarn --silent deploy:optimism:0xgraph",
"deploy:arbitrum:0xgraph": "yarn --silent prepare:arbitrum && yarn --silent publish:arbitrum:0xgraph",
"deploy:optimism:0xgraph": "yarn --silent prepare:optimism && yarn --silent publish:optimism:0xgraph",
"publish:arbitrum:0xgraph": "0xgraph remove beefyfinance/clm-arbitrum && sleep 10 && 0xgraph create beefyfinance/clm-arbitrum && yarn --silent codegen && 0xgraph build && sleep 5 && 0xgraph deploy beefyfinance/clm-arbitrum --version-label=v0.0.1",
"publish:optimism:0xgraph": "0xgraph remove beefyfinance/clm-optimism && sleep 10 && 0xgraph create beefyfinance/clm-optimism && yarn --silent codegen && 0xgraph build && sleep 5 && 0xgraph deploy beefyfinance/clm-optimism --version-label=v0.0.1",
"deploy:all:goldsky": "yarn --silent deploy:arbitrum:goldsky && yarn --silent deploy:optimism:goldsky",
"deploy:arbitrum:goldsky": "yarn --silent prepare:arbitrum && yarn --silent publish:arbitrum:goldsky",
"deploy:optimism:goldsky": "yarn --silent prepare:optimism && yarn --silent publish:optimism:goldsky",
"publish:arbitrum:goldsky": "yarn codegen && yarn build && goldsky subgraph delete beefyfinance/clm-arbitrum/0.0.1 && goldsky subgraph deploy beefyfinance/clm-arbitrum/0.0.1 --path .",
"publish:optimism:goldsky": "yarn codegen && yarn build && goldsky subgraph delete beefyfinance/clm-optimism/0.0.1 && goldsky subgraph deploy beefyfinance/clm-optimism/0.0.1 --path ."
"prepare:arbitrum": "./bin/prepare.sh arbitrum",
"prepare:optimism": "./bin/prepare.sh optimism",
"deploy:all": "yarn deploy:all:0xgraph && yarn deploy:all:goldsky",
"deploy:all:0xgraph": "yarn deploy:arbitrum:0xgraph && yarn deploy:optimism:0xgraph",
"deploy:arbitrum:0xgraph": "./bin/deploy_0xgraph.sh arbitrum",
"deploy:optimism:0xgraph": "./bin/deploy_0xgraph.sh optimism",
"deploy:all:goldsky": "yarn deploy:arbitrum:goldsky && yarn deploy:optimism:goldsky",
"deploy:arbitrum:goldsky": "./bin/deploy_goldsky.sh arbitrum",
"deploy:optimism:goldsky": "./bin/deploy_goldsky.sh optimism"
},
"main": "./bin/index.js",
"bin": {
Expand Down
1 change: 1 addition & 0 deletions src/mapping/vault.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export { handleVaultInitialized as handleInitialized } from "../vault-lifecycle"
export { handleVaultOwnershipTransferred as handleOwnershipTransferred } from "../ownership"
export { handleVaultDeposit as handleDeposit } from "../vault-transfer"
export { handleVaultWithdraw as handleWithdraw } from "../vault-transfer"
export { handleVaultTransfer as handleTransfer } from "../vault-transfer"
2 changes: 1 addition & 1 deletion src/vault-transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function handleVaultDeposit(event: DepositEvent): void {
export function handleVaultWithdraw(event: WithdrawEvent): void {
updateUserPosition(event, event.params.user, false, false)
}
export function handleTransfer(event: TransferEvent): void {
export function handleVaultTransfer(event: TransferEvent): void {
updateUserPosition(event, event.params.to, true, true)
updateUserPosition(event, event.params.from, false, true)
}
Expand Down
2 changes: 1 addition & 1 deletion subgraph.template.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
specVersion: 0.1.0
specVersion: 1.0.0
description: Beefy Finance Automated Liquidity Manager Subgraph
repository: https://github.com/beefyfinance/subgraphs
schema:
Expand Down

0 comments on commit 51c6e73

Please sign in to comment.