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

Add tier tracker #9

Closed
wants to merge 10 commits into from
Closed

Add tier tracker #9

wants to merge 10 commits into from

Conversation

royvardhan
Copy link
Member

@royvardhan royvardhan commented Jun 7, 2024

Summary by CodeRabbit

  • New Features

    • Introduced new functionality to track user activities such as first wallet creation and first swap on the Avalanche network.
    • Added new tables for managing protocol data and wallet tiers.
  • Improvements

    • Enhanced user data handling and points calculation with new boolean fields to track specific activities.
  • Consistency

    • Updated address references to use lowercase for uniformity.
  • Configuration

    • Updated start block values and added new addresses for various entities on the Avalanche network.

Copy link

coderabbitai bot commented Jun 7, 2024

Walkthrough

The updates introduce significant enhancements across multiple files. Key changes include updating addresses and start blocks in the configuration, adding new data points and tables in the schema, and implementing new functions in the helper and index files to manage user data and wallet tiers. Additionally, the user history interface has been extended to track new boolean fields. These modifications collectively improve the system's ability to handle new wallet interactions and data points more effectively.

Changes

Files Change Summaries
ponder.config.ts Updated addresses and start blocks for various entities under the avalanche network.
ponder.schema.ts Added new points sources, boolean fields, and tables AllProtocols and WalletsPerTier.
src/config/constants.ts Added a new entry DexAggregatorV2 with an address for Chains.AVALANCHE.
src/helpers.ts Introduced handleChainFirstWallet and getOrUpdateWalletsPerTier functions, modified existing functions.
src/index.ts Added new functions, updated variable names, and adjusted data handling for user history and points.
src/types.ts Updated UserHistory interface to include new boolean fields.

Sequence Diagram(s) (Beta)

sequenceDiagram
    participant User
    participant System
    participant Database

    User->>System: Initiates wallet interaction
    System->>Database: Check if wallet is first in chain
    Database-->>System: Returns wallet status
    System->>User: Updates user history with new boolean fields
    System->>Database: Update WalletsPerTier table
Loading

Poem

In the code where changes flow,
Wallets new and points do grow. 🌱
Functions dance in helper's light,
User data now shines bright. ✨
With each block, a story told,
In Avalanche's heart of gold. 🏔️


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between df0778e and 0f38645.

Files selected for processing (6)
  • ponder.config.ts (5 hunks)
  • ponder.schema.ts (4 hunks)
  • src/config/constants.ts (1 hunks)
  • src/helpers.ts (7 hunks)
  • src/index.ts (25 hunks)
  • src/types.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • src/config/constants.ts
Additional context used
Biome
src/helpers.ts

[error] 191-191: Unnecessary continue statement (lint/correctness/noUnnecessaryContinue)

Unsafe fix: Delete the unnecessary continue statement

Additional comments not posted (42)
src/types.ts (1)

45-54: LGTM! Ensure that these new fields are properly integrated and utilized in the application logic.

Verification successful

The new fields chainFirstWallet, firstWalletInVPNDLM, firstWalletInVAPELM, and firstSwap are integrated and utilized in the application logic as follows:

  • ponder.schema.ts: The fields are defined as boolean properties.
  • src/index.ts: The fields are used in data assignments and conditional checks.
  • src/helpers.ts: The fields are used in data assignments and initializations.

These usages indicate that the new fields are properly integrated into the application logic.

  • ponder.schema.ts:

    • chainFirstWallet: p.boolean()
    • firstWalletInVPNDLM: p.boolean()
    • firstWalletInVAPELM: p.boolean()
    • firstSwap: p.boolean()
  • src/index.ts:

    • data: { firstWalletInVPNDLM: true }
    • data: { firstWalletInVAPELM: true }
    • if (!userData.firstSwap)
    • data: { firstSwap: true }
  • src/helpers.ts:

    • data: { chainFirstWallet: true }
    • firstWalletInVPNDLM: false
    • firstSwap: false
    • firstWalletInVAPELM: false
    • chainFirstWallet: false

These findings confirm that the new fields are being utilized correctly in the application.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of new fields in UserHistory interface.

# Test: Search for usage of new fields in the application. Expect: Proper handling and usage.
rg --type ts $'chainFirstWallet|firstWalletInVPNDLM|firstWalletInVAPELM|firstSwap'

Length of output: 903

ponder.config.ts (1)

Line range hint 46-79: LGTM! Verify that the new start blocks align with the intended blockchain events or deployments.

ponder.schema.ts (3)

43-45: LGTM! Ensure that these new point sources are correctly integrated into the points calculation logic.

Verification successful

The new point sources chain_first_wallet and dex_aggregator_first_swap are correctly integrated into the points calculation logic in src/index.ts and src/helpers.ts.

  • In src/index.ts, dex_aggregator_first_swap is used to create a new Points entry with the appropriate data.
  • In src/helpers.ts, chain_first_wallet is similarly used to create a new Points entry with the relevant data.

These integrations ensure that the new point sources are properly handled within the application.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify integration of new point sources.

# Test: Search for usage of new point sources in the application. Expect: Proper handling and usage.
rg --type ts $'chain_first_wallet|dex_aggregator_first_swap'

Length of output: 273



Script:

#!/bin/bash
# Extract relevant code snippets from src/index.ts and src/helpers.ts to verify integration of new point sources.

# Extract lines around the usage of 'dex_aggregator_first_swap' in src/index.ts
rg --context 5 --type ts 'dex_aggregator_first_swap' src/index.ts

# Extract lines around the usage of 'chain_first_wallet' in src/helpers.ts
rg --context 5 --type ts 'chain_first_wallet' src/helpers.ts

Length of output: 883


149-155: LGTM! Ensure that the WalletsPerTier table is correctly utilized for managing user tiers.


Line range hint 90-114: LGTM! Ensure that the database migrations for these new fields and tables are properly executed and that data integrity is maintained.

src/helpers.ts (3)

61-93: LGTM! Ensure that the handleChainFirstWallet function is correctly handling first wallet events and interacting with the database as intended.

Verification successful

The function handleChainFirstWallet is correctly used in src/index.ts after calling getOrCreateUserData, which ensures that the necessary userData is provided. The context and usage of both functions appear to be consistent and appropriate.

  • handleChainFirstWallet is used in src/index.ts to handle first wallet events and interact with the database as intended.
  • getOrCreateUserData is defined in src/helpers.ts and provides the necessary userData for handleChainFirstWallet.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify correct handling of first wallet events by `handleChainFirstWallet`.

# Test: Search for usage of `handleChainFirstWallet` in the application. Expect: Proper handling and interaction with the database.
rg --type ts $'handleChainFirstWallet'

Length of output: 305



Script:

#!/bin/bash
# Extract lines from `src/index.ts` where `handleChainFirstWallet` is used to understand its context and usage.
rg --type ts --context 5 'handleChainFirstWallet' src/index.ts

Length of output: 939



Script:

#!/bin/bash
# Extract lines from `src/helpers.ts` where `getOrCreateUserData` is defined and used to understand its context and usage.
rg --type ts --context 5 'getOrCreateUserData' src/helpers.ts

Length of output: 536


396-428: LGTM! Ensure that the getOrUpdateWalletsPerTier function is correctly managing wallets per tier and interacting with the database as intended.

Verification successful

The implementation and usage of the getOrUpdateWalletsPerTier function have been reviewed. The function is correctly defined in src/helpers.ts and is used in src/index.ts to manage wallets per tier. The database interactions (findUnique, create, update) appear to be correctly implemented and used.

  • Implementation in src/helpers.ts:

    export async function getOrUpdateWalletsPerTier(
      context: Context,
      tierId: bigint,
      userAddress: string
    ): Promise<any> {
      const { WalletsPerTier } = context.db;
      const { chainId } = context.network;
    
      const id = `${tierId}-${chainId}`;
    
      let walletsPerTier = await WalletsPerTier.findUnique({ id });
    
      if (!walletsPerTier) {
        walletsPerTier = await WalletsPerTier.create({
          id,
          data: {
            wallets: [userAddress],
          },
        });
      }
    
      if (!walletsPerTier.wallets.includes(userAddress)) {
        walletsPerTier.wallets.push(userAddress);
        walletsPerTier = await WalletsPerTier.update({
          id,
          data: {
            wallets: walletsPerTier.wallets,
          },
        });
      }
    
      return walletsPerTier;
    }
  • Usage in src/index.ts:

    import { ponder } from "@/generated";
    import {
      getOrCreateUserData,
      queryQuote,
      getTokenId,
      getOrUpdateTokenIdData,
      handleChainFirstWallet,
      getOrUpdateWalletsPerTier,
    } from "./helpers";
    
    // Usage example
    await getOrUpdateWalletsPerTier(context, 0n, userAddressLowerCase);
    
    ponder.on("LiquidMining:Deposit", async ({ event, context }) => {
      const { Points, UserHistory, LiquidMining } = context.db;
      const { hash } = event.transaction;
      const { chainId } = context.network;
      const { seasonId, user: userAddress, amount } = event.args;
      const userAddressLowerCase = userAddress?.toLowerCase();
      const tokenId = await getTokenId(userAddressLowerCase as Address, context);
      const timestamp = event.block.timestamp;
    
      const tier = await context.client.readContract({
        abi: context.contracts.RewardsController.abi,
        address: context.contracts.RewardsController.address as `0x${string}`,
        functionName: "tierOf",
        args: [tokenId],
      });
    
      await getOrUpdateWalletsPerTier(context, tier, event.args.member);
    });

The function is used in scenarios where wallet tiers need to be updated or created based on events, ensuring proper handling and interaction with the database.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify correct functionality of `getOrUpdateWalletsPerTier`.

# Test: Search for usage of `getOrUpdateWalletsPerTier` in the application. Expect: Proper handling and interaction with the database.
rg --type ts $'getOrUpdateWalletsPerTier'

Length of output: 311



Script:

#!/bin/bash
# Description: Verify the implementation and usage of `getOrUpdateWalletsPerTier`.

# Step 1: Review the implementation of `getOrUpdateWalletsPerTier` in `src/helpers.ts`.
echo "Implementation of getOrUpdateWalletsPerTier in src/helpers.ts:"
rg --context 10 'export async function getOrUpdateWalletsPerTier' src/helpers.ts

# Step 2: Review the usage of `getOrUpdateWalletsPerTier` in `src/index.ts`.
echo "Usage of getOrUpdateWalletsPerTier in src/index.ts:"
rg --context 10 'getOrUpdateWalletsPerTier' src/index.ts

Length of output: 2364


Line range hint 164-175: LGTM! Ensure that the updated queryQuote function is correctly querying quotes with the new aggregator address parameter.

Verification successful

The updated queryQuote function correctly handles the new aggregatorAddress parameter, which is passed as event.log.address. This address is a valid Ethereum address in the context of the DexAggregator:RouterSwap event.

  • src/index.ts: The call to queryQuote correctly passes event.log.address as the aggregatorAddress parameter.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify correct functionality of updated `queryQuote`.

# Test: Search for usage of `queryQuote` in the application. Expect: Proper handling of new aggregator address parameter.
rg --type ts $'queryQuote'

Length of output: 158



Script:

#!/bin/bash
# Description: Inspect the call to `queryQuote` in `src/index.ts` to ensure the new parameter is correctly handled.

# Extract the relevant lines around the call to `queryQuote` in `src/index.ts`
rg --context 5 'queryQuote' src/index.ts

Length of output: 455



Script:

#!/bin/bash
# Description: Verify the context of `event.log.address` in `src/index.ts` to ensure it is a valid Ethereum address.

# Extract the relevant lines around the usage of `event.log.address` in `src/index.ts`
rg --context 10 'event.log.address' src/index.ts

Length of output: 498



Script:

#!/bin/bash
# Description: Locate the definition and structure of `event` in `src/index.ts` to confirm that `log.address` is a valid Ethereum address.

# Search for the definition of `event` in `src/index.ts`
rg --context 10 'event' src/index.ts

Length of output: 5917

src/index.ts (34)

7-8: Added new helper functions handleChainFirstWallet and getOrUpdateWalletsPerTier.

Ensure these functions are thoroughly tested since they are critical for the new tier tracking feature.


29-30: Refactored to use userAddressLowerCase for consistency.

This change improves consistency in address handling. Ensure all related database queries are updated to handle lowercase addresses.


35-36: Introduced new fields userDataId and userHistoryId in the Points creation logic.

This change likely supports better tracking and querying capabilities. Verify that these new fields are supported in the database schema and indexed appropriately.


48-48: Integration of getOrUpdateWalletsPerTier in the Stratosphere:Transfer event handler.

Ensure that the tier calculation logic within this function is optimized for performance, especially under high load.


64-75: Refactored getOrCreateUserData and added handleChainFirstWallet to handle new wallet tracking logic.

This is a significant change. Ensure comprehensive testing, particularly around edge cases where wallet data might be incomplete or incorrect.


84-84: Added firstWallet field to liquidMiningData.

Ensure that this field is properly initialized and used in subsequent logic to track the first wallet interaction correctly.


91-92: New fields userDataId and userHistoryId used in Points creation for liquid mining.

As with similar changes, ensure these fields are well-supported in the database and queries are optimized.


100-103: Update operation to set firstWalletInVPNDLM in UserHistory.

This update is crucial for tracking the first wallet interaction. Ensure that the update logic handles concurrent modifications gracefully.


114-115: Points creation for the first deposit in liquid mining.

This addition is aligned with the new tracking requirements. Verify that the points calculation and assignment are accurate.


130-131: Handling points for locking in one season of VPN/DLM.

This logic extension is necessary for the new seasonal tracking. Ensure that the season tracking is accurate and resets appropriately.


144-144: Update to UserHistory to track one season points claim.

This update is essential for maintaining state across different seasons. Ensure that the state management is robust and handles edge cases.


154-154: Dynamic update to LMSeasons array in UserHistory.

This dynamic update is a good use of functional programming paradigms. Ensure that the performance implications are considered, especially with larger data sets.


168-169: Creation of points for three seasons lock in VPN/DLM.

This addition supports the new tiered system requirements. Verify that the points are calculated correctly and that there are no discrepancies in the season count.


182-182: Flagging of three seasons points claim in UserHistory.

It's crucial to accurately track these milestones. Ensure that the flagging mechanism is reliable and triggers appropriately.


193-194: Handling of points for six seasons lock.

This is part of the expanded functionality for season tracking. Confirm that the logic correctly handles the transition from five to six seasons without errors.


207-207: Update to UserHistory for six seasons points claim.

This update is critical for accurate user history tracking. Ensure that the update process is atomic and handles concurrent updates efficiently.


218-219: Points handling for twelve seasons lock.

This extension is necessary for the comprehensive tracking of user engagement over extended periods. Verify the accuracy of the season counting and points allocation.


232-232: Flagging of one year points claim in UserHistory.

This flagging is essential for milestone tracking. Ensure that the system correctly identifies and flags the one-year milestone.


245-246: Refactored to use userAddressLowerCase in VapeStaking:Deposit.

Consistent use of lowercase addresses helps prevent errors related to address case sensitivity. Verify that all related components use the lowercase format.


252-263: Integration of handleChainFirstWallet in VapeStaking:Deposit.

This integration is crucial for the new wallet tracking feature. Ensure that the function is optimized and handles edge cases effectively.


273-273: Added firstWallet field to vapeStakingData.

This addition is important for tracking the first wallet interaction in vape staking. Ensure that this field is utilized correctly in subsequent logic.


281-282: New fields userDataId and userHistoryId used in Points creation for vape staking.

Consistent with other changes, ensure these fields are supported in the database and that queries involving these fields are optimized.


289-292: Update operation to set firstWalletInVAPELM in UserHistory.

This update is crucial for tracking the first wallet interaction in vape staking. Ensure that the update logic is robust and handles concurrent modifications efficiently.


302-303: Points creation for the first deposit in vape staking.

This addition aligns with the new tracking requirements. Verify that the points calculation and assignment are accurate.


316-316: Update to UserHistory to track the first deposit in vape staking.

This update is essential for maintaining accurate user history. Ensure that the update process is atomic and handles concurrent updates efficiently.


332-333: Refactored to use userAddressLowerCase in DexAggregator:RouterSwap.

Consistent use of lowercase addresses helps prevent errors related to address case sensitivity. Verify that all related components use the lowercase format.


346-357: Integration of handleChainFirstWallet in DexAggregator:RouterSwap.

This integration is crucial for the new wallet tracking feature. Ensure that the function is optimized and handles edge cases effectively.


365-366: Creation of points for a successful swap in Dex Aggregator.

This addition supports the new functionality for tracking swaps. Verify that the points are calculated correctly and that there are no discrepancies in the trade values.


379-396: Handling of the first swap in Dex Aggregator.

This logic is essential for tracking the first swap event. Ensure that the flagging mechanism is reliable and triggers appropriately.


400-400: Update to UserHistory to track total USD value of swaps and total swaps.

This update is critical for accurate user history tracking. Ensure that the update process is atomic and handles concurrent updates efficiently.


Line range hint 409-429: Handling of the first $1k swaps in Dex Aggregator.

This addition is necessary for the new functionality for tracking swap milestones. Verify that the points are calculated correctly and that there are no discrepancies in the trade values.


Line range hint 437-457: Handling of the first $10k swaps in Dex Aggregator.

This addition supports the new functionality for tracking swap milestones. Verify that the points are calculated correctly and that there are no discrepancies in the trade values.


Line range hint 465-485: Handling of the first $100k swaps in Dex Aggregator.

This addition is necessary for the comprehensive tracking of user engagement over extended periods. Verify the accuracy of the trade values and points allocation.


499-507: Integration of getOrUpdateWalletsPerTier in RewardsController:ClaimPoints.

This integration is crucial for the new tier tracking feature. Ensure that the function is optimized and handles edge cases effectively.

Comment on lines +32 to +36
address: [
addresses.DexAggregator?.avalanche!,
addresses.DexAggregatorV2?.avalanche!,
],
startBlock: 43508160,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The inspection of the relevant code snippets reveals the following:

  • In src/index.ts, the event handler for DexAggregator:RouterSwap does not explicitly handle the new address array format. This needs to be updated to iterate over the array of addresses if necessary.
  • In src/helpers.ts, the readContract function uses contracts.DexAggregator.abi and aggregatorAddress. This should be checked to ensure it can handle multiple addresses.
  • In src/config/constants.ts, the addresses for DexAggregator and DexAggregatorV2 are defined separately. This aligns with the new array format in ponder.config.ts.

To ensure the correct handling of the new address array format, the following updates are recommended:

  • Update src/index.ts: Modify the event handler to iterate over the array of addresses if necessary.
  • Update src/helpers.ts: Ensure the readContract function can handle multiple addresses.

Actionable Steps:

  1. Update src/index.ts:

    • Modify the event handler for DexAggregator:RouterSwap to handle the array of addresses.
  2. Update src/helpers.ts:

    • Ensure the readContract function can handle multiple addresses.

Code Updates:

src/index.ts:

ponder.on("DexAggregator:RouterSwap", async ({ event, context }) => {
  const { Points, UserHistory } = context.db;
  const { tokenOut: tokenIn, amountOut: amountIn } = event.args;
  const { from: userAddress, hash } = event.transaction;
  const { chainId, name } = context.network;
  const tokenOut = assets[name].USDC as `0x${string}`;
  const timestamp = event.block.timestamp;
  const blockNumber = event.block.number;
  const userAddressLowerCase = userAddress?.toLowerCase() as Address;
  const tokenId = await getTokenId(userAddressLowerCase, context);

  // Iterate over the array of addresses
  const addresses = [addresses.DexAggregator?.avalanche!, addresses.DexAggregatorV2?.avalanche!];
  for (const address of addresses) {
    // Your logic here
  }
});

src/helpers.ts:

async function getQuote(
  quoteParams: QuoteParams,
  blockNumber: bigint,
  aggregatorAddresses: `0x${string}`[]
): Promise<bigint> {
  const { client, network, contracts } = context;

  let quote: Quote = { amounts: [], adapters: [], path: [], gasEstimate: 0n };

  for (const aggregatorAddress of aggregatorAddresses) {
    try {
      quote = await client.readContract({
        abi: contracts.DexAggregator.abi,
        address: aggregatorAddress,
        functionName: "findBestPath",
        args: [
          quoteParams.amountIn,
          quoteParams.tokenIn,
          assets[network.name].USDC as `0x${string}`,
          quoteParams.maxSteps,
        ],
        blockNumber: blockNumber,
      });
      // Break if a valid quote is found
      if (quote.amounts.length > 0) break;
    } catch (error) {
      // Handle error
    }
  }

  return quote;
}

These updates will ensure that the new array format for addresses is correctly handled in the contract interactions.

Analysis chain

LGTM! Ensure that the new array format for addresses is correctly handled in contract interactions.


To ensure the new array format for addresses is correctly handled, we need to verify the handling of DexAggregator addresses in the following files:

  • src/index.ts
  • src/helpers.ts
  • src/config/constants.ts

The search results indicate that the handling of DexAggregator addresses needs to be verified in the following files:

  • src/index.ts: Ensure the event handler for DexAggregator:RouterSwap correctly handles the new address array format.
  • src/helpers.ts: Ensure the ABI reference for DexAggregator correctly handles the new address array format.
  • src/config/constants.ts: Ensure the constants for DexAggregator and DexAggregatorV2 correctly handle the new address array format.

Let's inspect the relevant code snippets in these files to verify the correct handling of the new address array format.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify correct handling of new address array format.

# Test: Search for contract interactions using `DexAggregator` addresses. Expect: Correct handling of array format.
rg --type ts $'DexAggregator'

Length of output: 664



Script:

#!/bin/bash
# Description: Verify correct handling of new address array format in relevant files.

# Test: Search for handling of `DexAggregator` addresses in `src/index.ts`.
rg --type ts 'DexAggregator' src/index.ts

# Test: Search for handling of `DexAggregator` addresses in `src/helpers.ts`.
rg --type ts 'DexAggregator' src/helpers.ts

# Test: Search for handling of `DexAggregator` addresses in `src/config/constants.ts`.
rg --type ts 'DexAggregator' src/config/constants.ts

Length of output: 320



Script:

#!/bin/bash
# Description: Inspect code snippets for handling of new address array format.

# Test: Display relevant code snippets in `src/index.ts`.
rg --type ts --context 10 'DexAggregator' src/index.ts

# Test: Display relevant code snippets in `src/helpers.ts`.
rg --type ts --context 10 'DexAggregator' src/helpers.ts

# Test: Display relevant code snippets in `src/config/constants.ts`.
rg --type ts --context 10 'DexAggregator' src/config/constants.ts

Length of output: 2729

Comment on lines +135 to +138
firstWalletInVPNDLM: false,
firstSwap: false,
firstWalletInVAPELM: false,
chainFirstWallet: false,
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The calls to getOrCreateUserData in src/index.ts do not include the new parameters for tracking first-time activities. This indicates that the function is not being used correctly with the updated parameters.

  • src/index.ts, lines where getOrCreateUserData is called:
    • await getOrCreateUserData(context, tokenId, userAddressLowerCase);
    • let userData = await getOrCreateUserData(context, tokenId, userAddressLowerCase);

These calls should be updated to include the new parameters for tracking first-time activities.

Analysis chain

LGTM! Ensure that the updated getOrCreateUserData function is correctly managing user data with the new parameters.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify correct functionality of updated `getOrCreateUserData`.

# Test: Search for usage of `getOrCreateUserData` in the application. Expect: Proper handling of new parameters.
rg --type ts $'getOrCreateUserData'

Length of output: 381



Script:

#!/bin/bash
# Extract lines where `getOrCreateUserData` is called in `src/index.ts` to verify parameter handling.
rg --type ts --line-number 'getOrCreateUserData' src/index.ts | awk -F: '{print $1 ":" $2}' | xargs -I {} sed -n '{}p' src/index.ts

Length of output: 433



Script:

#!/bin/bash
# Extract lines where `getOrCreateUserData` is called in `src/index.ts` to verify parameter handling.
rg --type ts --context 5 'getOrCreateUserData' src/index.ts

Length of output: 1316

@royvardhan
Copy link
Member Author

I have pushed the same changes in this pr to avoid conflicts: #8
Closing this.

@royvardhan royvardhan closed this Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants