Skip to content

Commit

Permalink
Merge branch 'dev' into vesting-scheduler-1_2
Browse files Browse the repository at this point in the history
  • Loading branch information
kasparkallas authored Apr 10, 2024
2 parents 4af5726 + 73d0c7f commit 5997eed
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 28 deletions.
20 changes: 12 additions & 8 deletions .github/workflows/call.deploy-subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,32 @@ on:
inputs:
vendor:
required: true
description: "Where to deploy subgraph to; superfluid, graph, or satsuma"
description: "Where to deploy subgraph to; superfluid, graph, satsuma, or goldsky"
type: string
deployment_env:
required: true
type: string
description: 'The subgraph deployment env: v1, dev, feature'
description: "The subgraph deployment env: v1, dev, feature"
network:
required: true
type: string
description: 'The network you want to deploy to (matic, xdai, eth-mainnet, etc.) or `all` for all networks.'
description: "The network you want to deploy to (matic, xdai, eth-mainnet, etc.) or `all` for all networks."

secrets:
SUBGRAPH_URL_TEMPLATE:
description: 'Subgraph endpoint url template'
description: "Subgraph endpoint url template"
required: false
SATSUMA_DEPLOY_KEY:
description: 'Satsuma deploy key'
description: "Satsuma deploy key"
required: false
THE_GRAPH_ACCESS_TOKEN:
description: 'The Graph (hosted service) access token for deploying subgraphs'
description: "The Graph (hosted service) access token for deploying subgraphs"
required: false
GOLDSKY_API_KEY:
description: "Goldsky API key for deploying subgraphs"
required: false
SUPERFLUID_IPFS_API:
description: 'Superfluid IPFS API endpoint'
description: "Superfluid IPFS API endpoint"
required: false

jobs:
Expand Down Expand Up @@ -112,7 +115,7 @@ jobs:
- uses: olegtarasov/[email protected]
id: "getSubgraphTag"
with:
tagRegex: "subgraph@(.*)"
tagRegex: "subgraph@(.*)"

# Version is the git tag or revision
- name: "Deploy to a node"
Expand All @@ -126,3 +129,4 @@ jobs:
SUPERFLUID_IPFS_API: ${{ secrets.SUPERFLUID_IPFS_API }}
THE_GRAPH_ACCESS_TOKEN: ${{ secrets.THE_GRAPH_ACCESS_TOKEN }}
SATSUMA_DEPLOY_KEY: ${{ secrets.SATSUMA_DEPLOY_KEY }}
GOLDSKY_API_KEY: ${{ secrets.GOLDSKY_API_KEY }}
7 changes: 3 additions & 4 deletions .github/workflows/call.upload-coverage-reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ name: Reusable Workflow | Upload Coverage Reports
on:
workflow_call:


jobs:
upload-coverage-reports:
name: Upload coverage reports
Expand All @@ -19,7 +18,7 @@ jobs:
name: ethereum-contracts-coverage
path: packages/ethereum-contracts/coverage
- name: Upload ethereum-contracts-coverage to codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4.2.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: packages/ethereum-contracts/coverage/lcov.info
Expand All @@ -33,10 +32,10 @@ jobs:
name: sdk-core-coverage
path: packages/sdk-core/coverage
- name: Upload sdk-core-coverage to codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4.2.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: packages/sdk-core/coverage/lcov.info
name: sdk-core-coverage
flags: sdk-core
fail_ci_if_error: true
fail_ci_if_error: true
1 change: 1 addition & 0 deletions .github/workflows/handler.deploy-production-subgraphs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,4 @@ jobs:
SATSUMA_DEPLOY_KEY: ${{ secrets.SATSUMA_DEPLOY_KEY }}
SUBGRAPH_URL_TEMPLATE: ${{ secrets.SUBGRAPH_URL_TEMPLATE }}
SUPERFLUID_IPFS_API: ${{ secrets.SUPERFLUID_IPFS_API }}
GOLDSKY_API_KEY: ${{ secrets.GOLDSKY_API_KEY }}
13 changes: 10 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
node18DevInputs = nodeDevInputsWith pkgs.nodejs_18;
node20DevInputs = nodeDevInputsWith pkgs.nodejs_20;

# CI inputs
ciInputs = with pkgs; [
# codecov requries gnupg binary
gnupg
];

# minimem development shell
minimumDevInputs = commonDevInputs ++ ethDevInputs ++ node18DevInputs;

Expand Down Expand Up @@ -132,17 +138,18 @@
++ whitehatInputs
++ specInputs;
};

# CI shells
devShells.ci-node18 = mkShell {
buildInputs = commonDevInputs ++ ethDevInputs ++ node18DevInputs;
buildInputs = ciInputs ++ commonDevInputs ++ ethDevInputs ++ node18DevInputs;
};
devShells.ci-node20 = mkShell {
buildInputs = commonDevInputs ++ ethDevInputs ++ node20DevInputs;
buildInputs = ciInputs ++ commonDevInputs ++ ethDevInputs ++ node20DevInputs;
};
devShells.ci-spec-ghc92 = ci-spec-with-ghc ghcVer92;
devShells.ci-spec-ghc94 = ci-spec-with-ghc ghcVer94;
devShells.ci-hot-fuzz = mkShell {
buildInputs = with pkgs; commonDevInputs ++ ethDevInputs ++ [
buildInputs = with pkgs; ciInputs ++ commonDevInputs ++ ethDevInputs ++ [
slither-analyzer
echidna
];
Expand Down
4 changes: 2 additions & 2 deletions packages/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"cloc": "cloc src"
},
"dependencies": {
"@graphprotocol/graph-cli": "0.67.4",
"@graphprotocol/graph-ts": "0.32.0",
"@graphprotocol/graph-cli": "0.69.1",
"@graphprotocol/graph-ts": "0.34.0",
"@superfluid-finance/sdk-core": "^0.6.13",
"mustache": "^4.2.0"
},
Expand Down
6 changes: 6 additions & 0 deletions packages/subgraph/src/mappingHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ export function getOrInitSuperToken(
return token as Token;
}

if (token.symbol == "") {
const tokenContract = SuperToken.bind(tokenAddress);
const symbolResult = tokenContract.try_symbol();
token.symbol = symbolResult.reverted ? "" : symbolResult.value;
}

token.save();

return token as Token;
Expand Down
30 changes: 27 additions & 3 deletions packages/subgraph/tasks/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ set -eux
JQ="jq"

# shellcheck disable=SC2207
GRAPH_CLI="npx --package=@graphprotocol/graph-cli -- graph"
SUPPORTED_VENDORS=( "graph" "satsuma" "superfluid" )
GRAPH_CLI="npx --package=@graphprotocol/graph-cli --yes -- graph"
# shellcheck disable=SC2207
GOLDSKY_CLI="npx --package=@goldskycom/cli --yes -- goldsky"
SUPPORTED_VENDORS=( "graph" "satsuma" "superfluid" "goldsky" )

# list of supported networks by vendor

Expand All @@ -16,11 +18,14 @@ GRAPH_NETWORKS=( $($JQ -r .[] ./hosted-service-networks.json) ) || exit 1
SATSUMA_NETWORKS=( "polygon-mainnet" "xdai-mainnet" "eth-mainnet" "eth-sepolia" "optimism-mainnet" "base-mainnet")
# shellcheck disable=SC2034
SUPERFLUID_NETWORKS=( "polygon-mainnet" "xdai-mainnet" "base-mainnet" "optimism-mainnet" "arbitrum-one" "celo-mainnet" "bsc-mainnet" "avalanche-c" "optimism-sepolia" "scroll-sepolia" "scroll-mainnet")
# shellcheck disable=SC2034
GOLDSKY_NETWORKS=( "polygon-mainnet" "xdai-mainnet" "base-mainnet" "optimism-mainnet" "arbitrum-one" "celo-mainnet" "bsc-mainnet" "avalanche-c" "optimism-sepolia" "scroll-sepolia" "scroll-mainnet")

declare -A VENDOR_NETWORKS=(
["graph"]="${GRAPH_NETWORKS[@]}"
["satsuma"]="${SATSUMA_NETWORKS[@]}"
["superfluid"]="${SUPERFLUID_NETWORKS[@]}"
["goldsky"]="${GOLDSKY_NETWORKS[@]}"
)

VENDOR=""
Expand All @@ -29,7 +34,7 @@ DEPLOYMENT_ENV=""
VERSION_LABEL=""

print_usage_and_exit() {
echo "Usage: $0 -o graph|satsuma|superfluid -n <network_name> -r <deployment_env> -v <version_label>"
echo "Usage: $0 -o graph|satsuma|superfluid|goldsky -n <network_name> -r <deployment_env> -v <version_label>"
exit 1
}

Expand Down Expand Up @@ -115,6 +120,22 @@ deploy_to_superfluid() {
--ipfs "$SUPERFLUID_IPFS_API"
}

deploy_to_goldsky() {
local network="$1"
local subgraphName="protocol-$DEPLOYMENT_ENV-$network/1.0.0"
# TODO: use tagging?
# TODO: how to handle versions?

$GRAPH_CLI build
# Note: when using Graph CLI to deploy, it implicitly triggers build too, but Goldsky CLI doesn't.

echo "********* Deploying $network subgraph $subgraphName to Goldsky. **********"
$GOLDSKY_CLI subgraph deploy \
"$subgraphName" \
--path . \
--token "$GOLDSKY_API_KEY"
}

# Vendor specific function dispatcher
# Expected arguments:
# $1 - vendor
Expand Down Expand Up @@ -149,6 +170,9 @@ deploy_to() {
superfluid)
deploy_to_superfluid "$network"
;;
goldsky)
deploy_to_goldsky "$network"
;;
*)
print_usage_and_exit
;;
Expand Down
16 changes: 8 additions & 8 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,10 @@
optionalDependencies:
"@trufflesuite/bigint-buffer" "1.1.9"

"@graphprotocol/graph-cli@0.67.4":
version "0.67.4"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.67.4.tgz#da8fd87c20c64bb3ab78664bd2af0ab965f9d12f"
integrity sha512-U2LDemWwmYUxf7PloAcDPXK1UeceRphGJJKrhNbDZB32hlp3LY+GI6HnRK4F9Oeri2azB3t3/humNxIDgbim0w==
"@graphprotocol/graph-cli@0.69.1":
version "0.69.1"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-cli/-/graph-cli-0.69.1.tgz#2ea248fb1636b46afb6101236e3f387e9d2f3275"
integrity sha512-PekTli4hsBkF48y2NA2ufNjtdG/VL4N+E7GAavNXxFmSHM9VoCWbR4OBeJ93dAOpgHRGyx8yO1NE9DDT7yEZsg==
dependencies:
"@float-capital/float-subgraph-uncrashable" "^0.0.0-alpha.4"
"@oclif/core" "2.8.6"
Expand Down Expand Up @@ -1532,10 +1532,10 @@
which "2.0.2"
yaml "1.10.2"

"@graphprotocol/graph-ts@0.32.0":
version "0.32.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.32.0.tgz#36f8cd8e4ef42c3c32536cceb9995ab990f51d29"
integrity sha512-YfKLT2w+ItXD/VPYQiAKtINQONVsAOkcqVFMHlhUy0fcEBVWuFBT53hJNI0/l5ujQa4TSxtzrKW/7EABAdgI8g==
"@graphprotocol/graph-ts@0.34.0":
version "0.34.0"
resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.34.0.tgz#ca47398295b114f25b412faa364b98af31fa2bb7"
integrity sha512-gnhjai65AV4YMYe9QHGz+HP/jdzI54z/nOfEXZFfh6m987EP2iy3ycLXrTi+ahcogHH7vtoWFdXbUzZbE8bCAg==
dependencies:
assemblyscript "0.19.10"

Expand Down

0 comments on commit 5997eed

Please sign in to comment.