Skip to content

Commit

Permalink
Add scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Jul 5, 2024
1 parent 05de43b commit a8199a1
Show file tree
Hide file tree
Showing 3 changed files with 99 additions and 1 deletion.
96 changes: 96 additions & 0 deletions bin/delete.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/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 polygon goldsky ABCDEA123"
echo " chains: " ${valid_chains[@]}
echo " providers: " ${valid_providers[@]}
exit 1
}

function prepare {
CHAIN=$1
echo "preparing $CHAIN"
yarn prepare:$CHAIN
yarn codegen
yarn build
}

function publish_0xgraph {
SUBGRAPH=$1
VERSION=$2
DEPLOY_KEY=$3
echo "deleting $SUBGRAPH to 0xgraph"
yarn run graph delete $SUBGRAPH --node https://api.0xgraph.xyz/deploy --ipfs https://api.0xgraph.xyz/ipfs --version-label="v$VERSION" --deploy-key=$DEPLOY_KEY
}

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

function publish {
VERSION=$1
CHAIN=$2
PROVIDER=$3
DEPLOY_KEY=$4
SUBGRAPH=
case $PROVIDER in
"0xgraph")
publish_0xgraph beefyfinance/clm-$CHAIN $VERSION $DEPLOY_KEY
;;
"goldsky")
publish_goldsky beefy-clm-$CHAIN $VERSION $DEPLOY_KEY
;;
esac
}


version=$1
if [ -z "$version" ]; then
echo "version is required"
exit_help
fi
if [[ ! $version =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "invalid version"
exit_help
fi


chain=$2
if [ -z "$chain" ]; then
echo "chain is required"
exit_help
fi
if [[ ! " ${valid_chains[@]} " =~ " ${chain} " ]]; then
echo "invalid chain"
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

prepare $chain
publish $version $chain $provider $deploy_key
File renamed without changes.
4 changes: 3 additions & 1 deletion src/common/clock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export function handleClockTick(block: ethereum.Block): void {

let tickRes1h = getClockTick(timestamp, HOUR)
if (!tickRes1h.isNew) {
log.debug("handleClockTick: tick already exists for 1h period", [])
log.debug("handleClockTick: tick already exists for {}", [
tickRes1h.tick.id.toHexString(),
])
return
}
tickRes1h.tick.save()
Expand Down

0 comments on commit a8199a1

Please sign in to comment.