Skip to content

Commit

Permalink
added celo-mainnet support (#1263)
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
d10r and 0xdavinchee authored Feb 13, 2023
1 parent 7cf8e30 commit 33aef62
Show file tree
Hide file tree
Showing 16 changed files with 55 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/handler.verify-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}}
6 changes: 6 additions & 0 deletions packages/ethereum-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ const chainIds = {

"bsc-mainnet": 56,

"celo-mainnet": 42220,

localhost: 31337,
hardhat: 31337,
};
Expand Down Expand Up @@ -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",
},
Expand Down
6 changes: 3 additions & 3 deletions packages/ethereum-contracts/ops-scripts/libs/getConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
13 changes: 7 additions & 6 deletions packages/ethereum-contracts/tasks/deploy-cfa-forwarder.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash -eux
#!/usr/bin/env bash
set -eux

# Usage:
# tasks/deploy-cfa-forwarder.sh <network> <contract-addr>
Expand All @@ -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
# TODO: on mainnets, the resolver entry should be set only after the gov action was signed & executed
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
4 changes: 3 additions & 1 deletion packages/ethereum-contracts/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ const ALIASES = {

"bsc-mainnet": ["bsc"],

"celo-mainnet": ["celo"],

// currently unsupported
//
"optimism-kovan": ["opkovan"],
Expand All @@ -81,7 +83,6 @@ const ALIASES = {

"bsc-chapel": ["chapel"],

"celo-mainnet": ["celo"],
"celo-alfajores": ["alfajores"],
};

Expand Down Expand Up @@ -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,
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/ethereum-contracts/utils/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion packages/ethereum-contracts/utils/supertoken-deployer.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ <h3 id="loader" style="text-align: center; display: none;">Loading...</h3>
{ 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, ...
Expand Down
13 changes: 6 additions & 7 deletions packages/js-sdk/src/getConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -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",
Expand Down
6 changes: 4 additions & 2 deletions packages/sdk-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk-core/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
10 changes: 10 additions & 0 deletions packages/subgraph/config/celo-mainnet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"network": "celo",
"hostStartBlock": 16393000,
"hostAddress": "0xA4Ff07cF81C02CFD356184879D953970cA957585",
"cfaAddress": "0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad",
"idaAddress": "0x26747Fe93fAC8bF28E1e24A558a2bC7E4d9846cA",
"superTokenFactoryAddress": "0x36be86dEe6BC726Ed0Cbd170ccD2F21760BC73D9",
"resolverV1Address": "0x05eE721BD4D803d6d477Aa7607395452B65373FF",
"nativeAssetSuperTokenAddress": "0x671425Ae1f272Bc6F79beC3ed5C4b00e9c628240"
}
4 changes: 4 additions & 0 deletions packages/subgraph/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/subgraph/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"arbitrum-goerli",
"optimism-goerli",
"avalanche-fuji",
"bsc-mainnet"
"bsc-mainnet",
"celo-mainnet"
]
2 changes: 1 addition & 1 deletion packages/subgraph/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 33aef62

Please sign in to comment.