Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V3 canary #66

Merged
merged 29 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a76698c
start v3 integration
franzns Jan 19, 2024
4d58bd4
remove unsued
franzns Jan 19, 2024
221c71c
add vault v3 settings and per pool swap fee
franzns Jan 19, 2024
fb42519
typo
franzns Jan 19, 2024
b554970
unused
franzns Jan 19, 2024
7d6f342
unused
franzns Jan 19, 2024
4ce5355
adding sepolia
franzns Jan 19, 2024
a04a6a2
three chains for dev
franzns Jan 19, 2024
fd137df
sepolia blocks subgraph
franzns Jan 19, 2024
4e4cb03
change start date
franzns Jan 19, 2024
12a3fce
namespace for config
franzns Jan 22, 2024
7e14c27
slight change
franzns Jan 22, 2024
57ed1e0
adding placeholder crons
franzns Jan 22, 2024
df91ccb
add v3 vault address
franzns Jan 23, 2024
0c7dcea
scale stern apr
franzns Jan 23, 2024
b3279ae
Merge pull request #60 from balancer/fix/stern-apr
franzns Jan 23, 2024
b28d106
truMatic APR
gmbronco Jan 23, 2024
44e470e
PoolDynamicData indexes
gmbronco Jan 23, 2024
fe8e185
add v3 abi, combined vault and vault extension
franzns Jan 23, 2024
cac7024
mainnet crons to prod level
franzns Jan 23, 2024
46005bb
Merge pull request #65 from balancer/mainnet-crons
franzns Jan 24, 2024
b832671
Merge pull request #56 from balancer/v3-schema
franzns Jan 24, 2024
e74d513
Merge pull request #62 from balancer/apr
franzns Jan 24, 2024
8820ae0
Merge pull request #63 from balancer/pool-dynamic-data-indexes
franzns Jan 24, 2024
855f203
fix subgraph
franzns Jan 24, 2024
cd697e3
Merge pull request #69 from balancer/sepolia-subgraph
franzns Jan 24, 2024
98ddc25
Dev fix (#74)
franzns Jan 24, 2024
c051fbb
only run OP and sepolia (#75)
franzns Jan 24, 2024
440d548
Fix poolid null (#76)
franzns Jan 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions app/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ export const schema = {
optional: true,
type: String,
},
SUPPORTED_NETWORKS: {
optional: true,
type: String,
},
WORKER_QUEUE_URL: {
optional: true,
type: String,
Expand Down
53 changes: 0 additions & 53 deletions modules/beethoven/beets.gql
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,12 @@ extend type Query {
beetsPoolGetReliquaryFarmSnapshots(id: String!, range: GqlPoolSnapshotDataRange!): [GqlReliquaryFarmSnapshot!]!

userGetFbeetsBalance: GqlUserFbeetsBalance!

userGetPoolSnapshots(poolId: String!, chain: GqlChain!, range: GqlUserSnapshotDataRange!): [GqlUserPoolSnapshot!]!
userGetRelicSnapshots(farmId: String!, range: GqlUserSnapshotDataRange!): [GqlUserRelicSnapshot!]!

userGetPortfolioSnapshots(days: Int!): [GqlUserPortfolioSnapshot!]!
}

extend type Mutation {
beetsSyncFbeetsRatio: String!

beetsPoolLoadReliquarySnapshotsForAllFarms: String!

userLoadAllRelicSnapshots: String!
}

type GqlUserPortfolioSnapshot {
timestamp: Int!
walletBalance: AmountHumanReadable!
gaugeBalance: AmountHumanReadable!
farmBalance: AmountHumanReadable!
totalBalance: AmountHumanReadable!
totalValueUSD: AmountHumanReadable!
fees24h: AmountHumanReadable!
totalFees: AmountHumanReadable!
pools: [GqlUserPoolSnapshot!]!
}

enum GqlUserSnapshotDataRange {
THIRTY_DAYS
NINETY_DAYS
ONE_HUNDRED_EIGHTY_DAYS
ONE_YEAR
ALL_TIME
}

type GqlUserPoolSnapshot {
# id: ID!
timestamp: Int!
# poolId: String!
# poolAddress: String!
# poolName: String!
percentShare: Float!
walletBalance: AmountHumanReadable!
gaugeBalance: AmountHumanReadable!
farmBalance: AmountHumanReadable!
totalBalance: AmountHumanReadable!
totalValueUSD: AmountHumanReadable!
fees24h: AmountHumanReadable!
# totalFees: AmountHumanReadable!
# percentageOfPortfolio: Float!
# priceChange24h: AmountHumanReadable!
# priceChangePercent24h: Float!
}

type GqlUserFbeetsBalance {
Expand Down Expand Up @@ -135,13 +89,6 @@ type GqlPoolStakingFarmRewarder {
rewardPerSecond: String!
}

type GqlUserRelicSnapshot {
timestamp: Int!
totalBalance: String!
relicCount: Int!
relicSnapshots: [GqlRelicSnapshot!]!
}

type GqlRelicSnapshot {
relicId: Int!
farmId: String!
Expand Down
22 changes: 0 additions & 22 deletions modules/beethoven/beets.resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,6 @@ const beetsResolvers: Resolvers = {
...balance,
};
},
userGetPoolSnapshots: async (parent, { poolId, chain, range }, context) => {
const accountAddress = getRequiredAccountAddress(context);

return userService.getUserBalanceSnapshotsForPool(
accountAddress.toLowerCase(),
poolId.toLowerCase(),
chain,
range,
);
},
userGetRelicSnapshots: async (parent, { farmId, range }, context) => {
const accountAddress = getRequiredAccountAddress(context);

return userService.getUserRelicSnapshots(accountAddress.toLowerCase(), farmId, range);
},
},
Mutation: {
beetsSyncFbeetsRatio: async (parent, {}, context) => {
Expand All @@ -65,13 +50,6 @@ const beetsResolvers: Resolvers = {

await poolService.loadReliquarySnapshotsForAllFarms();

return 'success';
},
userLoadAllRelicSnapshots: async (parent, {}, context) => {
isAdminRoute(context);

await userService.loadAllUserRelicSnapshots();

return 'success';
},
},
Expand Down
1 change: 1 addition & 0 deletions modules/common/Base.gql
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ enum GqlChain {
OPTIMISM
POLYGON
ZKEVM
SEPOLIA
}
17 changes: 6 additions & 11 deletions modules/datastudio/datastudio.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class DatastudioService {
networkContext.data.datastudio![env.DEPLOYMENT_ENV as DeploymentEnv].compositionTabName;
const emissionDataTabName =
networkContext.data.datastudio![env.DEPLOYMENT_ENV as DeploymentEnv].emissionDataTabName;
const swapProtocolFeePercentage = networkContext.data.balancer.swapProtocolFeePercentage;
const chainSlug = networkContext.data.chain.slug;

const sheets = google.sheets({ version: 'v4' });
Expand Down Expand Up @@ -136,27 +135,23 @@ export class DatastudioService {
}

if (pool.dynamicData) {
const protocolYieldFeePercentage = pool.dynamicData.protocolYieldFee
? parseFloat(pool.dynamicData.protocolYieldFee)
: networkContext.data.balancer.yieldProtocolFeePercentage;
const protocolYieldFeePercentage = parseFloat(pool.dynamicData.protocolYieldFee || '');
const protocolSwapFeePercentage = parseFloat(pool.dynamicData.protocolSwapFee);
sharesChange = `${
parseFloat(pool.dynamicData.totalShares) - parseFloat(pool.dynamicData.totalShares24hAgo)
}`;
tvlChange = `${pool.dynamicData.totalLiquidity - pool.dynamicData.totalLiquidity24hAgo}`;
lpSwapFee = `${pool.dynamicData.fees24h * (1 - swapProtocolFeePercentage)}`;
protocolSwapFee = `${pool.dynamicData.fees24h * swapProtocolFeePercentage}`;
lpSwapFee = `${pool.dynamicData.fees24h * (1 - protocolSwapFeePercentage)}`;
protocolSwapFee = `${pool.dynamicData.fees24h * protocolSwapFeePercentage}`;

lpYieldCapture =
pool.type === 'META_STABLE'
? `${
pool.dynamicData.yieldCapture24h *
(1 - networkContext.data.balancer.swapProtocolFeePercentage)
}`
? `${pool.dynamicData.yieldCapture24h * (1 - protocolSwapFeePercentage)}`
: `${pool.dynamicData.yieldCapture24h * (1 - protocolYieldFeePercentage)}`;

protocolYieldCapture =
pool.type === 'META_STABLE'
? `${pool.dynamicData.yieldCapture24h * networkContext.data.balancer.swapProtocolFeePercentage}`
? `${pool.dynamicData.yieldCapture24h * protocolSwapFeePercentage}`
: `${pool.dynamicData.yieldCapture24h * protocolYieldFeePercentage}`;

if (pool.dynamicData.isInRecoveryMode || pool.type === 'LIQUIDITY_BOOTSTRAPPING') {
Expand Down
31 changes: 13 additions & 18 deletions modules/network/arbitrum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@ export const arbitrumNetworkData: NetworkData = {
delegationProxy: '0x81cfae226343b24ba12ec6521db2c79e7aeeb310',
},
balancer: {
vault: '0xba12222222228d8ba445958a75a0704d566bf2c8',
swapProtocolFeePercentage: 0.5,
yieldProtocolFeePercentage: 0.5,
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0x80c7dd17b01855a6d2347444a0fcc36136a314de',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down Expand Up @@ -199,10 +206,6 @@ export const arbitrumNetworkData: NetworkData = {
beefy: {
linearPools: [''],
},
lido: {
wstEthAprEndpoint: 'https://eth-api.lido.fi/v1/protocol/steth/apr/sma',
wstEthContract: '0x5979d7b546e38e414f7e9822514be443a4800529',
},
datastudio: {
main: {
user: '[email protected]',
Expand Down Expand Up @@ -234,18 +237,10 @@ export const arbitrumNetworkConfig: NetworkConfig = {
contentService: new GithubContentService(),
provider: new ethers.providers.JsonRpcProvider({ url: arbitrumNetworkData.rpcUrl, timeout: 60000 }),
poolAprServices: [
new YbTokensAprService(
arbitrumNetworkData.ybAprConfig,
arbitrumNetworkData.chain.prismaId,
arbitrumNetworkData.balancer.yieldProtocolFeePercentage,
arbitrumNetworkData.balancer.swapProtocolFeePercentage,
),
new PhantomStableAprService(
arbitrumNetworkData.chain.prismaId,
arbitrumNetworkData.balancer.yieldProtocolFeePercentage,
),
new YbTokensAprService(arbitrumNetworkData.ybAprConfig, arbitrumNetworkData.chain.prismaId),
new PhantomStableAprService(arbitrumNetworkData.chain.prismaId),
new BoostedPoolAprService(),
new SwapFeeAprService(arbitrumNetworkData.balancer.swapProtocolFeePercentage),
new SwapFeeAprService(),
new GaugeAprService(tokenService, [arbitrumNetworkData.bal!.address]),
],
poolStakingServices: [new GaugeStakingService(gaugeSubgraphService, arbitrumNetworkData.bal!.address)],
Expand Down
27 changes: 13 additions & 14 deletions modules/network/avalanche.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ const avalancheNetworkData: NetworkData = {
delegationProxy: '0x0c6052254551eae3ecac77b01dfcf1025418828f',
},
balancer: {
vault: '0xba12222222228d8ba445958a75a0704d566bf2c8',
swapProtocolFeePercentage: 0.5,
yieldProtocolFeePercentage: 0.5,
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0xca11bde05977b3631167028862be2a173976ca11',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down Expand Up @@ -205,18 +212,10 @@ export const avalancheNetworkConfig: NetworkConfig = {
contentService: new GithubContentService(),
provider: new ethers.providers.JsonRpcProvider({ url: avalancheNetworkData.rpcUrl, timeout: 60000 }),
poolAprServices: [
new YbTokensAprService(
avalancheNetworkData.ybAprConfig,
avalancheNetworkData.chain.prismaId,
avalancheNetworkData.balancer.yieldProtocolFeePercentage,
avalancheNetworkData.balancer.swapProtocolFeePercentage,
),
new PhantomStableAprService(
avalancheNetworkData.chain.prismaId,
avalancheNetworkData.balancer.yieldProtocolFeePercentage,
),
new YbTokensAprService(avalancheNetworkData.ybAprConfig, avalancheNetworkData.chain.prismaId),
new PhantomStableAprService(avalancheNetworkData.chain.prismaId),
new BoostedPoolAprService(),
new SwapFeeAprService(avalancheNetworkData.balancer.swapProtocolFeePercentage),
new SwapFeeAprService(),
new GaugeAprService(tokenService, [avalancheNetworkData.bal!.address]),
],
poolStakingServices: [new GaugeStakingService(gaugeSubgraphService, avalancheNetworkData.bal!.address)],
Expand Down
22 changes: 12 additions & 10 deletions modules/network/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,16 @@ const baseNetworkData: NetworkData = {
delegationProxy: '0xd87f44df0159dc78029ab9ca7d7e57e7249f5acd',
},
balancer: {
vault: '0xba12222222228d8ba445958a75a0704d566bf2c8',
swapProtocolFeePercentage: 0.5,
yieldProtocolFeePercentage: 0.5,
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
ybAprConfig: {
defaultHandlers: {
Expand Down Expand Up @@ -129,14 +136,9 @@ export const baseNetworkConfig: NetworkConfig = {
contentService: new GithubContentService(),
provider: new ethers.providers.JsonRpcProvider({ url: baseNetworkData.rpcUrl, timeout: 60000 }),
poolAprServices: [
new YbTokensAprService(
baseNetworkData.ybAprConfig,
baseNetworkData.chain.prismaId,
baseNetworkData.balancer.yieldProtocolFeePercentage,
baseNetworkData.balancer.swapProtocolFeePercentage,
),
new YbTokensAprService(baseNetworkData.ybAprConfig, baseNetworkData.chain.prismaId),
new BoostedPoolAprService(),
new SwapFeeAprService(baseNetworkData.balancer.swapProtocolFeePercentage),
new SwapFeeAprService(),
new GaugeAprService(tokenService, [baseNetworkData.bal!.address]),
],
poolStakingServices: [new GaugeStakingService(gaugeSubgraphService, baseNetworkData.bal!.address)],
Expand Down
27 changes: 13 additions & 14 deletions modules/network/fantom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,16 @@ const fantomNetworkData: NetworkData = {
poolAddress: '0xcde5a11a4acb4ee4c805352cec57e236bdbc3837',
},
balancer: {
vault: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
swapProtocolFeePercentage: 0.25,
yieldProtocolFeePercentage: 0.25,
v2: {
vaultAddress: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0x20dd72ed959b6147912c2e529f0a0c651c33c9ce',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0x66335d7ad8011f6aa3f48aadcb523b62b38ed961',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down Expand Up @@ -289,19 +296,11 @@ export const fantomNetworkConfig: NetworkConfig = {
contentService: new SanityContentService(fantomNetworkData.chain.prismaId),
provider: new ethers.providers.JsonRpcProvider({ url: fantomNetworkData.rpcUrl, timeout: 60000 }),
poolAprServices: [
new YbTokensAprService(
fantomNetworkData.ybAprConfig,
fantomNetworkData.chain.prismaId,
fantomNetworkData.balancer.yieldProtocolFeePercentage,
fantomNetworkData.balancer.swapProtocolFeePercentage,
),
new YbTokensAprService(fantomNetworkData.ybAprConfig, fantomNetworkData.chain.prismaId),
// new SpookySwapAprService(tokenService, fantomNetworkData.spooky!.xBooContract),
new PhantomStableAprService(
fantomNetworkData.chain.prismaId,
fantomNetworkData.balancer.yieldProtocolFeePercentage,
),
new PhantomStableAprService(fantomNetworkData.chain.prismaId),
new BoostedPoolAprService(),
new SwapFeeAprService(fantomNetworkData.balancer.swapProtocolFeePercentage),
new SwapFeeAprService(),
new MasterchefFarmAprService(fantomNetworkData.beets!.address),
new ReliquaryFarmAprService(fantomNetworkData.beets!.address),
new BeetswarsGaugeVotingAprService(),
Expand Down
27 changes: 13 additions & 14 deletions modules/network/gnosis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,16 @@ const gnosisNetworkData: NetworkData = {
delegationProxy: '0x7a2535f5fb47b8e44c02ef5d9990588313fe8f05',
},
balancer: {
vault: '0xba12222222228d8ba445958a75a0704d566bf2c8',
swapProtocolFeePercentage: 0.5,
yieldProtocolFeePercentage: 0.5,
v2: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
v3: {
vaultAddress: '0xba12222222228d8ba445958a75a0704d566bf2c8',
defaultSwapFeePercentage: '0.5',
defaultYieldFeePercentage: '0.5',
},
},
multicall: '0xbb6fab6b627947dae0a75808250d8b2652952cb5',
multicall3: '0xca11bde05977b3631167028862be2a173976ca11',
Expand Down Expand Up @@ -133,18 +140,10 @@ export const gnosisNetworkConfig: NetworkConfig = {
contentService: new GithubContentService(),
provider: new ethers.providers.JsonRpcProvider({ url: gnosisNetworkData.rpcUrl, timeout: 60000 }),
poolAprServices: [
new YbTokensAprService(
gnosisNetworkData.ybAprConfig,
gnosisNetworkData.chain.prismaId,
gnosisNetworkData.balancer.yieldProtocolFeePercentage,
gnosisNetworkData.balancer.swapProtocolFeePercentage,
),
new PhantomStableAprService(
gnosisNetworkData.chain.prismaId,
gnosisNetworkData.balancer.yieldProtocolFeePercentage,
),
new YbTokensAprService(gnosisNetworkData.ybAprConfig, gnosisNetworkData.chain.prismaId),
new PhantomStableAprService(gnosisNetworkData.chain.prismaId),
new BoostedPoolAprService(),
new SwapFeeAprService(gnosisNetworkData.balancer.swapProtocolFeePercentage),
new SwapFeeAprService(),
new GaugeAprService(tokenService, [gnosisNetworkData.bal!.address]),
],
poolStakingServices: [new GaugeStakingService(gaugeSubgraphService, gnosisNetworkData.bal!.address)],
Expand Down
Loading
Loading