From 33aef62b6a5e6a9737f1381a9c84a73d2a028463 Mon Sep 17 00:00:00 2001 From: Didi Date: Mon, 13 Feb 2023 11:14:23 +0100 Subject: [PATCH] added celo-mainnet support (#1263) - added celo to configs - support in SDK-Core (bump metadata in yarn.lock) - config added to subgraph - verification workflow and shell script for celo mainnet added --------- Co-authored-by: 0xdavinchee <0xdavinchee@gmail.com> --- .github/workflows/handler.verify-contracts.yml | 3 ++- packages/ethereum-contracts/hardhat.config.ts | 6 ++++++ .../ops-scripts/libs/getConfig.js | 6 +++--- .../tasks/deploy-cfa-forwarder.sh | 13 +++++++------ .../tasks/etherscan-verify-framework.sh | 1 + packages/ethereum-contracts/truffle-config.js | 4 +++- packages/ethereum-contracts/utils/README.md | 2 +- .../utils/supertoken-deployer.html | 3 ++- packages/js-sdk/src/getConfig.js | 13 ++++++------- packages/sdk-core/CHANGELOG.md | 6 ++++-- packages/sdk-core/package.json | 2 +- packages/subgraph/config/celo-mainnet.json | 10 ++++++++++ packages/subgraph/hardhat.config.ts | 4 ++++ packages/subgraph/networks.json | 3 ++- packages/subgraph/package.json | 2 +- yarn.lock | 4 ++-- 16 files changed, 55 insertions(+), 27 deletions(-) create mode 100644 packages/subgraph/config/celo-mainnet.json diff --git a/.github/workflows/handler.verify-contracts.yml b/.github/workflows/handler.verify-contracts.yml index f2e4ef0d33..bee38b72c4 100644 --- a/.github/workflows/handler.verify-contracts.yml +++ b/.github/workflows/handler.verify-contracts.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - network: [eth-goerli, polygon-mumbai, optimism-goerli, arbitrum-goerli, avalanche-fuji, polygon-mainnet, optimism-mainnet, arbitrum-one, avalanche-c, bsc-mainnet] + network: [eth-goerli, polygon-mumbai, optimism-goerli, arbitrum-goerli, avalanche-fuji, polygon-mainnet, optimism-mainnet, arbitrum-one, avalanche-c, bsc-mainnet, celo-mainnet] steps: - uses: actions/checkout@v3 @@ -59,3 +59,4 @@ jobs: OPTIMISTIC_API_KEY: ${{ secrets.OPTIMISTIC_API_KEY }} ARBISCAN_API_KEY: ${{ secrets.ARBISCAN_API_KEY }} BSCSCAN_API_KEY: ${{ secrets.BSCSCAN_API_KEY }} + CELOSCAN_API_KEY: ${{ secrets.CELOSCAN_API_KEY }}} diff --git a/packages/ethereum-contracts/hardhat.config.ts b/packages/ethereum-contracts/hardhat.config.ts index d4ac951c85..6a8a3859a2 100644 --- a/packages/ethereum-contracts/hardhat.config.ts +++ b/packages/ethereum-contracts/hardhat.config.ts @@ -48,6 +48,8 @@ const chainIds = { "bsc-mainnet": 56, + "celo-mainnet": 42220, + localhost: 31337, hardhat: 31337, }; @@ -119,6 +121,10 @@ const config: HardhatUserConfig = { ...createNetworkConfig("avalanche-fuji"), url: process.env.AVALANCHE_PROVIDER_URL || "", }, + "celo-mainnet": { + ...createNetworkConfig("celo-mainnet"), + url: process.env.CELO_MAINNET_PROVIDER_URL || "", + }, coverage: { url: "http://127.0.0.1:8555", }, diff --git a/packages/ethereum-contracts/ops-scripts/libs/getConfig.js b/packages/ethereum-contracts/ops-scripts/libs/getConfig.js index 235c9abc00..68fa40483b 100644 --- a/packages/ethereum-contracts/ops-scripts/libs/getConfig.js +++ b/packages/ethereum-contracts/ops-scripts/libs/getConfig.js @@ -237,10 +237,10 @@ module.exports = function getConfig(chainId) { // governance default configs gov_enableAppWhiteListing: true, // misc - // disableTestGovernance: true, + disableTestGovernance: true, data: { - initialBlockNumber: 13075000, - getLogsRange: 50000, + initialBlockNumber: 16393000, + getLogsRange: 20000, }, }, 44787: { diff --git a/packages/ethereum-contracts/tasks/deploy-cfa-forwarder.sh b/packages/ethereum-contracts/tasks/deploy-cfa-forwarder.sh index b92a651d7f..0d18acf2e2 100755 --- a/packages/ethereum-contracts/tasks/deploy-cfa-forwarder.sh +++ b/packages/ethereum-contracts/tasks/deploy-cfa-forwarder.sh @@ -1,4 +1,5 @@ -#!/usr/bin/env bash -eux +#!/usr/bin/env bash +set -eux # Usage: # tasks/deploy-cfa-forwarder.sh @@ -23,19 +24,19 @@ # On some networks you may need to use override ENV vars for the deployment to succeed network=$1 -cfaAddr=$2 +cfaFwdAddr=0xcfA132E353cB4E398080B9700609bb008eceB125 # deploy npx truffle exec --network $network ops-scripts/deploy-deterministically.js : CFAv1Forwarder # verify (give it a few seconds to pick up the code) sleep 5 -npx truffle run --network $network verify CFAv1Forwarder@$cfaAddr +npx truffle run --network $network verify CFAv1Forwarder@$cfaFwdAddr # set resolver -ALLOW_UPDATE=1 npx truffle exec --network $network ops-scripts/resolver-set-key-value.js : CFAv1Forwarder $cfaAddr +ALLOW_UPDATE=1 npx truffle exec --network $network ops-scripts/resolver-set-key-value.js : CFAv1Forwarder $cfaFwdAddr # create gov action -npx truffle exec --network $network ops-scripts/gov-set-trusted-forwarder.js : 0x0000000000000000000000000000000000000000 $cfaAddr 1 +npx truffle exec --network $network ops-scripts/gov-set-trusted-forwarder.js : 0x0000000000000000000000000000000000000000 $cfaFwdAddr 1 -# TODO: on mainnets, the resolver entry should be set only after the gov action was signed & executed \ No newline at end of file +# TODO: on mainnets, the resolver entry should be set only after the gov action was signed & executed diff --git a/packages/ethereum-contracts/tasks/etherscan-verify-framework.sh b/packages/ethereum-contracts/tasks/etherscan-verify-framework.sh index 8f3d5bc07f..ca3ce26017 100755 --- a/packages/ethereum-contracts/tasks/etherscan-verify-framework.sh +++ b/packages/ethereum-contracts/tasks/etherscan-verify-framework.sh @@ -30,6 +30,7 @@ case $TRUFFLE_NETWORK in arbitrum-one | \ avalanche-c | \ bsc-mainnet | \ + celo-mainnet | \ xdai-mainnet ) echo "$TRUFFLE_NETWORK is mainnet" IS_TESTNET= diff --git a/packages/ethereum-contracts/truffle-config.js b/packages/ethereum-contracts/truffle-config.js index 3ca8619a57..766ddf0175 100644 --- a/packages/ethereum-contracts/truffle-config.js +++ b/packages/ethereum-contracts/truffle-config.js @@ -73,6 +73,8 @@ const ALIASES = { "bsc-mainnet": ["bsc"], + "celo-mainnet": ["celo"], + // currently unsupported // "optimism-kovan": ["opkovan"], @@ -81,7 +83,6 @@ const ALIASES = { "bsc-chapel": ["chapel"], - "celo-mainnet": ["celo"], "celo-alfajores": ["alfajores"], }; @@ -408,6 +409,7 @@ const E = (module.exports = { bscscan: process.env.BSCSCAN_API_KEY, arbiscan: process.env.ARBISCAN_API_KEY, gnosisscan: process.env.GNOSISSCAN_API_KEY, + celoscan: process.env.CELOSCAN_API_KEY, }, }); diff --git a/packages/ethereum-contracts/utils/README.md b/packages/ethereum-contracts/utils/README.md index a2e15f2336..be83faf7fe 100644 --- a/packages/ethereum-contracts/utils/README.md +++ b/packages/ethereum-contracts/utils/README.md @@ -8,7 +8,7 @@ python -m SimpleHTTPServer 1337 ``` Then navigate to http://localhost:1337/supertoken-deployer.html -Alternatively, you can also find it on IPFS: [QmbjeSLXfmePAnWRBhkhajCpdu58Xsn7BqQwj8pSxRS9d8](https://ipfs.io/ipfs/QmaCBCARcUthLcG1sNYC8SAE7okuDUZqbythvWuYozBpgC) +Alternatively, you can also find it on IPFS: [QmP9ruumtpxFGMJdz2G38rqARAUWPHdRbGc2hQg2tXWYTd](https://ipfs.io/ipfs/QmP9ruumtpxFGMJdz2G38rqARAUWPHdRbGc2hQg2tXWYTd) ## Stream Closer diff --git a/packages/ethereum-contracts/utils/supertoken-deployer.html b/packages/ethereum-contracts/utils/supertoken-deployer.html index 58d637d12c..f740cbd2ee 100644 --- a/packages/ethereum-contracts/utils/supertoken-deployer.html +++ b/packages/ethereum-contracts/utils/supertoken-deployer.html @@ -67,7 +67,8 @@ { chainId: 10, hostAddr: "0x567c4B141ED61923967cA25Ef4906C8781069a10" }, // optimism-mainnnet { chainId: 42161, hostAddr: "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192" }, // arbitrum-one { chainId: 43114, hostAddr: "0x60377C7016E4cdB03C87EF474896C11cB560752C" }, // avalanche-c - { chainId: 56, hostAddr: "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E" } // bsc-mainnet + { chainId: 56, hostAddr: "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E" }, // bsc-mainnet + { chainId: 42220, hostAddr: "0xA4Ff07cF81C02CFD356184879D953970cA957585" } // celo-mainnet ]; let connData = {}; // chainId, provider, userAddress, ... diff --git a/packages/js-sdk/src/getConfig.js b/packages/js-sdk/src/getConfig.js index cefd5689bd..d4f3eecedc 100644 --- a/packages/js-sdk/src/getConfig.js +++ b/packages/js-sdk/src/getConfig.js @@ -103,6 +103,11 @@ Superfluid_getConfig = module.exports = function getConfig(chainId, version) { // 56: getConfigData(56), + // + // Celo: https://github.com/celo-org/celo-monorepo#docs + // + 42220: getConfigData(42220), + // // currently unsupported networks // @@ -129,13 +134,7 @@ Superfluid_getConfig = module.exports = function getConfig(chainId, version) { resolverAddress: "0x79D426CD219eDCFEB2dCbcf7ea0F8B3642C56F47", }, - // - // Celo: https://github.com/celo-org/celo-monorepo#docs - // - 42220: { - // celo mainnet - nativeTokenSymbol: "CELO", - }, + // Celo 44787: { // celo alfajores testnet nativeTokenSymbol: "CELO", diff --git a/packages/sdk-core/CHANGELOG.md b/packages/sdk-core/CHANGELOG.md index 13bf0c05ab..05d9c4f3d5 100644 --- a/packages/sdk-core/CHANGELOG.md +++ b/packages/sdk-core/CHANGELOG.md @@ -3,9 +3,10 @@ All notable changes to the SDK-core will be documented in this file. This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.6.2] - 2023-02-07 ### Added - - `streamId` to `FlowUpdatedEvent` when querying from Subgraph +- Support for Celo ## [0.6.1] - 2022-12-20 @@ -270,7 +271,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - New `SuperToken` class with `SuperToken` CRUD functionality and an underlying `Token` class with basic `ERC20` functionality - New `BatchCall` class for creating and executing batch calls with supported `Operation's` -[Unreleased]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.6.1...HEAD +[Unreleased]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.6.2...HEAD +[0.6.2]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.6.1...sdk-core%40v0.6.2 [0.6.1]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.6.0...sdk-core%40v0.6.1 [0.6.0]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.5.9...sdk-core%40v0.6.0 [0.5.9]: https://github.com/superfluid-finance/protocol-monorepo/compare/sdk-core%40v0.5.8...sdk-core%40v0.5.9 diff --git a/packages/sdk-core/package.json b/packages/sdk-core/package.json index 49fcae1a60..8ea82310a7 100644 --- a/packages/sdk-core/package.json +++ b/packages/sdk-core/package.json @@ -1,6 +1,6 @@ { "name": "@superfluid-finance/sdk-core", - "version": "0.6.1", + "version": "0.6.2", "description": "SDK Core for building with Superfluid Protocol", "homepage": "https://github.com/superfluid-finance/protocol-monorepo/tree/dev/packages/sdk-core#readme", "repository": { diff --git a/packages/subgraph/config/celo-mainnet.json b/packages/subgraph/config/celo-mainnet.json new file mode 100644 index 0000000000..81ca7261e7 --- /dev/null +++ b/packages/subgraph/config/celo-mainnet.json @@ -0,0 +1,10 @@ +{ + "network": "celo", + "hostStartBlock": 16393000, + "hostAddress": "0xA4Ff07cF81C02CFD356184879D953970cA957585", + "cfaAddress": "0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad", + "idaAddress": "0x26747Fe93fAC8bF28E1e24A558a2bC7E4d9846cA", + "superTokenFactoryAddress": "0x36be86dEe6BC726Ed0Cbd170ccD2F21760BC73D9", + "resolverV1Address": "0x05eE721BD4D803d6d477Aa7607395452B65373FF", + "nativeAssetSuperTokenAddress": "0x671425Ae1f272Bc6F79beC3ed5C4b00e9c628240" +} \ No newline at end of file diff --git a/packages/subgraph/hardhat.config.ts b/packages/subgraph/hardhat.config.ts index e9fc877ce9..7f434d4af6 100644 --- a/packages/subgraph/hardhat.config.ts +++ b/packages/subgraph/hardhat.config.ts @@ -46,6 +46,10 @@ const config: HardhatUserConfig = { url: process.env.BSC_MAINNET_PROVIDER_URL || "", chainId: 56, }, + "celo-mainnet": { + url: process.env.CELO_MAINNET_PROVIDER_URL || "", + chainId: 42220, + }, goerli: { url: process.env.GOERLI_PROVIDER_URL || "", chainId: 5, diff --git a/packages/subgraph/networks.json b/packages/subgraph/networks.json index a17d223424..a3b094b6ab 100644 --- a/packages/subgraph/networks.json +++ b/packages/subgraph/networks.json @@ -10,5 +10,6 @@ "arbitrum-goerli", "optimism-goerli", "avalanche-fuji", - "bsc-mainnet" + "bsc-mainnet", + "celo-mainnet" ] diff --git a/packages/subgraph/package.json b/packages/subgraph/package.json index 415db6075d..c6915c68de 100644 --- a/packages/subgraph/package.json +++ b/packages/subgraph/package.json @@ -52,7 +52,7 @@ "dependencies": { "@graphprotocol/graph-cli": "0.37.0", "@graphprotocol/graph-ts": "0.29.0", - "@superfluid-finance/sdk-core": "0.6.1", + "@superfluid-finance/sdk-core": "0.6.2", "mustache": "^4.2.0" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index ff4b5e376c..64d02b2804 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3464,8 +3464,8 @@ stack-trace "0.0.10" "@superfluid-finance/metadata@git+https://github.com/superfluid-finance/metadata.git": - version "1.1.0" - resolved "git+https://github.com/superfluid-finance/metadata.git#69f9e0dc756f5e55164e9a270b8c0c61c0284aae" + version "1.1.1" + resolved "git+https://github.com/superfluid-finance/metadata.git#694c4d79159e5aa1f61bf258c2afcc93fed00df2" "@szmarczak/http-timer@^1.1.2": version "1.1.2"