Skip to content

Commit

Permalink
Add etherfi chains
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Aug 26, 2024
1 parent d571e69 commit da70b66
Show file tree
Hide file tree
Showing 17 changed files with 396 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
node: ["21.x"]
chain: ["base", "linea", "mode"]
chain: ["arbitrum", "base", "bsc", "ethereum", "linea", "mode", "optimism"]
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ node_modules

subgraph.yaml
src/config.ts
src/random.ts

tests/.latest.json
69 changes: 69 additions & 0 deletions bin/delete-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

set -e

# config
valid_chains=($(ls config | sed 's/\.json//g'))
valid_providers=("goldsky" "0xgraph")

function exit_help {
echo "Usage: $0 <version> <provider> <deploy_key>"
echo " Example: $0 0.1.4 goldsky ABCDEA123"
echo " chains: " ${valid_chains[@]}
echo " providers: " ${valid_providers[@]}
exit 1
}


function delete_goldsky {
SUBGRAPH=$1
VERSION=$2
DEPLOY_KEY=$3
echo "deleting $SUBGRAPH to goldsky"
goldsky subgraph delete $SUBGRAPH/$VERSION --token $DEPLOY_KEY
}

function delete_subgraph {
VERSION=$1
CHAIN=$2
PROVIDER=$3
DEPLOY_KEY=$4
case $PROVIDER in
"goldsky")
delete_goldsky beefy-balances-$CHAIN $VERSION $DEPLOY_KEY
;;
esac
}


version=$1
if [ -z "$version" ]; then
echo "version is required"
exit_help
fi
# allow only x.y.z and x.y.z-n versions
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$ ]]; then
echo "invalid version ""$version"""
exit_help
fi


provider=$2
if [ -z "$provider" ]; then
echo "provider is required"
exit_help
fi
if [[ ! " ${valid_providers[@]} " =~ " ${provider} " ]]; then
echo "invalid provider $provider"
exit_help
fi

deploy_key=$3
if [ -z "$deploy_key" ]; then
echo "deploy key is required"
exit_help
fi

for chain in ${valid_chains[@]}; do
delete_subgraph $version $chain $provider $deploy_key
done
72 changes: 72 additions & 0 deletions bin/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

set -e

# config
valid_chains=($(ls config | sed 's/\.json//g'))
valid_providers=("goldsky" "0xgraph")

function exit_help {
echo "Usage: $0 <version> <chain> <provider> <deploy_key>"
echo " Example: $0 0.1.4 goldsky ABCDEA123"
echo " chains: " ${valid_chains[@]}
echo " providers: " ${valid_providers[@]}
exit 1
}


function delete_goldsky {
SUBGRAPH=$1
VERSION=$2
DEPLOY_KEY=$3
echo "deleting $SUBGRAPH to goldsky"
goldsky subgraph delete $SUBGRAPH/$VERSION --token $DEPLOY_KEY
}

function delete_subgraph {
VERSION=$1
CHAIN=$2
PROVIDER=$3
DEPLOY_KEY=$4
case $PROVIDER in
"goldsky")
delete_goldsky beefy-balances-$CHAIN $VERSION $DEPLOY_KEY
;;
esac
}


version=$1
if [ -z "$version" ]; then
echo "version is required"
exit_help
fi
# allow only x.y.z and x.y.z-n versions
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$ ]]; then
echo "invalid version ""$version"""
exit_help
fi

chain=$2
if [ -z "$chain" ]; then
echo "chain is required"
exit_help
fi

provider=$3
if [ -z "$provider" ]; then
echo "provider is required"
exit_help
fi
if [[ ! " ${valid_providers[@]} " =~ " ${provider} " ]]; then
echo "invalid provider $provider"
exit_help
fi

deploy_key=$4
if [ -z "$deploy_key" ]; then
echo "deploy key is required"
exit_help
fi

delete_subgraph $version $chain $provider $deploy_key
2 changes: 1 addition & 1 deletion bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function publish {
PROVIDER=$2
case $PROVIDER in
"0xgraph")
publish_0xgraph beefyfinance/balances-$CHAIN-dev
publish_0xgraph beefyfinance/balances-$CHAIN
;;
"goldsky")
publish_goldsky beefy-balances-$CHAIN-dev
Expand Down
6 changes: 5 additions & 1 deletion bin/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ 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
yarn --silent run mustache config/$CHAIN.json src/config.template.ts > src/config.ts

RNG=$((1 + $RANDOM % 100000))
echo '{"random": '$RNG'}' > random.json
yarn --silent run mustache random.json src/random.template.ts > src/random.ts
7 changes: 4 additions & 3 deletions bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function publish_goldsky {
DEPLOY_KEY=$3
echo "publishing $SUBGRAPH to goldsky"
goldsky subgraph deploy $SUBGRAPH/$VERSION --path . --token $DEPLOY_KEY

sleep 5 # wait for the subgraph to propagate
goldsky subgraph tag create $SUBGRAPH/$VERSION --token $DEPLOY_KEY --tag next
}
Expand All @@ -62,12 +63,12 @@ if [ -z "$version" ]; then
echo "version is required"
exit_help
fi
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "invalid version"
# allow only x.y.z and x.y.z-n versions
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$ ]]; then
echo "invalid version ""$version"""
exit_help
fi


chain=$2
if [ -z "$chain" ]; then
echo "chain is required"
Expand Down
77 changes: 77 additions & 0 deletions bin/tag-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/bash

set -e

# config
valid_chains=($(ls config | sed 's/\.json//g'))
valid_providers=("goldsky")

function exit_help {
echo "Usage: $0 <version> <tag> <provider> <deploy_key>"
echo " Example: $0 0.1.4 latest goldsky ABCDEA123"
echo " chains: " ${valid_chains[@]}
echo " providers: " ${valid_providers[@]}
exit 1
}


function tag_one_goldsky {
SUBGRAPH=$1
VERSION=$2
TAG=$3
DEPLOY_KEY=$4
echo "Tagging $SUBGRAPH/$VERSION to $TAG"
goldsky subgraph tag create $SUBGRAPH/$VERSION --token $DEPLOY_KEY --tag $TAG
}

function tag_one {
VERSION=$1
CHAIN=$2
TAG=$3
PROVIDER=$4
DEPLOY_KEY=$5
case $PROVIDER in
"goldsky")
tag_one_goldsky beefy-balances-$CHAIN $VERSION $TAG $DEPLOY_KEY
;;
esac
}


version=$1
if [ -z "$version" ]; then
echo "version is required"
exit_help
fi
# allow only x.y.z and x.y.z-n versions
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$ ]]; then
echo "invalid version ""$version"""
exit_help
fi


tag=$2
if [ -z "$tag" ]; then
echo "tag is required"
exit_help
fi

provider=$3
if [ -z "$provider" ]; then
echo "provider is required"
exit_help
fi
if [[ ! " ${valid_providers[@]} " =~ " ${provider} " ]]; then
echo "invalid provider $provider"
exit_help
fi

deploy_key=$4
if [ -z "$deploy_key" ]; then
echo "deploy key is required"
exit_help
fi

for chain in ${valid_chains[@]}; do
tag_one $version $chain $tag $provider $deploy_key
done
81 changes: 81 additions & 0 deletions bin/tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
#!/bin/bash

set -e

# config
valid_chains=($(ls config | sed 's/\.json//g'))
valid_providers=("goldsky")

function exit_help {
echo "Usage: $0 <version> <tag> <chain> <provider> <deploy_key>"
echo " Example: $0 0.1.4 latest manta goldsky ABCDEA123"
echo " chains: " ${valid_chains[@]}
echo " providers: " ${valid_providers[@]}
exit 1
}


function tag_one_goldsky {
SUBGRAPH=$1
VERSION=$2
TAG=$3
DEPLOY_KEY=$4
echo "Tagging $SUBGRAPH/$VERSION to $TAG"
goldsky subgraph tag create $SUBGRAPH/$VERSION --token $DEPLOY_KEY --tag $TAG
}

function tag_one {
VERSION=$1
CHAIN=$2
TAG=$3
PROVIDER=$4
DEPLOY_KEY=$5
case $PROVIDER in
"goldsky")
tag_one_goldsky beefy-balances-$CHAIN $VERSION $TAG $DEPLOY_KEY
;;
esac
}


version=$1
if [ -z "$version" ]; then
echo "version is required"
exit_help
fi
# allow only x.y.z and x.y.z-n versions
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9]+)?$ ]]; then
echo "invalid version ""$version"""
exit_help
fi


tag=$2
if [ -z "$tag" ]; then
echo "tag is required"
exit_help
fi

chain=$3
if [ -z "$chain" ]; then
echo "chain is required"
exit_help
fi

provider=$4
if [ -z "$provider" ]; then
echo "provider is required"
exit_help
fi
if [[ ! " ${valid_providers[@]} " =~ " ${provider} " ]]; then
echo "invalid provider $provider"
exit_help
fi

deploy_key=$5
if [ -z "$deploy_key" ]; then
echo "deploy key is required"
exit_help
fi

tag_one $version $chain $tag $provider $deploy_key
18 changes: 18 additions & 0 deletions config/arbitrum.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"network": "arbitrum-one",
"shareTokenMintAddress": "0x0000000000000000000000000000000000000000",
"burnAddress": "0x000000000000000000000000000000000000dead",

"clmManagerFactoryAddress": "0xD41Ce2c0a0596635FC09BDe2C35946a984b8cB7A",
"clmManagerFactoryStartBlock": 219696027,
"clmStrategyFactoryAddress": "0xa5E8574a0BE6A7379611D2Fa0eA228c3a1778162",
"clmStrategyFactoryStartBlock": 219696126,
"rewardPoolFactoryAddress": "0x512b1A12200338F46a844E224d37B303a21D0224",
"rewardPoolFactoryStartBlock": 219696076,
"beefyClassicVaultFactoryAddress": "0x8396f3d25d07531a80770Ce3DEA025932C4953f7",
"beefyClassicVaultFactoryStartBlock": 39125375,
"beefyClassicBoostFactoryAddress": "0x2951c806a75b19954ce0bed477676a54f3c1c200",
"beefyClassicBoostFactoryStartBlock": 131261823,

"vaultInitializedEvent": "Initialized(uint8)"
}
Loading

0 comments on commit da70b66

Please sign in to comment.