diff --git a/bin/delete.sh b/bin/delete.sh new file mode 100755 index 0000000..e07eadc --- /dev/null +++ b/bin/delete.sh @@ -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 " + 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 diff --git a/bin/tag-all.sh b/bin/tag.sh similarity index 100% rename from bin/tag-all.sh rename to bin/tag.sh diff --git a/src/common/clock.ts b/src/common/clock.ts index 55f9579..5e8ca2b 100644 --- a/src/common/clock.ts +++ b/src/common/clock.ts @@ -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()