Skip to content

Commit

Permalink
Add flag to keep every vault
Browse files Browse the repository at this point in the history
  • Loading branch information
prevostc committed Nov 25, 2024
1 parent bd6882a commit ef1fae8
Show file tree
Hide file tree
Showing 22 changed files with 117 additions and 51 deletions.
2 changes: 1 addition & 1 deletion bin/delete-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

# config
valid_chains=($(ls config | sed 's/\.json//g'))
valid_providers=("goldsky" "0xgraph")
valid_providers=("goldsky" "0xgraph" "sentio")

function exit_help {
echo "Usage: $0 <version> <provider> <deploy_key>"
Expand Down
40 changes: 28 additions & 12 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# config
valid_chains=($(ls config | sed 's/\.json//g'))
valid_providers=("goldsky" "0xgraph")
valid_providers=("goldsky" "0xgraph" "sentio")

function exit_help {
echo "Usage: $0 <chain> <provider1> [<provider2>] ... [<providerN>]"
Expand All @@ -12,16 +12,15 @@ function exit_help {
exit 1
}

function prepare {
function publish_0xgraph {
CHAIN=$1
SUBGRAPH=$2

echo "preparing $CHAIN"
yarn prepare:$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 @@ -30,32 +29,50 @@ function publish_0xgraph {
yarn run graph deploy $SUBGRAPH --node https://api.0xgraph.xyz/deploy --ipfs https://api.0xgraph.xyz/ipfs --version-label=v0.0.1
}

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

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

echo "publishing $SUBGRAPH to goldsky"
goldsky subgraph delete $SUBGRAPH/0.0.1
sleep 10
goldsky subgraph deploy $SUBGRAPH/0.0.1 --path .
}

function publish_sentio {
CHAIN=$1
SUBGRAPH=$2
if [ -z "$SENTIO_OWNER" ]; then
echo "SENTIO_OWNER is required"
exit 1
fi

echo "preparing $CHAIN"
yarn prepare:$CHAIN
yarn codegen

SUBGRAPH=$1
echo "publishing $SUBGRAPH to sentio"
npx @sentio/cli graph deploy --name $SUBGRAPH
npx @sentio/cli graph deploy --owner $SENTIO_OWNER --name $SUBGRAPH
}

function publish {
CHAIN=$1
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
;;
"sentio")
publish_sentio beefy-clm-$CHAIN
publish_sentio $CHAIN beefy-clm-$CHAIN
;;
esac
}
Expand Down Expand Up @@ -85,7 +102,6 @@ for provider in $providers; do
done


prepare $chain
for provider in $providers; do
publish $chain $provider
done
3 changes: 3 additions & 0 deletions bin/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ fi

set -e

echo "Generating subgraph.yaml $CHAIN"
yarn --silent run mustache config/$CHAIN.json subgraph.template.yaml > subgraph.yaml

echo "Generating src/config.ts $CHAIN"
yarn --silent run mustache config/$CHAIN.json src/config.template.ts > src/config.ts

RNG=$((1 + $RANDOM % 100000))
Expand Down
12 changes: 11 additions & 1 deletion bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

# config
valid_chains=($(ls config | sed 's/\.json//g'))
valid_providers=("goldsky" "0xgraph")
valid_providers=("goldsky" "0xgraph" "sentio")

function exit_help {
echo "Usage: $0 <version> <chain> <provider> <deploy_key>"
Expand Down Expand Up @@ -40,6 +40,13 @@ function publish_goldsky {
goldsky subgraph tag create $SUBGRAPH/$VERSION --token $DEPLOY_KEY --tag next
}

function publish_sentio {
SUBGRAPH=$1
VERSION=$2
echo "publishing $SUBGRAPH to sentio"
npx @sentio/cli graph deploy --name $SUBGRAPH
}

function publish {
VERSION=$1
CHAIN=$2
Expand All @@ -53,6 +60,9 @@ function publish {
"goldsky")
publish_goldsky beefy-clm-$CHAIN $VERSION $DEPLOY_KEY
;;
"sentio")
publish_sentio beefy-clm-$CHAIN $VERSION
;;
esac
}

Expand Down
4 changes: 3 additions & 1 deletion config/arbitrum-beta.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0xCee843CD04E3758dDC5BCFf08647DddB117151D0",
"beefyOracleAddress": "0x5C7c7Bb0c9251821cB5a1D9c08F21B0DAD5efe65"
"beefyOracleAddress": "0x5C7c7Bb0c9251821cB5a1D9c08F21B0DAD5efe65",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/arbitrum.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0xCee843CD04E3758dDC5BCFf08647DddB117151D0",
"beefyOracleAddress": "0x5C7c7Bb0c9251821cB5a1D9c08F21B0DAD5efe65"
"beefyOracleAddress": "0x5C7c7Bb0c9251821cB5a1D9c08F21B0DAD5efe65",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/avax.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x20a93Fc2Eb630B98c9C8ef276867C74cc6D5D7C9",
"beefyOracleAddress": "0xec27635CDD3F68cC6534b3bc381bb585a40bfeD3"
"beefyOracleAddress": "0xec27635CDD3F68cC6534b3bc381bb585a40bfeD3",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x9F8c6a094434C6E6f5F2792088Bb4d2D5971DdCc",
"beefyOracleAddress": "0x1BfA205114678c7d17b97DB7A71819D3E6718eb4"
"beefyOracleAddress": "0x1BfA205114678c7d17b97DB7A71819D3E6718eb4",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/bsc.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x4362FE9aC48e7c5ea85a359418bBd7471979F5C2",
"beefyOracleAddress": "0x32468F9097dCa52225b86a7cA5203ad0012F327C"
"beefyOracleAddress": "0x32468F9097dCa52225b86a7cA5203ad0012F327C",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/linea.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x5aD159A8537fE39CAD81748726584C05b68b3c11",
"beefyOracleAddress": "0x3923704D9684ABb234743d65D96c43Bf26414481"
"beefyOracleAddress": "0x3923704D9684ABb234743d65D96c43Bf26414481",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/manta.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x07f1ad98b725Af45485646aC431b7757f50C598A",
"beefyOracleAddress": "0x2AfB174c22D9eE334895C4e300ab93154d800aA0"
"beefyOracleAddress": "0x2AfB174c22D9eE334895C4e300ab93154d800aA0",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/mantle.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x9C18deE5290925f596fbEfee2f6745b640f3A4C6",
"beefyOracleAddress": "0x61129dCBd8944aB2D1C6792428603b0845f60c5B"
"beefyOracleAddress": "0x61129dCBd8944aB2D1C6792428603b0845f60c5B",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/moonbeam.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x8F40C4Be6732241222293953475a9e69BFc607AA",
"beefyOracleAddress": "0x4d417C189AE9D1B128397026A124b531A535D741"
"beefyOracleAddress": "0x4d417C189AE9D1B128397026A124b531A535D741",

"onlyKeepClmClassicVaults": true
}
38 changes: 20 additions & 18 deletions config/opera.json
Original file line number Diff line number Diff line change
@@ -1,35 +1,37 @@
{
"network": "manta-pacific-mainnet",
"network": "bsc",

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

"clmManagerFactoryAddress": "0x91BB303E972995EbE5f593BCddBb6F5Ef49Dbcbd",
"clmManagerFactoryStartBlock": 2501033,
"clmStrategyFactoryAddress": "0x448a3539a591dE3Fb9D5AAE407471D21d40cD315",
"clmStrategyFactoryStartBlock": 2501044,
"rewardPoolFactoryAddress": "0x9818dF1Bdce8D0E79B982e2C3a93ac821b3c17e0",
"rewardPoolFactoryStartBlock": 2501035,
"beefyClassicVaultFactoryAddress": "0xfc69704cC3cAac545cC7577009Ea4AA04F1a61Eb",
"beefyClassicVaultFactoryStartBlock": 2501033,
"clmManagerFactoryAddress": "0xAe8b53413862984C4e10929D41735800E0A4EdF9",
"clmManagerFactoryStartBlock": 40991490,
"clmStrategyFactoryAddress": "0x15e8ebC56b473482f18442BEd9c22F9d959C9C49",
"clmStrategyFactoryStartBlock": 40991611,
"rewardPoolFactoryAddress": "0x28FE23CFf3d9E876dEffd8b592cd681bdBcE9833",
"rewardPoolFactoryStartBlock": 40991544,
"beefyClassicVaultFactoryAddress": "0xe596eC590DE52C09c8D1C7A1294B32F957A7c94e",
"beefyClassicVaultFactoryStartBlock": 40991490,
"beefyClassicBoostFactoryAddress": "0x0000000000000000000000000000000000000000",
"beefyClassicBoostFactoryStartBlock": 2501033,
"clockTickBlocks": 50,
"beefyClassicBoostFactoryStartBlock": 40991490,
"clockTickBlocks": 100,

"wrappedNativeAddress": "0x0Dc808adcE2099A9F62AA87D9670745AbA741746",
"wrappedNativeAddress": "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
"wrappedNativeDecimals": 18,

"priceOracleType": "pyth",
"chainlinkNativePriceFeedAddress": "0x0000000000000000000000000000000000000000",
"priceOracleType": "chainlink",
"chainlinkNativePriceFeedAddress": "0x0567F2323251f0Aab15c8dFb1967E4e8A7D42aeE",
"chainlinkNativePriceFeedDecimals": 8,
"pythPriceFeedAddress": "0xA2aa501b19aff244D90cc15a4Cf739D2725B5729",
"pythNativePriceId": "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace",
"pythPriceFeedAddress": "0x4D7E825f80bDf85e913E0DD2A2D54927e9dE1594",
"pythNativePriceId": "0x2f95862b045670cd22bee3114c39763a4a08beeb663b145d283c31d7d1101c4f",
"umbrellaRegistryAddress": "0x4A28406ECe8FfD7A91789738A5AC15DAC44bfA1B",
"umbrellaRegistryPriceFeedName": "WRBTC-rUSDT",
"umbrellaRegistryPriceFeedNameBytes32": "0xd2a0ad2667ba45a57ce6a98d6f51a4a4d256d704f578b3b90d7ee12e2f6af854",
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x07f1ad98b725Af45485646aC431b7757f50C598A",
"beefyOracleAddress": "0x2AfB174c22D9eE334895C4e300ab93154d800aA0"
"beefySwapperAddress": "0x4362FE9aC48e7c5ea85a359418bBd7471979F5C2",
"beefyOracleAddress": "0x32468F9097dCa52225b86a7cA5203ad0012F327C",

"onlyKeepClmClassicVaults": false
}
4 changes: 3 additions & 1 deletion config/optimism.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0xe115b50c52cB5624fD76232cDF498ADA6ECD1e69",
"beefyOracleAddress": "0x7066606233Cc8b5ede0925003F8910FF7B15219C"
"beefyOracleAddress": "0x7066606233Cc8b5ede0925003F8910FF7B15219C",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/polygon.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0xDd27227Dba7Ea8F5869466A10A8E36Bb2D709b35",
"beefyOracleAddress": "0xfcE4448C50A96c279afdB8CE7735295660653e19"
"beefyOracleAddress": "0xfcE4448C50A96c279afdB8CE7735295660653e19",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/rootstock.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x3C0b1765C379833b86A1704997019A7496Afdfae",
"beefyOracleAddress": "0x70127945067E4224d7B6ABfDc6f57e3ea45d5CA4"
"beefyOracleAddress": "0x70127945067E4224d7B6ABfDc6f57e3ea45d5CA4",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/scroll.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0xBC4a342B0c057501E081484A2d24e576E854F823",
"beefyOracleAddress": "0x448a3539a591dE3Fb9D5AAE407471D21d40cD315"
"beefyOracleAddress": "0x448a3539a591dE3Fb9D5AAE407471D21d40cD315",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/sei.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x8e0B63846ebEFf857EE35eF3BD3A2df9EF7D6456",
"beefyOracleAddress": "0x9818dF1Bdce8D0E79B982e2C3a93ac821b3c17e0"
"beefyOracleAddress": "0x9818dF1Bdce8D0E79B982e2C3a93ac821b3c17e0",

"onlyKeepClmClassicVaults": true
}
4 changes: 3 additions & 1 deletion config/zksync.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@
"umbrellaRegistryPriceFeedDecimals": 8,

"beefySwapperAddress": "0x46b9821E57a68274342E679B2a44c1acb5Af55C8",
"beefyOracleAddress": "0x072A7B3a35C7980146E23770576DC84c96Bc49Da"
"beefyOracleAddress": "0x072A7B3a35C7980146E23770576DC84c96Bc49Da",

"onlyKeepClmClassicVaults": true
}
9 changes: 6 additions & 3 deletions src/classic/lifecycle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { PRODUCT_LIFECYCLE_PAUSED, PRODUCT_LIFECYCLE_RUNNING } from "../common/e
import { ADDRESS_ZERO } from "../common/utils/address"
import { isClmManager, isClmRewardPool } from "../clm/entity/clm"
import { fetchClassicUnderlyingCLM } from "./utils/classic-data"
import { ONLY_KEEP_CLM_CLASSIC_VAULTS } from "../config"

export function handleClassicVaultOrStrategyCreated(event: VaultOrStrategyCreated): void {
const address = event.params.proxy
Expand Down Expand Up @@ -153,7 +154,7 @@ function fetchInitialClassicDataAndSave(classic: Classic): void {
const underlyingTokenAddress = underlyingTokenAddressRes.value

const isClmUnderlying = isClmRewardPool(underlyingTokenAddress) || isClmManager(underlyingTokenAddress)
if (!isClmUnderlying) {
if (!isClmUnderlying && ONLY_KEEP_CLM_CLASSIC_VAULTS) {
log.info("Underlying token address is not related to clm, removing: {}", [underlyingTokenAddress.toHexString()])
removeClassicAndDependencies(classic)
return
Expand All @@ -169,8 +170,10 @@ function fetchInitialClassicDataAndSave(classic: Classic): void {

const clm = fetchClassicUnderlyingCLM(classic)
if (clm == null) {
log.error("Failed to fetch CLM data for Classic: {}", [classic.id.toHexString()])
removeClassicAndDependencies(classic)
if (ONLY_KEEP_CLM_CLASSIC_VAULTS) {
log.error("Failed to fetch CLM data for Classic: {}", [classic.id.toHexString()])
removeClassicAndDependencies(classic)
}
return
}
classic.underlyingBreakdownTokens = [clm.underlyingToken0, clm.underlyingToken1]
Expand Down
4 changes: 3 additions & 1 deletion src/config.template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,6 @@ export const BEEFY_SWAPPER_ADDRESS = Address.fromString("{{beefySwapperAddress}}
export const BEEFY_ORACLE_ADDRESS = Address.fromString("{{beefyOracleAddress}}")
// amount we divide 1 of _fromToken to get 1 of _toToken before asking for the price
// this is to avoid liquidity issues with tokens that have very high price (e.g. BTC)
export const BEEFY_SWAPPER_VALUE_SCALER = BigInt.fromU32(1000)
export const BEEFY_SWAPPER_VALUE_SCALER = BigInt.fromU32(1000)

export const ONLY_KEEP_CLM_CLASSIC_VAULTS = {{onlyKeepClmClassicVaults}}

0 comments on commit ef1fae8

Please sign in to comment.