diff --git a/.changeset/gold-worms-shop.md b/.changeset/gold-worms-shop.md new file mode 100644 index 000000000..49e0ce16d --- /dev/null +++ b/.changeset/gold-worms-shop.md @@ -0,0 +1,5 @@ +--- +'backend': patch +--- + +v3 subgraphs to ormi diff --git a/codegen.ts b/codegen.ts index 934023d69..bdd8ffc38 100644 --- a/codegen.ts +++ b/codegen.ts @@ -41,7 +41,7 @@ const files = { ...defaults.types, }, ['modules/subgraphs/reliquary-subgraph/generated/reliquary-subgraph-types.ts']: { - schema: config.FANTOM.subgraphs.reliquary, + schema: config.SONIC.subgraphs.reliquary, documents: 'modules/subgraphs/reliquary-subgraph/reliquary-subgraph-queries.graphql', ...defaults.types, config: { diff --git a/config/arbitrum.ts b/config/arbitrum.ts index cfbf477ec..179ac5dab 100644 --- a/config/arbitrum.ts +++ b/config/arbitrum.ts @@ -14,8 +14,8 @@ export default { subgraphs: { startDate: '2021-08-23', balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-arbitrum-smol/latest/gn`, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmWYjRi4vSRZnf6wEAzYPvCYyS6rh4JnEbuYEDKHwKEuJw`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/Qmf4TBCMerVSxnAB6ByM2b73eAAEGyCzGM61yxu74UjLsG`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-arbitrum-one-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-arbitrum-one-smol/latest/gn`, cowAmm: `https://gateway-arbitrum.network.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmUDGSJXdMzG4ezDzf1LvXVb2igwY6rnaNFLC62ZJZ3Pbv`, gauge: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/balancer-gauges-arbitrum/latest/gn`, aura: 'https://data.aura.finance/graphql', diff --git a/config/avalanche.ts b/config/avalanche.ts index d695e317a..fa6f821b7 100644 --- a/config/avalanche.ts +++ b/config/avalanche.ts @@ -14,8 +14,8 @@ export default { subgraphs: { startDate: '2023-06-06', balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-avalanche-smol/latest/gn`, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmSj437ejL2f1pMP2r5E2m5GjhqJa3rmbvFD5kyscmq7u2`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmPxfzF4eo5vcy887jjug4pP1dSdQ17eq6cWBvKisVEngz`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-avalanche-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-avalanche-smol/latest/gn`, gauge: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/balancer-gauges-avalanche/latest/gn`, aura: 'https://data.aura.finance/graphql', }, diff --git a/config/base.ts b/config/base.ts index b2826fec7..06556962f 100644 --- a/config/base.ts +++ b/config/base.ts @@ -15,7 +15,7 @@ export default { startDate: '2023-07-10', balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-base-smol/latest/gn`, balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmXs2bcH91cbcC8Sz7qW8SFWpDRWbDvZzsz6RmAX5wgxj3`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmcjhEzoEeNFs4QCEyfPgNXASAR8YdckuS2jNieMBwzv2w`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-base-smol/latest/gn`, cowAmm: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmVRCjhFz7XXJoeJ5t4FdysN2JaBVdUCvpTVoMzXRNjA87`, gauge: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/balancer-gauges-base/latest/gn`, aura: 'https://data.aura.finance/graphql', diff --git a/config/gnosis.ts b/config/gnosis.ts index e957ce2a8..9f02e612a 100644 --- a/config/gnosis.ts +++ b/config/gnosis.ts @@ -14,8 +14,8 @@ export default { subgraphs: { startDate: '2021-08-23', balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-gnosis-smol/latest/gn`, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmcQUxfK2rEVSbRBBEd4PimcuVBA8LJttF1pgvTYS5k9bh`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmWmFp3wRq7vYmTCPFbvWFRw8hADmHr1zfo4K1cGCW81B7`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-gnosis-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-gnosis-smol/latest/gn`, gauge: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/balancer-gauges-gnosis/latest/gn`, aura: 'https://data.aura.finance/graphql', cowAmm: `https://gateway-arbitrum.network.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/Qmb9jmxb2EVWHk7NryKCAbsq2WAZaCV4CmnZne59EbADeh`, diff --git a/config/hyperevm.ts b/config/hyperevm.ts index cd35b7f3c..2209cc574 100644 --- a/config/hyperevm.ts +++ b/config/hyperevm.ts @@ -13,8 +13,8 @@ export default { subgraphs: { startDate: '2025-06-18', balancer: ``, - balancerV3: `https://api.goldsky.com/api/public/project_cmcigparivg3z01yhbv14ddl8/subgraphs/balancer-v3-hyperevm/latest/gn`, - balancerPoolsV3: `https://api.goldsky.com/api/public/project_cmcigparivg3z01yhbv14ddl8/subgraphs/balancer-pools-v3-hyperevm/latest/gn`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-hyperevm-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-hyperevm-smol/latest/gn`, gauge: ``, }, hooks: { diff --git a/config/mainnet.ts b/config/mainnet.ts index bacdb4e20..110f5eb90 100644 --- a/config/mainnet.ts +++ b/config/mainnet.ts @@ -16,8 +16,8 @@ export default { startDate: '2019-04-20', cowAmm: `https://gateway-arbitrum.network.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmQ3c9CTJBZdgy3uTLB929ARZucMUCf6piZBDxSgBKnf6m`, balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-mainnet-smol/latest/gn`, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmUUDd95Pj2ijZn9NwmxuAd4ApVGtsZCEYLHE6U19dWoSm`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmWGugpAkdbw5CZLdCxmDzZCDNRik2bj4N9RYvuYiX7Mxs`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-mainnet-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-mainnet-smol/latest/gn`, gauge: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/balancer-gauges-mainnet/latest/gn`, aura: 'https://data.aura.finance/graphql', }, diff --git a/config/monad.ts b/config/monad.ts index af89ad6d0..16c0f402b 100644 --- a/config/monad.ts +++ b/config/monad.ts @@ -13,8 +13,8 @@ export default { subgraphs: { startDate: '2025-09-12', balancer: ``, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmUjY6FNcecCopHx5sWWMqWCq6yKEXsB2DAPryyBuAYKnT`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmcJsNHBKWWBfF4ma8rMKjwBa1bwdsJdjvLEaKFzEdqP2q`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-monad-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-monad-smol/latest/gn`, gauge: ``, }, hooks: { diff --git a/config/optimism.ts b/config/optimism.ts index 420849f07..05e908b3b 100644 --- a/config/optimism.ts +++ b/config/optimism.ts @@ -14,8 +14,8 @@ export default { subgraphs: { startDate: '2022-01-01', balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-optimism-smol/latest/gn`, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmecD1yHQqmY11rx997C2e4TMP1EGCaX4shZ8AT959bo6Z`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmYcor9K3P83W5q3KxE6SHwbDD7v16hqD9BZdzcF4KUkBu`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-optimism-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-optimism-smol/latest/gn`, gauge: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/balancer-gauges-optimism/latest/gn`, aura: 'https://data.aura.finance/graphql', }, diff --git a/config/plasma.ts b/config/plasma.ts index f5a23e1e8..d1934d580 100644 --- a/config/plasma.ts +++ b/config/plasma.ts @@ -14,8 +14,8 @@ export default { subgraphs: { startDate: '2025-09-12', balancer: ``, - balancerV3: `https://api.goldsky.com/api/public/project_cmcigparivg3z01yhbv14ddl8/subgraphs/balancer-v3-plasma/latest/gn`, - balancerPoolsV3: `https://api.goldsky.com/api/public/project_cmcigparivg3z01yhbv14ddl8/subgraphs/balancer-pools-v3-plasma/latest/gn`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-plasma-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-plasma-smol/latest/gn`, gauge: ``, }, hooks: { diff --git a/config/sepolia.ts b/config/sepolia.ts index 86f175d3f..252314307 100644 --- a/config/sepolia.ts +++ b/config/sepolia.ts @@ -14,8 +14,8 @@ export default { startDate: '2023-05-03', cowAmm: `https://gateway-arbitrum.network.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmeqeR1YL7xfB2Z7DaykE5Xh1YGGS1AGuoF4qUxSa58K2D`, balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-sepolia-smol/latest/gn`, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmQDGZWbqMkjfQeBSCZKcNzGQagoje6BbTdEMESosoTGqq`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmUgs7oFMYjrN2pEb7LEBugZBpHwkfPEZMLkK2TFr1GbbY`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-sepolia-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-sepolia-smol/latest/gn`, gauge: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/Qme7qpLpcR6VhzfJrCVsRxxRrLj9TqH6Skrg6EUWnRmTzU`, }, eth: { diff --git a/config/sonic.ts b/config/sonic.ts index 11df52b58..1b6cfc653 100644 --- a/config/sonic.ts +++ b/config/sonic.ts @@ -14,8 +14,8 @@ export default { subgraphs: { startDate: '2024-12-12', balancer: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v2-sonic-smol/latest/gn`, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmUgRWkb5JUocGkVidpKtZFMHjexJzkBiSbjufURsXwn9X`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmXhuf3ZJn515R1rtvnV9ufwsSZ5j3e2bQnr68GefsJk3K`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-sonic-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-sonic-smol/latest/gn`, gauge: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/balancer-gauges-sonic/latest/gn`, reliquary: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/mabeets-sonic/latest/gn`, sts: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/staked-sonic/latest/gn`, diff --git a/config/xlayer.ts b/config/xlayer.ts index 551441531..d9a6de5b2 100644 --- a/config/xlayer.ts +++ b/config/xlayer.ts @@ -14,8 +14,8 @@ export default { subgraphs: { startDate: '2025-10-30', balancer: ``, - balancerV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmX8LawQrPRVywFnjwZG57MomECJRZDw4nNBvwdEHJ3dS3`, - balancerPoolsV3: `https://gateway.thegraph.com/api/${env.THEGRAPH_API_KEY_BALANCER}/deployments/id/QmUDXYphhmEJJSZij5ZwjgLXfz2bnS4Mwr8ZDhfrvbsBYf`, + balancerV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-vault-xlayer-smol/latest/gn`, + balancerPoolsV3: `https://api.subgraph.ormilabs.com/api/public/717cf785-de57-4761-94dd-9ac51b019902/subgraphs/v3-pools-xlayer-smol/latest/gn`, gauge: ``, }, hooks: { diff --git a/modules/actions/cow-amm/sync-join-exits.ts b/modules/actions/cow-amm/sync-join-exits.ts index 9439e23a6..7e1d30879 100644 --- a/modules/actions/cow-amm/sync-join-exits.ts +++ b/modules/actions/cow-amm/sync-join-exits.ts @@ -3,8 +3,8 @@ import { prisma } from '../../../prisma/prisma-client'; import { CowAmmSubgraphClient } from '../../sources/subgraphs'; import { AddRemove_OrderBy, OrderDirection } from '../../sources/subgraphs/cow-amm/generated/types'; import { joinExitsUsd } from '../../sources/enrichers/join-exits-usd'; -import { joinExitV3Transformer } from '../../sources/transformers/join-exit-v3-transformer'; import { eventsRepository, EventStoreRepository } from '../../repositories/events'; +import { joinExitCowTransformer } from '../../sources/transformers/join-exit-cow-transformer'; /** * Get the join and exit events from the subgraph and store them in the database @@ -35,7 +35,7 @@ export const syncJoinExits = async ( }); // Prepare DB entries - const dbEntries = await joinExitV3Transformer(addRemoves, chain, 1); + const dbEntries = await joinExitCowTransformer(addRemoves, chain, 1); console.log(`Syncing Cow AMM ${dbEntries.length} join/exit events`); diff --git a/modules/sources/subgraphs/balancer-v3-pools/generated/types.ts b/modules/sources/subgraphs/balancer-v3-pools/generated/types.ts index dc678f451..04ab8b367 100644 --- a/modules/sources/subgraphs/balancer-v3-pools/generated/types.ts +++ b/modules/sources/subgraphs/balancer-v3-pools/generated/types.ts @@ -1804,6 +1804,7 @@ export type _Meta_ = { * will be null if the _meta field has a block constraint that asks for * a block number. It will be filled if the _meta field has no block constraint * and therefore asks for the latest block + * */ block: _Block_; /** The deployment ID */ diff --git a/modules/sources/subgraphs/balancer-v3-vault/add-remove.graphql b/modules/sources/subgraphs/balancer-v3-vault/add-remove.graphql index 7136a783a..567617374 100644 --- a/modules/sources/subgraphs/balancer-v3-vault/add-remove.graphql +++ b/modules/sources/subgraphs/balancer-v3-vault/add-remove.graphql @@ -10,9 +10,7 @@ fragment AddRemove on AddRemove { address } } - user { - id - } + user blockNumber logIndex blockTimestamp diff --git a/modules/sources/subgraphs/balancer-v3-vault/generated/types.ts b/modules/sources/subgraphs/balancer-v3-vault/generated/types.ts index 43f621975..9c4652373 100644 --- a/modules/sources/subgraphs/balancer-v3-vault/generated/types.ts +++ b/modules/sources/subgraphs/balancer-v3-vault/generated/types.ts @@ -41,7 +41,7 @@ export type AddRemove = { /** Type of investment (Add or Remove) */ type: InvestType; /** User who performed the add or remove action */ - user: User; + user: Scalars['Bytes']; }; export type AddRemove_Filter = { @@ -134,27 +134,16 @@ export type AddRemove_Filter = { type_in?: InputMaybe>; type_not?: InputMaybe; type_not_in?: InputMaybe>; - user?: InputMaybe; - user_?: InputMaybe; - user_contains?: InputMaybe; - user_contains_nocase?: InputMaybe; - user_ends_with?: InputMaybe; - user_ends_with_nocase?: InputMaybe; - user_gt?: InputMaybe; - user_gte?: InputMaybe; - user_in?: InputMaybe>; - user_lt?: InputMaybe; - user_lte?: InputMaybe; - user_not?: InputMaybe; - user_not_contains?: InputMaybe; - user_not_contains_nocase?: InputMaybe; - user_not_ends_with?: InputMaybe; - user_not_ends_with_nocase?: InputMaybe; - user_not_in?: InputMaybe>; - user_not_starts_with?: InputMaybe; - user_not_starts_with_nocase?: InputMaybe; - user_starts_with?: InputMaybe; - user_starts_with_nocase?: InputMaybe; + user?: InputMaybe; + user_contains?: InputMaybe; + user_gt?: InputMaybe; + user_gte?: InputMaybe; + user_in?: InputMaybe>; + user_lt?: InputMaybe; + user_lte?: InputMaybe; + user_not?: InputMaybe; + user_not_contains?: InputMaybe; + user_not_in?: InputMaybe>; }; export enum AddRemove_OrderBy { @@ -191,7 +180,6 @@ export enum AddRemove_OrderBy { TransactionHash = 'transactionHash', Type = 'type', User = 'user', - UserId = 'user__id', } export enum Aggregation_Interval { @@ -234,7 +222,7 @@ export type BufferShare = { /** Unique identifier for the BufferShare */ id: Scalars['Bytes']; /** The user who owns this share */ - user: User; + user: Scalars['Bytes']; }; export type BufferShare_Filter = { @@ -281,27 +269,16 @@ export type BufferShare_Filter = { id_not_contains?: InputMaybe; id_not_in?: InputMaybe>; or?: InputMaybe>>; - user?: InputMaybe; - user_?: InputMaybe; - user_contains?: InputMaybe; - user_contains_nocase?: InputMaybe; - user_ends_with?: InputMaybe; - user_ends_with_nocase?: InputMaybe; - user_gt?: InputMaybe; - user_gte?: InputMaybe; - user_in?: InputMaybe>; - user_lt?: InputMaybe; - user_lte?: InputMaybe; - user_not?: InputMaybe; - user_not_contains?: InputMaybe; - user_not_contains_nocase?: InputMaybe; - user_not_ends_with?: InputMaybe; - user_not_ends_with_nocase?: InputMaybe; - user_not_in?: InputMaybe>; - user_not_starts_with?: InputMaybe; - user_not_starts_with_nocase?: InputMaybe; - user_starts_with?: InputMaybe; - user_starts_with_nocase?: InputMaybe; + user?: InputMaybe; + user_contains?: InputMaybe; + user_gt?: InputMaybe; + user_gte?: InputMaybe; + user_in?: InputMaybe>; + user_lt?: InputMaybe; + user_lte?: InputMaybe; + user_not?: InputMaybe; + user_not_contains?: InputMaybe; + user_not_in?: InputMaybe>; }; export enum BufferShare_OrderBy { @@ -313,7 +290,6 @@ export enum BufferShare_OrderBy { BufferWrappedBalance = 'buffer__wrappedBalance', Id = 'id', User = 'user', - UserId = 'user__id', } export type Buffer_Filter = { @@ -797,8 +773,6 @@ export type Pool = { protocolYieldFee: Scalars['BigDecimal']; /** Rate providers associated with this Pool */ rateProviders: Array; - /** Snapshots of this Pool's state over time */ - snapshots: Array; /** Swap fee percentage for this Pool */ swapFee: Scalars['BigDecimal']; /** Account empowered to set static swap fees for a pool */ @@ -825,14 +799,6 @@ export type PoolRateProvidersArgs = { where?: InputMaybe; }; -export type PoolSnapshotsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - export type PoolTokensArgs = { first?: InputMaybe; orderBy?: InputMaybe; @@ -850,7 +816,7 @@ export type PoolShare = { /** The Pool this share is for */ pool: Pool; /** The user who owns this share */ - user: User; + user: Scalars['Bytes']; }; export type PoolShare_Filter = { @@ -895,27 +861,16 @@ export type PoolShare_Filter = { pool_not_starts_with_nocase?: InputMaybe; pool_starts_with?: InputMaybe; pool_starts_with_nocase?: InputMaybe; - user?: InputMaybe; - user_?: InputMaybe; - user_contains?: InputMaybe; - user_contains_nocase?: InputMaybe; - user_ends_with?: InputMaybe; - user_ends_with_nocase?: InputMaybe; - user_gt?: InputMaybe; - user_gte?: InputMaybe; - user_in?: InputMaybe>; - user_lt?: InputMaybe; - user_lte?: InputMaybe; - user_not?: InputMaybe; - user_not_contains?: InputMaybe; - user_not_contains_nocase?: InputMaybe; - user_not_ends_with?: InputMaybe; - user_not_ends_with_nocase?: InputMaybe; - user_not_in?: InputMaybe>; - user_not_starts_with?: InputMaybe; - user_not_starts_with_nocase?: InputMaybe; - user_starts_with?: InputMaybe; - user_starts_with_nocase?: InputMaybe; + user?: InputMaybe; + user_contains?: InputMaybe; + user_gt?: InputMaybe; + user_gte?: InputMaybe; + user_in?: InputMaybe>; + user_lt?: InputMaybe; + user_lte?: InputMaybe; + user_not?: InputMaybe; + user_not_contains?: InputMaybe; + user_not_in?: InputMaybe>; }; export enum PoolShare_OrderBy { @@ -946,186 +901,6 @@ export enum PoolShare_OrderBy { PoolTotalShares = 'pool__totalShares', PoolTransactionHash = 'pool__transactionHash', User = 'user', - UserId = 'user__id', -} - -export type PoolSnapshot = { - __typename?: 'PoolSnapshot'; - /** Balances of each token in the Pool at the time of the snapshot */ - balances: Array; - /** Number of unique holders of the Pool's tokens at the time of the snapshot */ - holdersCount: Scalars['BigInt']; - /** Unique identifier for the PoolSnapshot */ - id: Scalars['ID']; - /** The Pool this snapshot is for */ - pool: Pool; - /** Number of swaps performed in the Pool at the time of the snapshot */ - swapsCount: Scalars['BigInt']; - /** Timestamp when this snapshot was taken */ - timestamp: Scalars['Int']; - /** Total dynamic swap fees collected for each token at the time of the snapshot */ - totalDynamicSwapFees: Array; - /** Total protocol swap fees collected for each token at the time of the snapshot */ - totalProtocolSwapFees: Array; - /** Total protocol yield fees collected for each token at the time of the snapshot */ - totalProtocolYieldFees: Array; - /** Total shares of the Pool at the time of the snapshot */ - totalShares: Scalars['BigDecimal']; - /** Total static swap fees collected for each token at the time of the snapshot */ - totalStaticSwapFees: Array; - /** Total swap fees collected for each token at the time of the snapshot */ - totalSwapFees: Array; - /** Total swap volumes for each token at the time of the snapshot */ - totalSwapVolumes: Array; -}; - -export type PoolSnapshot_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - and?: InputMaybe>>; - balances?: InputMaybe>; - balances_contains?: InputMaybe>; - balances_contains_nocase?: InputMaybe>; - balances_not?: InputMaybe>; - balances_not_contains?: InputMaybe>; - balances_not_contains_nocase?: InputMaybe>; - holdersCount?: InputMaybe; - holdersCount_gt?: InputMaybe; - holdersCount_gte?: InputMaybe; - holdersCount_in?: InputMaybe>; - holdersCount_lt?: InputMaybe; - holdersCount_lte?: InputMaybe; - holdersCount_not?: InputMaybe; - holdersCount_not_in?: InputMaybe>; - id?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_in?: InputMaybe>; - or?: InputMaybe>>; - pool?: InputMaybe; - pool_?: InputMaybe; - pool_contains?: InputMaybe; - pool_contains_nocase?: InputMaybe; - pool_ends_with?: InputMaybe; - pool_ends_with_nocase?: InputMaybe; - pool_gt?: InputMaybe; - pool_gte?: InputMaybe; - pool_in?: InputMaybe>; - pool_lt?: InputMaybe; - pool_lte?: InputMaybe; - pool_not?: InputMaybe; - pool_not_contains?: InputMaybe; - pool_not_contains_nocase?: InputMaybe; - pool_not_ends_with?: InputMaybe; - pool_not_ends_with_nocase?: InputMaybe; - pool_not_in?: InputMaybe>; - pool_not_starts_with?: InputMaybe; - pool_not_starts_with_nocase?: InputMaybe; - pool_starts_with?: InputMaybe; - pool_starts_with_nocase?: InputMaybe; - swapsCount?: InputMaybe; - swapsCount_gt?: InputMaybe; - swapsCount_gte?: InputMaybe; - swapsCount_in?: InputMaybe>; - swapsCount_lt?: InputMaybe; - swapsCount_lte?: InputMaybe; - swapsCount_not?: InputMaybe; - swapsCount_not_in?: InputMaybe>; - timestamp?: InputMaybe; - timestamp_gt?: InputMaybe; - timestamp_gte?: InputMaybe; - timestamp_in?: InputMaybe>; - timestamp_lt?: InputMaybe; - timestamp_lte?: InputMaybe; - timestamp_not?: InputMaybe; - timestamp_not_in?: InputMaybe>; - totalDynamicSwapFees?: InputMaybe>; - totalDynamicSwapFees_contains?: InputMaybe>; - totalDynamicSwapFees_contains_nocase?: InputMaybe>; - totalDynamicSwapFees_not?: InputMaybe>; - totalDynamicSwapFees_not_contains?: InputMaybe>; - totalDynamicSwapFees_not_contains_nocase?: InputMaybe>; - totalProtocolSwapFees?: InputMaybe>; - totalProtocolSwapFees_contains?: InputMaybe>; - totalProtocolSwapFees_contains_nocase?: InputMaybe>; - totalProtocolSwapFees_not?: InputMaybe>; - totalProtocolSwapFees_not_contains?: InputMaybe>; - totalProtocolSwapFees_not_contains_nocase?: InputMaybe>; - totalProtocolYieldFees?: InputMaybe>; - totalProtocolYieldFees_contains?: InputMaybe>; - totalProtocolYieldFees_contains_nocase?: InputMaybe>; - totalProtocolYieldFees_not?: InputMaybe>; - totalProtocolYieldFees_not_contains?: InputMaybe>; - totalProtocolYieldFees_not_contains_nocase?: InputMaybe>; - totalShares?: InputMaybe; - totalShares_gt?: InputMaybe; - totalShares_gte?: InputMaybe; - totalShares_in?: InputMaybe>; - totalShares_lt?: InputMaybe; - totalShares_lte?: InputMaybe; - totalShares_not?: InputMaybe; - totalShares_not_in?: InputMaybe>; - totalStaticSwapFees?: InputMaybe>; - totalStaticSwapFees_contains?: InputMaybe>; - totalStaticSwapFees_contains_nocase?: InputMaybe>; - totalStaticSwapFees_not?: InputMaybe>; - totalStaticSwapFees_not_contains?: InputMaybe>; - totalStaticSwapFees_not_contains_nocase?: InputMaybe>; - totalSwapFees?: InputMaybe>; - totalSwapFees_contains?: InputMaybe>; - totalSwapFees_contains_nocase?: InputMaybe>; - totalSwapFees_not?: InputMaybe>; - totalSwapFees_not_contains?: InputMaybe>; - totalSwapFees_not_contains_nocase?: InputMaybe>; - totalSwapVolumes?: InputMaybe>; - totalSwapVolumes_contains?: InputMaybe>; - totalSwapVolumes_contains_nocase?: InputMaybe>; - totalSwapVolumes_not?: InputMaybe>; - totalSwapVolumes_not_contains?: InputMaybe>; - totalSwapVolumes_not_contains_nocase?: InputMaybe>; -}; - -export enum PoolSnapshot_OrderBy { - Balances = 'balances', - HoldersCount = 'holdersCount', - Id = 'id', - Pool = 'pool', - PoolAddress = 'pool__address', - PoolBlockNumber = 'pool__blockNumber', - PoolBlockTimestamp = 'pool__blockTimestamp', - PoolFactory = 'pool__factory', - PoolHoldersCount = 'pool__holdersCount', - PoolId = 'pool__id', - PoolIsInRecoveryMode = 'pool__isInRecoveryMode', - PoolIsInitialized = 'pool__isInitialized', - PoolIsPaused = 'pool__isPaused', - PoolName = 'pool__name', - PoolPauseManager = 'pool__pauseManager', - PoolPauseWindowEndTime = 'pool__pauseWindowEndTime', - PoolPoolCreator = 'pool__poolCreator', - PoolPoolCreatorSwapFee = 'pool__poolCreatorSwapFee', - PoolPoolCreatorYieldFee = 'pool__poolCreatorYieldFee', - PoolProtocolSwapFee = 'pool__protocolSwapFee', - PoolProtocolYieldFee = 'pool__protocolYieldFee', - PoolSwapFee = 'pool__swapFee', - PoolSwapFeeManager = 'pool__swapFeeManager', - PoolSwapsCount = 'pool__swapsCount', - PoolSymbol = 'pool__symbol', - PoolTotalShares = 'pool__totalShares', - PoolTransactionHash = 'pool__transactionHash', - SwapsCount = 'swapsCount', - Timestamp = 'timestamp', - TotalDynamicSwapFees = 'totalDynamicSwapFees', - TotalProtocolSwapFees = 'totalProtocolSwapFees', - TotalProtocolYieldFees = 'totalProtocolYieldFees', - TotalShares = 'totalShares', - TotalStaticSwapFees = 'totalStaticSwapFees', - TotalSwapFees = 'totalSwapFees', - TotalSwapVolumes = 'totalSwapVolumes', } export type PoolToken = { @@ -1734,7 +1509,6 @@ export type Pool_Filter = { protocolYieldFee_not?: InputMaybe; protocolYieldFee_not_in?: InputMaybe>; rateProviders_?: InputMaybe; - snapshots_?: InputMaybe; swapFee?: InputMaybe; swapFeeManager?: InputMaybe; swapFeeManager_contains?: InputMaybe; @@ -1863,7 +1637,6 @@ export enum Pool_OrderBy { ProtocolSwapFee = 'protocolSwapFee', ProtocolYieldFee = 'protocolYieldFee', RateProviders = 'rateProviders', - Snapshots = 'snapshots', SwapFee = 'swapFee', SwapFeeManager = 'swapFeeManager', SwapsCount = 'swapsCount', @@ -1899,8 +1672,6 @@ export type Query = { pool?: Maybe; poolShare?: Maybe; poolShares: Array; - poolSnapshot?: Maybe; - poolSnapshots: Array; poolToken?: Maybe; poolTokens: Array; pools: Array; @@ -1910,8 +1681,6 @@ export type Query = { swaps: Array; token?: Maybe; tokens: Array; - user?: Maybe; - users: Array; vault?: Maybe; vaults: Array; }; @@ -2038,22 +1807,6 @@ export type QueryPoolSharesArgs = { where?: InputMaybe; }; -export type QueryPoolSnapshotArgs = { - block?: InputMaybe; - id: Scalars['ID']; - subgraphError?: _SubgraphErrorPolicy_; -}; - -export type QueryPoolSnapshotsArgs = { - block?: InputMaybe; - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; -}; - export type QueryPoolTokenArgs = { block?: InputMaybe; id: Scalars['ID']; @@ -2128,22 +1881,6 @@ export type QueryTokensArgs = { where?: InputMaybe; }; -export type QueryUserArgs = { - block?: InputMaybe; - id: Scalars['ID']; - subgraphError?: _SubgraphErrorPolicy_; -}; - -export type QueryUsersArgs = { - block?: InputMaybe; - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - subgraphError?: _SubgraphErrorPolicy_; - where?: InputMaybe; -}; - export type QueryVaultArgs = { block?: InputMaybe; id: Scalars['ID']; @@ -2331,7 +2068,7 @@ export type Swap = { /** Hash of the transaction containing the swap */ transactionHash: Scalars['Bytes']; /** User who performed the swap */ - user: User; + user: Scalars['Bytes']; }; export type Swap_Filter = { @@ -2515,27 +2252,16 @@ export type Swap_Filter = { transactionHash_not?: InputMaybe; transactionHash_not_contains?: InputMaybe; transactionHash_not_in?: InputMaybe>; - user?: InputMaybe; - user_?: InputMaybe; - user_contains?: InputMaybe; - user_contains_nocase?: InputMaybe; - user_ends_with?: InputMaybe; - user_ends_with_nocase?: InputMaybe; - user_gt?: InputMaybe; - user_gte?: InputMaybe; - user_in?: InputMaybe>; - user_lt?: InputMaybe; - user_lte?: InputMaybe; - user_not?: InputMaybe; - user_not_contains?: InputMaybe; - user_not_contains_nocase?: InputMaybe; - user_not_ends_with?: InputMaybe; - user_not_ends_with_nocase?: InputMaybe; - user_not_in?: InputMaybe>; - user_not_starts_with?: InputMaybe; - user_not_starts_with_nocase?: InputMaybe; - user_starts_with?: InputMaybe; - user_starts_with_nocase?: InputMaybe; + user?: InputMaybe; + user_contains?: InputMaybe; + user_gt?: InputMaybe; + user_gte?: InputMaybe; + user_in?: InputMaybe>; + user_lt?: InputMaybe; + user_lte?: InputMaybe; + user_not?: InputMaybe; + user_not_contains?: InputMaybe; + user_not_in?: InputMaybe>; }; export enum Swap_OrderBy { @@ -2558,7 +2284,6 @@ export enum Swap_OrderBy { TokenOutSymbol = 'tokenOutSymbol', TransactionHash = 'transactionHash', User = 'user', - UserId = 'user__id', } export type Token = { @@ -2658,69 +2383,6 @@ export enum Token_OrderBy { Symbol = 'symbol', } -export type User = { - __typename?: 'User'; - /** Add/Remove liquidity events performed by this user */ - addRemoves?: Maybe>; - /** Unique identifier for the User (typically their address) */ - id: Scalars['Bytes']; - /** Pool shares owned by this user */ - shares?: Maybe>; - /** Swaps performed by this user */ - swaps?: Maybe>; -}; - -export type UserAddRemovesArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - -export type UserSharesArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - -export type UserSwapsArgs = { - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - skip?: InputMaybe; - where?: InputMaybe; -}; - -export type User_Filter = { - /** Filter for the block changed event. */ - _change_block?: InputMaybe; - addRemoves_?: InputMaybe; - and?: InputMaybe>>; - id?: InputMaybe; - id_contains?: InputMaybe; - id_gt?: InputMaybe; - id_gte?: InputMaybe; - id_in?: InputMaybe>; - id_lt?: InputMaybe; - id_lte?: InputMaybe; - id_not?: InputMaybe; - id_not_contains?: InputMaybe; - id_not_in?: InputMaybe>; - or?: InputMaybe>>; - shares_?: InputMaybe; - swaps_?: InputMaybe; -}; - -export enum User_OrderBy { - AddRemoves = 'addRemoves', - Id = 'id', - Shares = 'shares', - Swaps = 'swaps', -} - export type Vault = { __typename?: 'Vault'; /** Address of the authorizer */ @@ -2835,6 +2497,7 @@ export type _Meta_ = { * will be null if the _meta field has a block constraint that asks for * a block number. It will be filled if the _meta field has no block constraint * and therefore asks for the latest block + * */ block: _Block_; /** The deployment ID */ @@ -2856,6 +2519,7 @@ export type AddRemoveFragment = { type: InvestType; sender: string; amounts: Array; + user: string; blockNumber: string; logIndex: string; blockTimestamp: string; @@ -2865,7 +2529,6 @@ export type AddRemoveFragment = { id: string; tokens: Array<{ __typename?: 'PoolToken'; index: number; address: string }>; }; - user: { __typename?: 'User'; id: string }; }; export type AddRemoveQueryVariables = Exact<{ @@ -2885,6 +2548,7 @@ export type AddRemoveQuery = { type: InvestType; sender: string; amounts: Array; + user: string; blockNumber: string; logIndex: string; blockTimestamp: string; @@ -2894,7 +2558,6 @@ export type AddRemoveQuery = { id: string; tokens: Array<{ __typename?: 'PoolToken'; index: number; address: string }>; }; - user: { __typename?: 'User'; id: string }; }>; }; @@ -3132,11 +2795,11 @@ export type SwapFragment = { swapFeeAmount: string; swapFeeToken: string; swapFeeDeltaAmount: string; + user: string; blockNumber: string; logIndex: string; blockTimestamp: string; transactionHash: string; - user: { __typename?: 'User'; id: string }; }; export type SwapsQueryVariables = Exact<{ @@ -3163,71 +2826,11 @@ export type SwapsQuery = { swapFeeAmount: string; swapFeeToken: string; swapFeeDeltaAmount: string; + user: string; blockNumber: string; logIndex: string; blockTimestamp: string; transactionHash: string; - user: { __typename?: 'User'; id: string }; - }>; -}; - -export type UserFragment = { - __typename?: 'User'; - id: string; - swaps?: Array<{ - __typename?: 'Swap'; - id: string; - pool: string; - tokenIn: string; - tokenOut: string; - tokenAmountIn: string; - tokenAmountOut: string; - swapFeeAmount: string; - blockNumber: string; - blockTimestamp: string; - transactionHash: string; - }> | null; - shares?: Array<{ - __typename?: 'PoolShare'; - id: string; - balance: string; - pool: { __typename?: 'Pool'; id: string }; - }> | null; -}; - -export type UsersQueryVariables = Exact<{ - skip?: InputMaybe; - first?: InputMaybe; - orderBy?: InputMaybe; - orderDirection?: InputMaybe; - where?: InputMaybe; - block?: InputMaybe; -}>; - -export type UsersQuery = { - __typename?: 'Query'; - users: Array<{ - __typename?: 'User'; - id: string; - swaps?: Array<{ - __typename?: 'Swap'; - id: string; - pool: string; - tokenIn: string; - tokenOut: string; - tokenAmountIn: string; - tokenAmountOut: string; - swapFeeAmount: string; - blockNumber: string; - blockTimestamp: string; - transactionHash: string; - }> | null; - shares?: Array<{ - __typename?: 'PoolShare'; - id: string; - balance: string; - pool: { __typename?: 'Pool'; id: string }; - }> | null; }>; }; @@ -3244,9 +2847,7 @@ export const AddRemoveFragmentDoc = gql` address } } - user { - id - } + user blockNumber logIndex blockTimestamp @@ -3354,39 +2955,13 @@ export const SwapFragmentDoc = gql` swapFeeAmount swapFeeToken swapFeeDeltaAmount - user { - id - } + user blockNumber logIndex blockTimestamp transactionHash } `; -export const UserFragmentDoc = gql` - fragment User on User { - id - swaps(first: 1000) { - id - pool - tokenIn - tokenOut - tokenAmountIn - tokenAmountOut - swapFeeAmount - blockNumber - blockTimestamp - transactionHash - } - shares(first: 1000) { - id - pool { - id - } - balance - } - } -`; export const AddRemoveDocument = gql` query AddRemove( $skip: Int @@ -3515,28 +3090,6 @@ export const SwapsDocument = gql` } ${SwapFragmentDoc} `; -export const UsersDocument = gql` - query Users( - $skip: Int - $first: Int - $orderBy: User_orderBy - $orderDirection: OrderDirection - $where: User_filter - $block: Block_height - ) { - users( - skip: $skip - first: $first - orderBy: $orderBy - orderDirection: $orderDirection - where: $where - block: $block - ) { - ...User - } - } - ${UserFragmentDoc} -`; export type SdkFunctionWrapper = ( action: (requestHeaders?: Record) => Promise, @@ -3640,17 +3193,6 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = 'query', ); }, - Users(variables?: UsersQueryVariables, requestHeaders?: Dom.RequestInit['headers']): Promise { - return withWrapper( - (wrappedRequestHeaders) => - client.request(UsersDocument, variables, { - ...requestHeaders, - ...wrappedRequestHeaders, - }), - 'Users', - 'query', - ); - }, }; } export type Sdk = ReturnType; diff --git a/modules/sources/subgraphs/balancer-v3-vault/swaps.graphql b/modules/sources/subgraphs/balancer-v3-vault/swaps.graphql index bbac5779d..c42d8d296 100644 --- a/modules/sources/subgraphs/balancer-v3-vault/swaps.graphql +++ b/modules/sources/subgraphs/balancer-v3-vault/swaps.graphql @@ -10,9 +10,7 @@ fragment Swap on Swap { swapFeeAmount swapFeeToken swapFeeDeltaAmount - user { - id - } + user blockNumber logIndex blockTimestamp diff --git a/modules/sources/subgraphs/balancer-v3-vault/users.graphql b/modules/sources/subgraphs/balancer-v3-vault/users.graphql deleted file mode 100644 index 15fd08d5b..000000000 --- a/modules/sources/subgraphs/balancer-v3-vault/users.graphql +++ /dev/null @@ -1,42 +0,0 @@ -fragment User on User { - id - swaps(first: 1000) { - id - pool - tokenIn - tokenOut - tokenAmountIn - tokenAmountOut - swapFeeAmount - blockNumber - blockTimestamp - transactionHash - } - shares(first: 1000) { - id - pool { - id - } - balance - } -} - -query Users( - $skip: Int - $first: Int - $orderBy: User_orderBy - $orderDirection: OrderDirection - $where: User_filter - $block: Block_height -) { - users( - skip: $skip - first: $first - orderBy: $orderBy - orderDirection: $orderDirection - where: $where - block: $block - ) { - ...User - } -} diff --git a/modules/sources/transformers/join-exit-cow-transformer.ts b/modules/sources/transformers/join-exit-cow-transformer.ts new file mode 100644 index 000000000..5901c621d --- /dev/null +++ b/modules/sources/transformers/join-exit-cow-transformer.ts @@ -0,0 +1,39 @@ +import _ from 'lodash'; +import { Chain, PoolEventType } from '@prisma/client'; +import { JoinExitEvent } from '../../../prisma/prisma-types'; +import { CowAmmAddRemoveFragment } from '../subgraphs/cow-amm/generated/types'; + +/** + * Takes COW subgraph join/exit events and transforms them into DB entries + * + * @param events + * @param chain + * @param protocolVersion + * @returns + */ +export async function joinExitCowTransformer( + events: CowAmmAddRemoveFragment[], + chain: Chain, + protocolVersion = 3, +): Promise { + return events.map((event) => ({ + protocolVersion, + id: event.id, // tx + logIndex + tx: event.transactionHash, + type: event.type === 'Add' ? PoolEventType.JOIN : PoolEventType.EXIT, + poolId: event.pool.id, + chain: chain, + userAddress: event.user.id, + blockNumber: Number(event.blockNumber), + blockTimestamp: Number(event.blockTimestamp), + logIndex: Number(event.logIndex), + valueUSD: 0, + payload: { + tokens: event.pool.tokens.map((token) => ({ + address: token.address, + amount: event.amounts[token.index], + valueUSD: 0, + })), + }, + })); +} diff --git a/modules/sources/transformers/join-exit-v3-transformer.ts b/modules/sources/transformers/join-exit-v3-transformer.ts index 7e8d257de..600b09cb2 100644 --- a/modules/sources/transformers/join-exit-v3-transformer.ts +++ b/modules/sources/transformers/join-exit-v3-transformer.ts @@ -23,7 +23,7 @@ export async function joinExitV3Transformer( type: event.type === 'Add' ? PoolEventType.JOIN : PoolEventType.EXIT, poolId: event.pool.id, chain: chain, - userAddress: event.user.id, + userAddress: event.user, blockNumber: Number(event.blockNumber), blockTimestamp: Number(event.blockTimestamp), logIndex: Number(event.logIndex), diff --git a/modules/sources/transformers/swap-v3-transformer.ts b/modules/sources/transformers/swap-v3-transformer.ts index ef18bb69c..3ca4e5c6e 100644 --- a/modules/sources/transformers/swap-v3-transformer.ts +++ b/modules/sources/transformers/swap-v3-transformer.ts @@ -18,7 +18,7 @@ export function swapV3Transformer(swaps: SwapFragment[], chain: Chain): SwapEven poolId: swap.pool, chain: chain, protocolVersion: 3, - userAddress: swap.user.id, + userAddress: swap.user, blockNumber: Number(swap.blockNumber), blockTimestamp: Number(swap.blockTimestamp), logIndex: Number(swap.logIndex), diff --git a/modules/subgraphs/reliquary-subgraph/generated/reliquary-subgraph-types.ts b/modules/subgraphs/reliquary-subgraph/generated/reliquary-subgraph-types.ts index 3e5dd9fa5..6ab451bb2 100644 --- a/modules/subgraphs/reliquary-subgraph/generated/reliquary-subgraph-types.ts +++ b/modules/subgraphs/reliquary-subgraph/generated/reliquary-subgraph-types.ts @@ -1824,6 +1824,7 @@ export type _Meta_ = { * will be null if the _meta field has a block constraint that asks for * a block number. It will be filled if the _meta field has no block constraint * and therefore asks for the latest block + * */ block: _Block_; /** The deployment ID */