-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
271 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ enum GqlChain { | |
OPTIMISM | ||
POLYGON | ||
ZKEVM | ||
SEPOLIA | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,245 @@ | ||
import { BigNumber, ethers } from 'ethers'; | ||
import { DeploymentEnv, NetworkConfig, NetworkData } from './network-config-types'; | ||
import { tokenService } from '../token/token.service'; | ||
import { PhantomStableAprService } from '../pool/lib/apr-data-sources/phantom-stable-apr.service'; | ||
import { BoostedPoolAprService } from '../pool/lib/apr-data-sources/boosted-pool-apr.service'; | ||
import { SwapFeeAprService } from '../pool/lib/apr-data-sources/swap-fee-apr.service'; | ||
import { GaugeAprService } from '../pool/lib/apr-data-sources/ve-bal-gauge-apr.service'; | ||
import { GaugeStakingService } from '../pool/lib/staking/gauge-staking.service'; | ||
import { BptPriceHandlerService } from '../token/lib/token-price-handlers/bpt-price-handler.service'; | ||
import { LinearWrappedTokenPriceHandlerService } from '../token/lib/token-price-handlers/linear-wrapped-token-price-handler.service'; | ||
import { SwapsPriceHandlerService } from '../token/lib/token-price-handlers/swaps-price-handler.service'; | ||
import { UserSyncGaugeBalanceService } from '../user/lib/user-sync-gauge-balance.service'; | ||
import { every } from '../../worker/intervals'; | ||
import { GithubContentService } from '../content/github-content.service'; | ||
import { gaugeSubgraphService } from '../subgraphs/gauge-subgraph/gauge-subgraph.service'; | ||
import { CoingeckoPriceHandlerService } from '../token/lib/token-price-handlers/coingecko-price-handler.service'; | ||
import { coingeckoService } from '../coingecko/coingecko.service'; | ||
import { YbTokensAprService } from '../pool/lib/apr-data-sources/yb-tokens-apr.service'; | ||
import { env } from '../../app/env'; | ||
import { BalancerSubgraphService } from '../subgraphs/balancer-subgraph/balancer-subgraph.service'; | ||
|
||
export const sepoliaNetworkData: NetworkData = { | ||
chain: { | ||
slug: 'sepolia', | ||
id: 11155111, | ||
nativeAssetAddress: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', | ||
wrappedNativeAssetAddress: '0x7b79995e5f793A07Bc00c21412e50Ecae098E7f9', | ||
prismaId: 'SEPOLIA', | ||
gqlId: 'SEPOLIA', | ||
}, | ||
subgraphs: { | ||
startDate: '2021-08-23', | ||
balancer: 'https://api.studio.thegraph.com/query/24660/balancer-sepolia-v2/version/latest', | ||
beetsBar: 'https://', | ||
blocks: 'https://', | ||
gauge: 'https://api.studio.thegraph.com/query/24660/balancer-gauges-sepolia-beta/version/latest', | ||
// veBalLocks: 'https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-gauges', | ||
userBalances: 'https://', | ||
}, | ||
eth: { | ||
address: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', | ||
addressFormatted: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE', | ||
symbol: 'ETH', | ||
name: 'Ether', | ||
}, | ||
weth: { | ||
address: '0x82af49447d8a07e3bd95bd0d56f35241523fbab1', | ||
addressFormatted: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1', | ||
}, | ||
coingecko: { | ||
nativeAssetId: 'ethereum', | ||
platformId: 'ethereum', | ||
excludedTokenAddresses: [], | ||
}, | ||
rpcUrl: env.INFURA_API_KEY | ||
? `https://sepolia.infura.io/v3/${env.INFURA_API_KEY}` | ||
: 'https://gateway.tenderly.co/public/sepolia', | ||
rpcMaxBlockRange: 700, | ||
protocolToken: 'bal', | ||
bal: { | ||
address: '0xb19382073c7A0aDdbb56Ac6AF1808Fa49e377B75', | ||
}, | ||
// veBal: { | ||
// address: '0xc128a9954e6c874ea3d62ce62b468ba073093f25', | ||
// delegationProxy: '0x81cfae226343b24ba12ec6521db2c79e7aeeb310', | ||
// }, | ||
balancer: { | ||
vaultV2Address: '0xba12222222228d8ba445958a75a0704d566bf2c8', | ||
v2DefaultSwapFeePercentage: '0.5', | ||
v2DefaultYieldFeePercentage: '0.5', | ||
vaultV3Address: '0xba12222222228d8ba445958a75a0704d566bf2c8', | ||
v3DefaultSwapFeePercentage: '0.5', | ||
v3DefaultYieldFeePercentage: '0.5', | ||
}, | ||
multicall: '0x80c7dd17b01855a6d2347444a0fcc36136a314de', | ||
multicall3: '0xca11bde05977b3631167028862be2a173976ca11', | ||
avgBlockSpeed: 1, | ||
sor: { | ||
main: { | ||
url: 'https://uu6cfghhd5lqa7py3nojxkivd40zuugb.lambda-url.ca-central-1.on.aws/', | ||
maxPools: 8, | ||
forceRefresh: false, | ||
gasPrice: BigNumber.from(10), | ||
swapGas: BigNumber.from('1000000'), | ||
poolIdsToExclude: [], | ||
}, | ||
canary: { | ||
url: 'https://ksa66wlkjbvteijxmflqjehsay0jmekw.lambda-url.eu-central-1.on.aws/', | ||
maxPools: 8, | ||
forceRefresh: false, | ||
gasPrice: BigNumber.from(10), | ||
swapGas: BigNumber.from('1000000'), | ||
poolIdsToExclude: [], | ||
}, | ||
}, | ||
ybAprConfig: {}, | ||
datastudio: { | ||
main: { | ||
user: 'datafeed-service@datastudio-366113.iam.gserviceaccount.com', | ||
sheetId: '11anHUEb9snGwvB-errb5HvO8TvoLTRJhkDdD80Gxw1Q', | ||
databaseTabName: 'Database v2', | ||
compositionTabName: 'Pool Composition v2', | ||
emissionDataTabName: 'EmissionData', | ||
}, | ||
canary: { | ||
user: 'datafeed-service@datastudio-366113.iam.gserviceaccount.com', | ||
sheetId: '1HnJOuRQXGy06tNgqjYMzQNIsaCSCC01Yxe_lZhXBDpY', | ||
databaseTabName: 'Database v2', | ||
compositionTabName: 'Pool Composition v2', | ||
emissionDataTabName: 'EmissionData', | ||
}, | ||
}, | ||
monitoring: { | ||
main: { | ||
alarmTopicArn: 'arn:aws:sns:ca-central-1:118697801881:api_alarms', | ||
}, | ||
canary: { | ||
alarmTopicArn: 'arn:aws:sns:eu-central-1:118697801881:api_alarms', | ||
}, | ||
}, | ||
}; | ||
|
||
export const sepoliaNetworkConfig: NetworkConfig = { | ||
data: sepoliaNetworkData, | ||
contentService: new GithubContentService(), | ||
provider: new ethers.providers.JsonRpcProvider({ url: sepoliaNetworkData.rpcUrl, timeout: 60000 }), | ||
poolAprServices: [ | ||
new YbTokensAprService(sepoliaNetworkData.ybAprConfig, sepoliaNetworkData.chain.prismaId), | ||
new PhantomStableAprService(sepoliaNetworkData.chain.prismaId), | ||
new BoostedPoolAprService(), | ||
new SwapFeeAprService(), | ||
new GaugeAprService(tokenService, [sepoliaNetworkData.bal!.address]), | ||
], | ||
poolStakingServices: [new GaugeStakingService(gaugeSubgraphService, sepoliaNetworkData.bal!.address)], | ||
tokenPriceHandlers: [ | ||
new CoingeckoPriceHandlerService(coingeckoService), | ||
new BptPriceHandlerService(), | ||
new LinearWrappedTokenPriceHandlerService(), | ||
new SwapsPriceHandlerService(), | ||
], | ||
userStakedBalanceServices: [new UserSyncGaugeBalanceService()], | ||
services: { | ||
balancerSubgraphService: new BalancerSubgraphService( | ||
sepoliaNetworkData.subgraphs.balancer, | ||
sepoliaNetworkData.chain.id, | ||
), | ||
}, | ||
/* | ||
For sub-minute jobs we set the alarmEvaluationPeriod and alarmDatapointsToAlarm to 1 instead of the default 3. | ||
This is needed because the minimum alarm period is 1 minute and we want the alarm to trigger already after 1 minute instead of 3. | ||
For every 1 days jobs we set the alarmEvaluationPeriod and alarmDatapointsToAlarm to 1 instead of the default 3. | ||
This is needed because the maximum alarm evaluation period is 1 day (period * evaluationPeriod). | ||
*/ | ||
workerJobs: [ | ||
{ | ||
name: 'update-token-prices', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(10, 'minutes') : every(2, 'minutes'), | ||
}, | ||
{ | ||
name: 'update-liquidity-for-inactive-pools', | ||
interval: every(1, 'days'), | ||
alarmEvaluationPeriod: 1, | ||
alarmDatapointsToAlarm: 1, | ||
}, | ||
{ | ||
name: 'update-liquidity-for-active-pools', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(6, 'minutes') : every(2, 'minutes'), | ||
}, | ||
{ | ||
name: 'update-pool-apr', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(6, 'minutes') : every(2, 'minutes'), | ||
}, | ||
{ | ||
name: 'load-on-chain-data-for-pools-with-active-updates', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(4, 'minutes') : every(1, 'minutes'), | ||
}, | ||
{ | ||
name: 'sync-new-pools-from-subgraph', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(6, 'minutes') : every(2, 'minutes'), | ||
}, | ||
{ | ||
name: 'sync-tokens-from-pool-tokens', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(10, 'minutes') : every(5, 'minutes'), | ||
}, | ||
{ | ||
name: 'update-liquidity-24h-ago-for-all-pools', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(10, 'minutes') : every(5, 'minutes'), | ||
}, | ||
{ | ||
name: 'cache-average-block-time', | ||
interval: every(1, 'hours'), | ||
}, | ||
{ | ||
name: 'sync-staking-for-pools', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(10, 'minutes') : every(5, 'minutes'), | ||
}, | ||
{ | ||
name: 'sync-latest-snapshots-for-all-pools', | ||
interval: every(90, 'minutes'), | ||
}, | ||
{ | ||
name: 'update-lifetime-values-for-all-pools', | ||
interval: every(50, 'minutes'), | ||
}, | ||
{ | ||
name: 'sync-changed-pools', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(2, 'minutes') : every(30, 'seconds'), | ||
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1, | ||
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1, | ||
}, | ||
{ | ||
name: 'user-sync-wallet-balances-for-all-pools', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(5, 'minutes') : every(20, 'seconds'), | ||
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1, | ||
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1, | ||
}, | ||
{ | ||
name: 'user-sync-staked-balances', | ||
interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(5, 'minutes') : every(20, 'seconds'), | ||
alarmEvaluationPeriod: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1, | ||
alarmDatapointsToAlarm: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? 3 : 1, | ||
}, | ||
{ | ||
name: 'sync-coingecko-coinids', | ||
interval: every(2, 'hours'), | ||
}, | ||
{ | ||
name: 'update-fee-volume-yield-all-pools', | ||
interval: every(1, 'hours'), | ||
}, | ||
// { | ||
// name: 'sync-vebal-balances', | ||
// interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(9, 'minutes') : every(3, 'minutes'), | ||
// }, | ||
// { | ||
// name: 'sync-vebal-totalSupply', | ||
// interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(10, 'minutes') : every(5, 'minutes'), | ||
// }, | ||
// { | ||
// name: 'feed-data-to-datastudio', | ||
// interval: (env.DEPLOYMENT_ENV as DeploymentEnv) === 'canary' ? every(5, 'minutes') : every(5, 'minutes'), | ||
// }, | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ enum Chain { | |
MAINNET | ||
OPTIMISM | ||
POLYGON | ||
SEPOLIA | ||
ZKEVM | ||
} | ||
|
||
|
5 changes: 5 additions & 0 deletions
5
prisma/migrations/20240119135136_add_swapfee_and_sepolia/migration.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-- AlterEnum | ||
ALTER TYPE "Chain" ADD VALUE 'SEPOLIA'; | ||
|
||
-- AlterTable | ||
ALTER TABLE "PrismaPoolDynamicData" ADD COLUMN "protocolSwapFee" TEXT NOT NULL DEFAULT '0'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters