Skip to content

Commit

Permalink
Add sonic
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Dec 20, 2024
1 parent 7f0e3be commit 1b65461
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 162 deletions.
37 changes: 16 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,21 @@ This Subgraph sources events from the Beefy CLM contracts in different networks.
### Latest endpoints

- [Arbitrum](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-arbitrum/latest/gn)
- [Avax](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-avax/latest/gn)
- [Base](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-base/latest/gn)
- [Bsc](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-bsc/latest/gn)
- [Linea](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-linea/latest/gn)
- [Lisk](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-lisk/latest/gn)
- [Manta](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-manta/latest/gn)
- [Mantle](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-mantle/latest/gn)
- [Mode](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-mode/latest/gn)
- [Moonbeam](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-moonbeam/latest/gn)
- [Optimism](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-optimism/latest/gn)
- [Polygon](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-polygon/latest/gn)
- [zkSync](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-zksync/latest/gn)
- [mantle](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-mantle/latest/gn)
- [Rootstock](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-rootstock/latest/gn)
- [sei](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-sei/latest/gn)
- [Sonic](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-sonic/latest/gn)
- [ZkSync](https://api.goldsky.com/api/public/project_clu2walwem1qm01w40v3yhw1f/subgraphs/beefy-clm-zksync/latest/gn)

### Historical endpoints

Expand All @@ -29,30 +36,19 @@ This Subgraph sources events from the Beefy CLM contracts in different networks.
- Git: [git-scm.com](https://git-scm.com)
- Node.js: [nodejs.org](https://nodejs.org), see version in [.nvmrc](.nvmrc)
- Yarn: [yarnpkg.com](https://yarnpkg.com)
- Docker: [docker.com](https://www.docker.com)
- Docker Compose: [docker.com](https://docs.docker.com/compose/install/)

## Setup the project

```bash
yarn install
```

## Running a local instance of graph-node locally
## Building the subgraph locally

```bash
yarn infra:start
```

## Deploying the subgraph locally

```bash
yarn remove-local # if you have already deployed the subgraph
yarn create-local # create the subgraph locally
yarn prepare:<network> # apply configuration for the network
yarn configure <network> # apply configuration for the network
yarn codegen # generate the typescript types
yarn build # build the subgraph code
yarn deploy-local # deploy the subgraph locally
```

## Run tests
Expand All @@ -78,14 +74,13 @@ yarn test:lint # run prettier linter
- `"priceOracleType" : "pyth"`
- Find the pyth contract address [on pyth's documentation](https://docs.pyth.network/price-feeds/contract-addresses/evm). Put the address in `pythPriceFeedAddress`.
- Grab the `Crypto.<native>/USD` price feed ID [on pyth's documentation](https://pyth.network/developers/price-feed-ids). Put the ID in `pythPriceFeedId`.
2. Add dev RPCs in graph-node config [docker/graph-node/config.toml](docker/graph-node/config.toml).
3. Add a new `prepare:<network>` script in [package.json](package.json).
4. Add the chain name in the Release script in [.github/workflows/Release.yml](.github/workflows/Release.yml).
5. Release the first version of the subgraph for the new network using the [./bin/release.sh](./bin/release.sh) script.
2. Add the chain name in the Release script in [.github/workflows/Release.yml](.github/workflows/Release.yml).
3. Add the endpoint link to the [README](README.md) in alphabetical order.
4. Release the first version of the subgraph for the new network using the [./bin/release.sh](./bin/release.sh) script.
- Must be logged in to goldsky with the provided cli.
- Only used to deploy the first version, see below for updating a subgraph.
6. Tag the new version on Goldsky's UI as "latest" to create a stable endpoint.
7. Add the endpoint link to the [README](README.md) in alphabetical order.

When ready: 4. Tag the new version on Goldsky's UI as "latest" to create a stable endpoint.

### Release a new version of the subgraph

Expand Down
25 changes: 17 additions & 8 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,17 @@ function exit_help {

function prepare {
CHAIN=$1
}

function publish_0xgraph {
CHAIN=$1
SUBGRAPH=$2

echo "preparing $CHAIN"
yarn prepare:$CHAIN
yarn configure $CHAIN
yarn codegen
yarn build
}

function publish_0xgraph {
SUBGRAPH=$1
echo "publishing $SUBGRAPH to 0xgraph"
yarn run graph remove $SUBGRAPH --node https://api.0xgraph.xyz/deploy
sleep 5
Expand All @@ -31,7 +34,14 @@ function publish_0xgraph {
}

function publish_goldsky {
SUBGRAPH=$1
CHAIN=$1
SUBGRAPH=$2

echo "preparing $CHAIN"
yarn configure $CHAIN
yarn codegen
yarn build

echo "publishing $SUBGRAPH to goldsky"
goldsky subgraph delete $SUBGRAPH/0.0.1
sleep 10
Expand All @@ -43,10 +53,10 @@ function publish {
PROVIDER=$2
case $PROVIDER in
"0xgraph")
publish_0xgraph beefyfinance/clm-$CHAIN
publish_0xgraph $CHAIN beefyfinance/clm-$CHAIN
;;
"goldsky")
publish_goldsky beefy-clm-$CHAIN-dev
publish_goldsky $CHAIN beefy-clm-$CHAIN-dev
;;
esac
}
Expand Down Expand Up @@ -76,7 +86,6 @@ for provider in $providers; do
done


prepare $chain
for provider in $providers; do
publish $chain $provider
done
31 changes: 18 additions & 13 deletions bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,32 @@ function exit_help {
exit 1
}

function prepare {
function publish_0xgraph {
CHAIN=$1
SUBGRAPH=$2
VERSION=$3
DEPLOY_KEY=$4

echo "preparing $CHAIN"
yarn prepare:$CHAIN
yarn configure $CHAIN
yarn codegen
yarn build
}

function publish_0xgraph {
SUBGRAPH=$1
VERSION=$2
DEPLOY_KEY=$3
echo "publishing $SUBGRAPH to 0xgraph"
yarn run graph deploy $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
CHAIN=$1
SUBGRAPH=$2
VERSION=$3
DEPLOY_KEY=$4

echo "preparing $CHAIN"
yarn configure $CHAIN
yarn codegen
yarn build

echo "publishing $SUBGRAPH to goldsky"
goldsky subgraph deploy $SUBGRAPH/$VERSION --path . --token $DEPLOY_KEY
sleep 5 # wait for the subgraph to propagate
Expand All @@ -48,10 +54,10 @@ function publish {
SUBGRAPH=
case $PROVIDER in
"0xgraph")
publish_0xgraph beefyfinance/clm-$CHAIN $VERSION $DEPLOY_KEY
publish_0xgraph $CHAIN beefyfinance/clm-$CHAIN $VERSION $DEPLOY_KEY
;;
"goldsky")
publish_goldsky beefy-clm-$CHAIN $VERSION $DEPLOY_KEY
publish_goldsky $CHAIN beefy-clm-$CHAIN $VERSION $DEPLOY_KEY
;;
esac
}
Expand Down Expand Up @@ -95,5 +101,4 @@ if [ -z "$deploy_key" ]; then
exit_help
fi

prepare $chain
publish $version $chain $provider $deploy_key
35 changes: 35 additions & 0 deletions config/sonic.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"network": "sonic",

"multicall3Address": "0xcA11bde05977b3631167028862bE2a173976CA11",
"shareTokenMintAddress": "0x0000000000000000000000000000000000000000",
"burnAddress": "0x000000000000000000000000000000000000dead",

"clmManagerFactoryAddress": "0xD19ab62F83380908D65E344567378cF104cE46c2",
"clmManagerFactoryStartBlock": 491446,
"clmStrategyFactoryAddress": "0xC2cEE7cf27D2Eda09fEc1743f3953dA77Bf1DA61",
"clmStrategyFactoryStartBlock": 491464,
"rewardPoolFactoryAddress": "0x3C0b1765C379833b86A1704997019A7496Afdfae",
"rewardPoolFactoryStartBlock": 491452,
"beefyClassicVaultFactoryAddress": "0x8e0B63846ebEFf857EE35eF3BD3A2df9EF7D6456",
"beefyClassicVaultFactoryStartBlock": 490985,
"beefyClassicBoostFactoryAddress": "0x0000000000000000000000000000000000000000",
"beefyClassicBoostFactoryStartBlock": 490985,
"clockTickBlocks": 800,

"wrappedNativeAddress": "0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38",
"wrappedNativeDecimals": 18,

"priceOracleType": "pyth",
"chainlinkNativePriceFeedAddress": "0x0000000000000000000000000000000000000000",
"chainlinkNativePriceFeedDecimals": 8,
"pythPriceFeedAddress": "0x2880ab155794e7179c9ee2e38200202908c17b43",
"pythNativePriceId": "0xf490b178d0c85683b7a0f2388b40af2e6f7c90cbe0f96b31f315f08d0e5a2d6d",
"umbrellaRegistryAddress": "0x0000000000000000000000000000000000000000",
"umbrellaRegistryPriceFeedName": "WRBTC-rUSDT",
"umbrellaRegistryPriceFeedNameBytes32": "0xd2a0ad2667ba45a57ce6a98d6f51a4a4d256d704f578b3b90d7ee12e2f6af854",
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x9818dF1Bdce8D0E79B982e2C3a93ac821b3c17e0",
"beefyOracleAddress": "0xBC4a342B0c057501E081484A2d24e576E854F823"
}
69 changes: 0 additions & 69 deletions docker-compose.yml

This file was deleted.

1 change: 0 additions & 1 deletion docker/.gitignore

This file was deleted.

32 changes: 0 additions & 32 deletions docker/graph-node/config.toml

This file was deleted.

20 changes: 2 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"scripts": {
"prepare": "husky",
"postinstall": "yarn run --silent prepare:arbitrum && yarn run --silent codegen",
"postinstall": "yarn run --silent configure arbitrum && yarn run --silent codegen",
"codegen": "rm -Rf generated && graph codegen",
"build": "graph build",
"format": "prettier . --write",
Expand All @@ -15,23 +15,7 @@
"create-local": "graph create beefyfinance/beefy-cl --node http://127.0.0.1:8020",
"deploy-local": "graph deploy beefyfinance/beefy-cl --node http://127.0.0.1:8020 --ipfs http://localhost:5001",
"remove-local": "graph remove beefyfinance/beefy-cl --node http://127.0.0.1:8020",
"prepare:arbitrum-beta": "./bin/prepare.sh arbitrum-beta",
"prepare:arbitrum": "./bin/prepare.sh arbitrum",
"prepare:base": "./bin/prepare.sh base",
"prepare:bsc": "./bin/prepare.sh bsc",
"prepare:linea": "./bin/prepare.sh linea",
"prepare:manta": "./bin/prepare.sh manta",
"prepare:moonbeam": "./bin/prepare.sh moonbeam",
"prepare:optimism": "./bin/prepare.sh optimism",
"prepare:polygon": "./bin/prepare.sh polygon",
"prepare:zksync": "./bin/prepare.sh zksync",
"prepare:mantle": "./bin/prepare.sh mantle",
"prepare:sei": "./bin/prepare.sh sei",
"prepare:avax": "./bin/prepare.sh avax",
"prepare:rootstock": "./bin/prepare.sh rootstock",
"prepare:scroll": "./bin/prepare.sh scroll",
"prepare:mode": "./bin/prepare.sh mode",
"prepare:lisk": "./bin/prepare.sh lisk"
"configure": "./bin/prepare.sh "
},
"main": "./bin/index.js",
"bin": {
Expand Down

0 comments on commit 1b65461

Please sign in to comment.