Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco committed Oct 29, 2024
1 parent 42bab09 commit a2ca736
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 2 additions & 5 deletions modules/actions/pool/v2/sync-swaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,8 @@ export async function syncSwaps(subgraphClient: V2SubgraphClient, chain: Chain):
console.time('BalancerSwaps');
const { swaps } = await subgraphClient.BalancerSwaps({
first: 1000,
where: {
...where,
poolId_in: ['0x32cc63ffeccb7c0508d64e4d37145313cc053b27000200000000000000000cb4'],
},
orderBy: Swap_OrderBy.Block,
where: where,
orderBy: chain === Chain.FANTOM ? Swap_OrderBy.Timestamp : Swap_OrderBy.Block,
orderDirection: OrderDirection.Asc,
});
console.timeEnd('BalancerSwaps');
Expand Down
6 changes: 4 additions & 2 deletions modules/sources/transformers/swap-v2-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ export function swapV2Transformer(swap: BalancerSwapFragment, chain: Chain): Swa
let feeUSD =
feeFloatUSD < 1e6 ? feeFloatUSD.toFixed(18).replace(/0+$/, '').replace(/\.$/, '') : String(feeFloatUSD);

// FX pools have a different fee calculation
// Replica of the subgraph logic:
// https://github.com/balancer/balancer-subgraph-v2/blob/60453224453bd07a0a3a22a8ad6cc26e65fd809f/src/mappings/vault.ts#L551-L564
if (swap.poolId.poolType === 'FX') {
const USDC_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
const tokenOutAddress = swap.tokenOut;
const tokenInAddress = swap.tokenIn;
// FX pools have a different fee calculation
const USDC_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
let isTokenInBase = tokenOutAddress == USDC_ADDRESS;
let baseTokenAddress = isTokenInBase ? tokenInAddress : tokenOutAddress;
let quoteTokenAddress = isTokenInBase ? tokenOutAddress : tokenInAddress;
Expand Down

0 comments on commit a2ca736

Please sign in to comment.