Skip to content

Commit

Permalink
Merge pull request #145 from marvin6en/main
Browse files Browse the repository at this point in the history
myx : dex : update
  • Loading branch information
nitish-91 authored May 22, 2024
2 parents 762cc5f + 3c098db commit 717a51e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 0 additions & 4 deletions adapters/myx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import csv from 'csv-parser';
import fs from 'fs';
import {write} from 'fast-csv';


export interface OutputDataSchemaRow {
block_number: number; //block_number which was given as input
timestamp: number; // block timestamp which was given an input, epoch format
Expand All @@ -24,9 +23,6 @@ interface BlockData {
blockTimestamp: number;
}


const pipeline = promisify(stream.pipeline);

// Assuming you have the following functions and constants already defined
// getPositionsForAddressByPoolAtBlock, CHAINS, PROTOCOLS, AMM_TYPES, getPositionDetailsFromPosition, getLPValueByUserAndPoolFromPositions, BigNumber

Expand Down
12 changes: 6 additions & 6 deletions adapters/myx/src/sdk/positionSnapshots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ export const getPositionsForAddressByPoolAtBlock = async (
snapshotsMap.forEach((userPositionSnapshotMap => {
userPositionSnapshotMap.forEach((positionSnapshot) => {
userPositionSnapshotsAtBlockData.push({
block_number: snapshotBlockNumber,
timestamp: positionSnapshot.timestamp,
user_address: positionSnapshot.recipient,
timestamp: Number(new Date(positionSnapshot.timestamp * 1000).toISOString()),
token_address: positionSnapshot.token0.address,
block_number: snapshotBlockNumber,
token_symbol: positionSnapshot.token0.symbol,
token_balance: BigInt(new Decimal(positionSnapshot.token0Amount).toFixed(0)),
token_symbol: positionSnapshot.token0.symbol,
usd_price: 0
})

Expand All @@ -121,12 +121,12 @@ export const getPositionsForAddressByPoolAtBlock = async (
exists.token_balance = BigInt(new Decimal(positionSnapshot.token1Amount).add(exists.token_balance.toString()).toFixed(0));
} else {
userPositionSnapshotsAtBlockData.push({
block_number: snapshotBlockNumber,
timestamp: positionSnapshot.timestamp,
user_address: positionSnapshot.recipient,
timestamp: Number(new Date(positionSnapshot.timestamp * 1000).toISOString()),
token_address: positionSnapshot.token1.address,
block_number: snapshotBlockNumber,
token_symbol: positionSnapshot.token1.symbol,
token_balance: BigInt(new Decimal(positionSnapshot.token1Amount).toFixed(0)),
token_symbol: positionSnapshot.token1.symbol,
usd_price: 0
})
}
Expand Down

0 comments on commit 717a51e

Please sign in to comment.