-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat: multichain indexer #292
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Reviewer's Guide by SourceryThis pull request implements a multichain indexer by reorganizing contract exports, adding chain properties to contract objects, and updating client definitions. It also replaces 'smartsaleChains' with 'appChains' for better chain management. File-Level Changes
Tips
|
WalkthroughThis update encompasses a series of enhancements across multiple modules aimed at improving dependency management, refining client configurations for blockchain interactions, and restructuring code for clarity and maintainability. Key changes include upgrading package versions, modifying client instantiation methods, and reorganizing contract exports, which collectively enhance the functionality and adaptability of the application. Changes
Sequence Diagram(s)sequenceDiagram
participant A as Client
participant B as Issuer
participant C as Auction Indexer
participant D as Token Contract
A->>B: Request Token Details
B->>D: Fetch from Blockchain
D-->>B: Return Token Data
B-->>A: Send Token Details
A->>C: Start Auction Indexing
C->>D: Retrieve Auction Events
D-->>C: Send Auction Data
C-->>A: Provide Auction Status
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @gaboesquivel - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider reviewing the imports between
app-contracts
andapp-env
to ensure there are no circular dependencies. - Look for opportunities to further abstract common token data to reduce duplication, especially in the USDC and USDT contract definitions.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟡 Complexity: 1 issue found
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
|
||
|
||
const auctions:ContractData[] = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question: Clarify if the empty auctions array is intentional or if it should be populated.
export * from "./tokens/eos-fake-bitusd"; | ||
export * from "./tokens/eos-fake-usdt"; | ||
|
||
import { TestnetEasyAuction } from "./auction/testnet-easy-auction"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider using dynamic imports to simplify the code and reduce maintenance overhead.
The new code introduces increased complexity due to the following reasons:
- Increased Number of Imports: The individual imports for each module make the import section more cluttered and harder to manage.
- Manual List Management: Manually creating arrays for
evmTokens
,eosTokens
, andauctions
can lead to errors and requires additional maintenance. - Redundant Information: The categorization of tokens and auctions is redundant because the file paths already provide a clear structure.
- Increased Maintenance Overhead: Adding or modifying contracts requires updates in multiple parts of the code, increasing the likelihood of errors.
Consider using dynamic imports to simplify the code and reduce maintenance overhead. Here’s an example:
const context = require.context('./', true, /\.\/(auction|tokens)\/.*\.js$/);
const evmTokens = [];
const eosTokens = [];
const auctions = [];
context.keys().forEach((key) => {
const module = context(key);
const moduleName = key.split('/').pop().replace('.js', '');
if (key.includes('/auction/')) {
auctions.push(module[moduleName]);
} else if (key.includes('/tokens/')) {
if (key.includes('eos')) {
eosTokens.push(module[moduleName]);
} else {
evmTokens.push(module[moduleName]);
}
}
});
export const devContracts = {
tokens: {
evm: evmTokens,
eos: eosTokens,
},
auctions,
};
This approach reduces redundancy, leverages the existing file structure, and makes the code more maintainable and scalable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
bun.lockb
is excluded by!**/bun.lockb
Files selected for processing (29)
- apps/faucet/package.json (1 hunks)
- apps/indexer/src/lib/issuer-client.ts (1 hunks)
- apps/indexer/src/lib/utils.ts (2 hunks)
- apps/indexer/src/modules/auction/auction-indexer.ts (1 hunks)
- apps/indexer/src/modules/auction/easyauction.ts (1 hunks)
- apps/indexer/src/modules/presale/evm-contributions.ts (2 hunks)
- apps/indexer/src/modules/swaps/evm-transfers.ts (1 hunks)
- apps/indexer/src/routes/healthcheck.ts (1 hunks)
- apps/webapp/package.json (4 hunks)
- packages/app-contracts/src/dev/auction/testnet-allow-list.ts (1 hunks)
- packages/app-contracts/src/dev/auction/testnet-deposit-order.ts (1 hunks)
- packages/app-contracts/src/dev/auction/testnet-easy-auction.ts (1 hunks)
- packages/app-contracts/src/dev/index.ts (1 hunks)
- packages/app-contracts/src/dev/tokens/eos-fake-bitusd.ts (1 hunks)
- packages/app-contracts/src/dev/tokens/eos-fake-usdt.ts (1 hunks)
- packages/app-contracts/src/dev/tokens/sepolia-usdt.ts (2 hunks)
- packages/app-contracts/src/dev/tokens/testnet-mbots-prelaunch.ts (2 hunks)
- packages/app-contracts/src/dev/tokens/testnet-usd-cred.ts (2 hunks)
- packages/app-contracts/src/dev/tokens/testnet-usdt.ts (2 hunks)
- packages/app-contracts/src/index.ts (1 hunks)
- packages/app-contracts/src/prod/index.ts (1 hunks)
- packages/app-contracts/src/prod/tokens/eos-bitusd.ts (1 hunks)
- packages/app-contracts/src/prod/tokens/eos-usdt.ts (1 hunks)
- packages/app-contracts/src/prod/tokens/usdc.ts (1 hunks)
- packages/app-contracts/src/prod/tokens/usdt.ts (15 hunks)
- packages/app-contracts/src/types.ts (2 hunks)
- packages/app-env/package.json (1 hunks)
- packages/app-env/src/chains.ts (2 hunks)
- packages/app-env/src/env.ts (3 hunks)
Files skipped from review due to trivial changes (1)
- apps/indexer/src/routes/healthcheck.ts
Additional comments not posted (86)
packages/app-contracts/src/index.ts (3)
1-2
: Imports look good.The imports
devContracts
andprodContracts
are correctly defined.
4-6
: Re-exporting modules and types.The re-exporting of
dev
,prod
, andtypes
modules is correctly defined.
8-11
: Unified export of contracts.The
appContracts
object encapsulates bothdevContracts
andprodContracts
, improving modularity and maintainability.apps/indexer/src/modules/auction/easyauction.ts (3)
1-3
: Imports look good.The imports
http
,createPublicClient
,getContract
, and other necessary modules are correctly defined.
5-8
: Client configuration looks good.The
client
constant is correctly defined usingcreatePublicClient
witheosEvmTestnet
andhttp()
.
Line range hint
10-13
:
Contract export looks good.The
easyAuction
export is correctly defined usinggetContract
withTestnetEasyAuction
and theclient
.packages/app-contracts/src/prod/tokens/eos-usdt.ts (2)
1-1
: Import looks good.The import
EOSTokenContractData
is correctly defined.
Line range hint
3-12
:
Constant definition looks good.The
EOSUSDT
constant is correctly defined with the typeEOSTokenContractData
.packages/app-contracts/src/prod/tokens/eos-bitusd.ts (2)
1-1
: Import statement updated correctly.The import statement now correctly imports
EOSTokenContractData
instead ofTokenContractData
.
Line range hint
3-10
:
Type updated correctly forEOSBITUSD
.The type of the
EOSBITUSD
constant has been updated toEOSTokenContractData
, enhancing type safety and aligning with the intended use of EOS-specific token data structures.packages/app-contracts/src/dev/tokens/eos-fake-bitusd.ts (2)
1-1
: Import statement updated correctly.The import statement now correctly imports
EOSTokenContractData
instead ofTokenContractData
.
Line range hint
3-10
:
Type updated correctly forEOSFakeBITUSD
.The type of the
EOSFakeBITUSD
constant has been updated toEOSTokenContractData
, enhancing type safety and aligning with the intended use of EOS-specific token data structures.packages/app-contracts/src/dev/tokens/eos-fake-usdt.ts (2)
1-1
: Import statement updated correctly.The import statement now correctly imports
EOSTokenContractData
instead ofTokenContractData
.
Line range hint
3-10
:
Type updated correctly forEOSFakeUSDT
.The type of the
EOSFakeUSDT
constant has been updated toEOSTokenContractData
, enhancing type safety and aligning with the intended use of EOS-specific token data structures.packages/app-env/package.json (2)
5-5
: Approved: Simplified package description.The change from "bitlauncher Environment Configurations" to "Environment Configurations" improves clarity.
11-13
: Approved: Dependency updates.The addition of
lodash
and the reordering of dependencies are appropriate changes.However, ensure that
lodash
is used in the codebase.Verification successful
Verified:
lodash
is used in the codebase.The addition of
lodash
as a dependency is justified as it is used in multiple files:
apps/webapp/components/layout/providers.tsx
apps/webapp/lib/projects.ts
apps/webapp/scripts/translate-category.ts
apps/webapp/scripts/translate.ts
apps/webapp/services/datocms/datocms-blog.service.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if `lodash` is used in the codebase. # Test: Search for the usage of `lodash`. Expect: At least one occurrence of `lodash` usage. rg --type js --type ts 'lodash'Length of output: 369
apps/indexer/src/lib/issuer-client.ts (2)
14-17
: Approved: Client instantiation moved inside function.Moving the
client
instantiation inside thegetCurrentBlockHeight
function ensures a new instance is created each time, avoiding potential issues with stale data.
1-13
: Verify the removal ofsepoliaClient
.Ensure that the removal of
sepoliaClient
does not affect other parts of the codebase.packages/app-contracts/src/prod/index.ts (4)
2-5
: Approved: Improved organization of token exports.Moving the token exports to a nested
tokens
directory enhances the organization and clarity of the code.
7-11
: Approved: Necessary imports for token contracts.The new imports for token contracts are necessary for the new
prodContracts
structure and ensure that the relevant contract data is available.
13-27
: Approved: Enhanced modularity and clarity withprodContracts
structure.The new
evmTokens
,eosTokens
, andauctions
arrays, along with theprodContracts
object, enhance the modularity and clarity of the code.
28-34
: Approved: Clear and organizedprodContracts
export.The
prodContracts
object export provides a clear and organized structure for accessing token contracts and auctions in the application.packages/app-contracts/src/types.ts (2)
21-21
: LGTM! Verify the usage of the updated interface.The addition of the
chain
property toEVMContractData
enhances the data structure. Ensure that all instances ofEVMContractData
are updated to include the newchain
property.Verification successful
All instances of
EVMContractData
have been updated to include thechain
property.The addition of the
chain
property toEVMContractData
has been successfully integrated into the identified instances:
TestnetEasyAuction
TestnetDepositOrder
TestnetAllowList
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all instances of `EVMContractData` are updated to include the new `chain` property. # Test: Search for the usage of `EVMContractData`. Expect: All instances should include the `chain` property. rg --type ts -A 5 $'EVMContractData'Length of output: 3157
Script:
#!/bin/bash # Description: Verify that the `chain` property is included in all instances of `EVMContractData`. # Check the specific instances of `EVMContractData` in the identified files. rg --type ts -A 10 'export const TestnetEasyAuction: EVMContractData =' packages/app-contracts/src/dev/auction/testnet-easy-auction.ts rg --type ts -A 10 'export const TestnetDepositOrder: EVMContractData =' packages/app-contracts/src/dev/auction/testnet-deposit-order.ts rg --type ts -A 10 'export const TestnetAllowList: EVMContractData =' packages/app-contracts/src/dev/auction/testnet-allow-list.tsLength of output: 1256
27-27
: LGTM! Verify the usage of the updated interface.The addition of the
chain
property toEVMTokenContractData
enhances the data structure. Ensure that all instances ofEVMTokenContractData
are updated to include the newchain
property.packages/app-env/src/chains.ts (4)
1-1
: LGTM!The inclusion of
devContracts
andprodContracts
from theapp-contracts
module enhances the dynamic handling of blockchain networks.
23-23
: LGTM!The removal of the
as const
assertion fromeosEvmTestnet
allows for more flexibility in its application.
25-26
: LGTM!The updates to
prodChains
andtestChains
arrays enhance the configurability of the chains used in different environments, aligning them with the respective contract definitions.
28-34
: LGTM!The renaming of the export to
appChains
reflects a broader purpose for this structure. The refactoring of thecreateMapFromId
function improves code readability and efficiency.apps/faucet/package.json (3)
17-17
: LGTM!The version update for
@rainbow-me/rainbowkit
to2.1.2
ensures compatibility and leverages improvements in the library.
19-19
: LGTM!The version update for
@wagmi/connectors
to^5.1.1
ensures compatibility and leverages improvements in the library.
33-33
: LGTM!The version update for
wagmi
to^2.12.1
ensures compatibility and leverages improvements in the library.packages/app-contracts/src/dev/index.ts (4)
1-8
: LGTM! The reorganization of exports improves modularity.The new export paths are correctly organized into
auction
andtokens
directories, enhancing code clarity and maintainability.
10-17
: LGTM! The explicit imports improve dependency clarity.The imports for each contract are correctly added, aligning with the new export structure and enhancing code readability.
20-35
: LGTM! The introduction of arrays consolidates contract data effectively.The arrays for
evmTokens
,eosTokens
, andauctions
are correctly defined, improving data organization and access.
37-43
: LGTM! ThedevContracts
object enhances usability.The
devContracts
object is correctly defined, encapsulating the organized contract data and improving module usability.packages/app-contracts/src/dev/auction/testnet-allow-list.ts (2)
1-1
: LGTM! The import forsepolia
is correct and necessary.The import for
sepolia
fromviem/chains
is correctly added, supporting the newchain
property in theTestnetAllowList
object.
10-10
: LGTM! The addition of thechain
property enhances clarity.The
chain
property is correctly added to theTestnetAllowList
object, providing clearer context regarding the associated blockchain network.packages/app-contracts/src/dev/auction/testnet-deposit-order.ts (2)
1-1
: LGTM! The import forsepolia
is correct and necessary.The import for
sepolia
fromviem/chains
is correctly added, supporting the newchain
property in theTestnetDepositOrder
object.
10-10
: LGTM! The addition of thechain
property enhances clarity.The
chain
property is correctly added to theTestnetDepositOrder
object, providing clearer context regarding the associated blockchain network.apps/indexer/src/lib/utils.ts (2)
3-4
: LGTM! Imports are appropriate.The new imports
http
,createPublicClient
, andeosEvmTestnet
are correctly added and align with the changes in thegetTokenDetails
function.
41-43
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
getTokenDetails
match the new client setup.Verification successful
LGTM! The function
getTokenDetails
is correctly used in the codebase and matches the new client setup.
apps/indexer/src/lib/utils.ts
: Function definition with the new client setup.apps/indexer/src/modules/auction/auction-indexer.ts
: Correct usage ofgetTokenDetails
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `getTokenDetails` match the new client setup. # Test: Search for the function usage. Expect: Only occurrences of the new client setup. rg --type python -A 5 $'getTokenDetails'Length of output: 70
Script:
#!/bin/bash # Description: Verify all function calls to `getTokenDetails` match the new client setup. # Test: Search for the function usage. Expect: Only occurrences of the new client setup. rg --type typescript -A 5 'getTokenDetails'Length of output: 78
Script:
#!/bin/bash # Description: Verify all function calls to `getTokenDetails` match the new client setup. # Test: Search for the function usage. Expect: Only occurrences of the new client setup. rg --type ts -A 5 'getTokenDetails'Length of output: 1701
packages/app-contracts/src/prod/tokens/usdc.ts (8)
5-17
: LGTM! Contract definition for Arbitrum is correct.The contract for Arbitrum is correctly defined with all required properties.
18-28
: LGTM! Contract definition for Avalanche is correct.The contract for Avalanche is correctly defined with all required properties.
29-40
: LGTM! Contract definition for Base is correct.The contract for Base is correctly defined with all required properties.
41-52
: LGTM! Contract definition for Celo is correct.The contract for Celo is correctly defined with all required properties.
53-64
: LGTM! Contract definition for Ethereum is correct.The contract for Ethereum is correctly defined with all required properties.
65-76
: LGTM! Contract definition for Optimism is correct.The contract for Optimism is correctly defined with all required properties.
77-88
: LGTM! Contract definition for Polygon is correct.The contract for Polygon is correctly defined with all required properties.
89-100
: LGTM! Contract definition for ZKsync is correct.The contract for ZKsync is correctly defined with all required properties.
packages/app-env/src/env.ts (3)
1-1
: LGTM! Import statement updated correctly.The import statement for
smartsaleChains
has been correctly replaced withappChains
.
19-19
: LGTM! Configuration updated correctly forprod
.The
chains
property in theprod
configuration is correctly set toappChains.prod
.
42-42
: LGTM! Configuration updated correctly fordev
.The
chains
property in thedev
configuration is correctly set toappChains.dev
.apps/indexer/src/modules/presale/evm-contributions.ts (2)
7-7
: Verify the correctness of the new import.Ensure that
appChains
fromapp-env
is the correct replacement forsmartsaleChains
.Verification successful
Verify the usage of
appChains
inevm-contributions.ts
.Ensure that
appChains
is used correctly and consistently as a replacement forsmartsaleChains
.
The new import of
appChains
fromapp-env
is correct and consistent with the rest of the codebase.
- The
appChains
constant is defined and exported correctly inpackages/app-env/src/chains.ts
.- The usage of
appChains
inapps/indexer/src/modules/presale/evm-contributions.ts
is appropriate and consistent with its intended purpose.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new import. # Test: Search for the definition of `appChains` in the codebase. ast-grep --lang typescript --pattern $'const appChains = $_'Length of output: 309
Script:
#!/bin/bash # Description: Verify the usage of `appChains` in evm-contributions.ts. # Test: Search for all references to `appChains` in the evm-contributions.ts file. rg 'appChains' apps/indexer/src/modules/presale/evm-contributions.ts -A 5 -B 5Length of output: 897
17-17
: Verify the correctness of the new chain retrieval logic.Ensure that
appChains.dev.get(token.chainId)
is the correct replacement forsmartsaleChains.dev.get(token.chainId)
.Verification successful
Verified the correctness of the new chain retrieval logic.
The replacement of
smartsaleChains.dev.get(token.chainId)
withappChains.dev.get(token.chainId)
is correct. TheappChains
object is properly defined and initialized, ensuring the chain retrieval logic is consistent with the rest of the codebase.
appChains
is defined inpackages/app-env/src/chains.ts
.appChains.dev
is aMap
created fromprodChains
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new chain retrieval logic. # Test: Search for the definition of `appChains.dev.get` in the codebase. ast-grep --lang typescript --pattern $'appChains.dev.get($_)'Length of output: 268
Script:
#!/bin/bash # Description: Search for the definition of `appChains` in the codebase. # Test: Search for the definition and initialization of `appChains`. ast-grep --lang typescript --pattern $'const appChains = $_'Length of output: 309
Script:
#!/bin/bash # Description: Search for the definitions of `createMapFromId` and `prodChains` in the codebase. # Test: Search for the definition and initialization of `createMapFromId`. ast-grep --lang typescript --pattern $'function createMapFromId($_)' # Test: Search for the definition and initialization of `prodChains`. ast-grep --lang typescript --pattern $'const prodChains = $_'Length of output: 132
Script:
#!/bin/bash # Description: Refined search for the definitions of `createMapFromId` and `prodChains` in the codebase. # Test: Search for the definition and initialization of `createMapFromId`. rg 'function createMapFromId' -A 5 # Test: Search for the definition and initialization of `prodChains`. rg 'const prodChains' -A 5Length of output: 744
apps/indexer/src/modules/swaps/evm-transfers.ts (3)
1-1
: Verify the correctness of the new imports.Ensure that
appContracts
fromapp-contracts
andappChains
fromapp-env
are the correct replacements.Verification successful
Verify the usage of the new imports.
Ensure that
appContracts
fromapp-contracts
andappChains
fromapp-env
are used correctly inapps/indexer/src/modules/swaps/evm-transfers.ts
.
The new imports are correct and consistent with the rest of the codebase.
appContracts
fromapp-contracts
is used to accessdev.tokens.evm
.appChains
fromapp-env
is used to get chain information based onchainId
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new imports. # Test: Search for the definitions of `appContracts` and `appChains` in the codebase. ast-grep --lang typescript --pattern $'const appContracts = $_' ast-grep --lang typescript --pattern $'const appChains = $_'Length of output: 603
Script:
#!/bin/bash # Description: Verify the usage of the new imports in the file. # Test: Search for the usage of `appContracts` and `appChains` in the specified file. rg 'appContracts' apps/indexer/src/modules/swaps/evm-transfers.ts -A 5 rg 'appChains' apps/indexer/src/modules/swaps/evm-transfers.ts -A 5Length of output: 1153
9-9
: Verify the correctness of the new initialization.Ensure that
appContracts.dev.tokens.evm
is the correct replacement for the previous token initialization.Verification successful
The initialization of the
tokens
variable withappContracts.dev.tokens.evm
is correct and consistent with the codebase.
- The
appContracts
object includesdevContracts
, which contains thetokens.evm
property.- The
evmTokens
is correctly defined as an array ofEVMTokenContractData
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new initialization. # Test: Search for the definition of `appContracts.dev.tokens.evm` in the codebase. ast-grep --lang typescript --pattern $'appContracts.dev.tokens.evm'Length of output: 183
Script:
#!/bin/bash # Description: Trace the definition and initialization of `appContracts` to verify its structure. # Search for the definition of `appContracts` ast-grep --lang typescript --pattern $'const appContracts = $_' -A 10Length of output: 379
Script:
#!/bin/bash # Description: Trace the definition and structure of `devContracts` to verify it includes `tokens.evm`. # Search for the definition of `devContracts` ast-grep --lang typescript --pattern $'const devContracts = $_' -A 10Length of output: 470
Script:
#!/bin/bash # Description: Trace the definition and structure of `evmTokens` to verify it matches `EVMTokenContractData[]`. # Search for the definition of `evmTokens` ast-grep --lang typescript --pattern $'const evmTokens = $_' -A 10Length of output: 67
Script:
#!/bin/bash # Description: Search for the definition of `evmTokens` across the entire codebase. # Search for `evmTokens` across the codebase rg 'evmTokens'Length of output: 306
17-17
: Verify the correctness of the new chain retrieval logic.Ensure that
appChains.dev.get(token.chainId)
is the correct replacement forsmartsaleChains.dev.get(token.chainId)
.Verification successful
Verify the definition and usage of
appChains
.Ensure that
appChains
is correctly defined and has the necessary structure to replacesmartsaleChains
.
Verify the structure returned by
createMapFromId
.Ensure that
createMapFromId
returns an object with aget
method, confirming the validity ofappChains.dev.get
.
Locate the definition or import of
createMapFromId
.Search for the term
createMapFromId
across the codebase to find its definition or import statement.
Verified the correctness of the new chain retrieval logic.
The
appChains.dev.get(token.chainId)
is a valid replacement forsmartsaleChains.dev.get(token.chainId)
asappChains
is correctly defined and structured.
- The
appChains
object has adev
property created usingcreateMapFromId
.- The
createMapFromId
function returns aMap<number, Chain>
, ensuring the presence of aget
method.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness of the new chain retrieval logic. # Test: Search for the definition of `appChains.dev.get` in the codebase. ast-grep --lang typescript --pattern $'appChains.dev.get($_)'Length of output: 268
Script:
#!/bin/bash # Description: Verify the definition and structure of `appChains`. # Test: Search for the definition of `appChains` in the codebase. ast-grep --lang typescript --pattern $'const appChains = $_'Length of output: 309
Script:
#!/bin/bash # Description: Verify the structure returned by `createMapFromId`. # Test: Search for the definition of `createMapFromId` in the codebase. ast-grep --lang typescript --pattern $'function createMapFromId($_) { $$$ }'Length of output: 77
Script:
#!/bin/bash # Description: Locate the definition or import of `createMapFromId`. # Test: Search for the term `createMapFromId` across the codebase. rg 'createMapFromId'Length of output: 249
apps/webapp/package.json (2)
18-18
: Verify the impact of the script removal.Ensure that the removal of the
vercel:install
script does not affect the deployment process.Verification successful
Let's correct the
rg
command and re-run the script to verify the impact of thevercel:install
script removal.
To ensure comprehensive verification, let's search for
vercel:install
in additional file types, including shell scripts and other relevant configuration files.
Let's correct the
rg
command to exclude the unrecognized file typeyml
and re-run the script to verify the impact of thevercel:install
script removal.
Verification successful.
The
vercel:install
script is not used anywhere in the codebase. Its removal does not affect the deployment process.
- No instances of
vercel:install
found in JSON, JS, TS, SH, or YAML files.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the impact of the script removal. # Test: Search for the usage of the `vercel:install` script in the codebase. rg --type json --type js --type ts --type tsx $'"vercel:install"'Length of output: 94
Script:
#!/bin/bash # Description: Verify the impact of the script removal. # Test: Search for the usage of the `vercel:install` script in the codebase. rg --type json --type js --type ts $'"vercel:install"'Length of output: 55
Script:
#!/bin/bash # Description: Verify the impact of the script removal. # Test: Search for the usage of the `vercel:install` script in the codebase, including shell scripts and other relevant configuration files. rg --type json --type js --type ts --type sh --type yaml --type yml $'"vercel:install"'Length of output: 116
Script:
#!/bin/bash # Description: Verify the impact of the script removal. # Test: Search for the usage of the `vercel:install` script in the codebase, including shell scripts and other relevant configuration files. rg --type json --type js --type ts --type sh --type yaml $'"vercel:install"'Length of output: 77
43-43
: Verify the correctness and compatibility of the new versions and dependencies.Ensure that the new versions and dependencies are correct and compatible with the rest of the codebase.
Also applies to: 51-51, 54-56, 74-74, 96-96
Verification successful
To verify the correctness and compatibility of the new versions and dependencies, we need to correct the
ast-grep
patterns and re-run the verification script.
To verify the correctness and compatibility of the new versions and dependencies, we will use
rg
to search for these dependencies in the codebase.
Verify the correctness and compatibility of the new versions and dependencies.
The
rg
search results confirm that the new versions and dependencies are correctly defined and used throughout the codebase. The following dependencies were found in multiple files, indicating their proper integration:
@rainbow-me/rainbowkit
@wagmi/connectors
app-contracts
app-env
app-lib
nookies
wagmi
These dependencies are imported and used in various TypeScript and JavaScript files, ensuring their compatibility with the codebase.
- apps/webapp/package.json: Lines 43-43, 51-51, 54-56, 74-74, 96-96
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the correctness and compatibility of the new versions and dependencies. # Test: Search for the definitions of the new versions and dependencies in the codebase. ast-grep --lang typescript --pattern $'@rainbow-me/rainbowkit' ast-grep --lang typescript --pattern $'@wagmi/connectors' ast-grep --lang typescript --pattern $'app-contracts' ast-grep --lang typescript --pattern $'app-env' ast-grep --lang typescript --pattern $'app-lib' ast-grep --lang typescript --pattern $'nookies' ast-grep --lang typescript --pattern $'wagmi'Length of output: 802
Script:
#!/bin/bash # Description: Verify the correctness and compatibility of the new versions and dependencies. # Corrected patterns for searching the definitions of the new versions and dependencies in the codebase. ast-grep --lang typescript --pattern '@rainbow-me/rainbowkit' ast-grep --lang typescript --pattern '@wagmi/connectors' ast-grep --lang typescript --pattern 'app-contracts' ast-grep --lang typescript --pattern 'app-env' ast-grep --lang typescript --pattern 'app-lib' ast-grep --lang typescript --pattern 'nookies' ast-grep --lang typescript --pattern 'wagmi'Length of output: 802
Script:
#!/bin/bash # Description: Verify the correctness and compatibility of the new versions and dependencies using ripgrep. # Search for the definitions of the new versions and dependencies in the codebase. rg '@rainbow-me/rainbowkit' rg '@wagmi/connectors' rg 'app-contracts' rg 'app-env' rg 'app-lib' rg 'nookies' rg 'wagmi'Length of output: 11801
packages/app-contracts/src/prod/tokens/usdt.ts (14)
Line range hint
5-16
:
LGTM!The contract object for Ethereum Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
17-28
:
LGTM!The contract object for Arbitrum Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
29-40
:
LGTM!The contract object for Avalanche Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
41-52
:
LGTM!The contract object for Binance Smart Chain Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
53-64
:
LGTM!The contract object for Fantom Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
65-76
:
LGTM!The contract object for Polygon Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
77-88
:
LGTM!The contract object for Optimism Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
89-100
:
LGTM!The contract object for Harmony Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
101-112
:
LGTM!The contract object for Moonbeam Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
113-124
:
LGTM!The contract object for Cronos Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
125-136
:
LGTM!The contract object for Kava Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
137-148
:
LGTM!The contract object for Metis Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
149-160
:
LGTM!The contract object for Gnosis Mainnet is correctly structured and the
chain
property is appropriately assigned.
Line range hint
161-172
:
LGTM!The contract object for Aurora Mainnet is correctly structured and the
chain
property is appropriately assigned.apps/indexer/src/modules/auction/auction-indexer.ts (2)
1-9
: LGTM!The import statements are correctly updated to include
http
andcreatePublicClient
from theviem
library.
17-21
: LGTM! But verify the client usage in the codebase.The client initialization is correctly implemented and integrated into the
startAuctionIndexer
function.However, ensure that the client is correctly used throughout the function.
Verification successful
The client usage is correctly implemented in the
startAuctionIndexer
function.The client is used to fetch the block number, retrieve logs, and watch events, which are appropriate operations for a blockchain client.
client.getBlockNumber()
client.getLogs()
client.watchEvent()
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the client in the `startAuctionIndexer` function. # Test: Search for the client usage. Expect: Correct usage of the client. rg --type javascript -A 5 $'client'Length of output: 69
Script:
#!/bin/bash # Description: Verify the usage of the client in the `startAuctionIndexer` function. # Find the file containing the `startAuctionIndexer` function file_path=$(fd auction-indexer.ts) # Search for the client usage within the file rg 'client' -A 5 "$file_path"Length of output: 1033
packages/app-contracts/src/dev/tokens/sepolia-usdt.ts (2)
1-2
: LGTM!The import path for
EVMTokenContractData
is correctly updated to reflect the new directory structure.
13-13
: LGTM!The
SepoliaUSDT
constant is correctly updated with the newchain
property set to thesepolia
object.packages/app-contracts/src/dev/tokens/testnet-usdt.ts (2)
1-2
: LGTM! Import changes improve modularity.The updated import path and the addition of
eosEvmTestnet
enhance modularity and correctly reference the necessary chain configuration.
13-13
: LGTM! Addition ofchain
property enhances clarity.The new
chain
property in theTestnetUSDT
object improves the clarity and functionality of the data structure by providing more context about the blockchain environment.packages/app-contracts/src/dev/tokens/testnet-mbots-prelaunch.ts (2)
1-2
: LGTM! Import changes improve modularity.The updated import path and the addition of
eosEvmTestnet
enhance modularity and correctly reference the necessary chain configuration.
13-13
: LGTM! Addition ofchain
property enhances clarity.The new
chain
property in theTestnetMBOTSPL
object improves the clarity and functionality of the data structure by providing more context about the blockchain environment.packages/app-contracts/src/dev/tokens/testnet-usd-cred.ts (2)
1-2
: LGTM! Import changes improve modularity.The updated import path and the addition of
eosEvmTestnet
enhance modularity and correctly reference the necessary chain configuration.
13-13
: LGTM! Addition ofchain
property enhances clarity.The new
chain
property in theTestnetUSDCred
object improves the clarity and functionality of the data structure by providing more context about the blockchain environment.packages/app-contracts/src/dev/auction/testnet-easy-auction.ts (3)
1-1
: Import statement forsepolia
looks good.The import path appears to be correct and necessary for the new
chain
property.
10-10
: Addition ofchain
property looks good.The
chain
property enhances the configuration by explicitly associating the auction with the Sepolia test network.
2-2
: Verify the updated import path forEVMContractData
.Ensure that the new path
../../types
correctly reflects the reorganization of the directory structure.Verification successful
The updated import path for
EVMContractData
is correct.The file
packages/app-contracts/src/types.ts
contains the definition ofEVMContractData
, and the import path../../types
correctly points to it.
packages/app-contracts/src/types.ts
:export interface EVMContractData extends ContractData {}
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the new import path for `EVMContractData`. # Test: Check if the file exists at the new path. Expect: The file should exist. fd 'EVMContractData.ts' --search-path 'packages/app-contracts/src/types'Length of output: 190
Script:
#!/bin/bash # Description: Locate the correct path for `EVMContractData.ts` in the repository. fd 'EVMContractData.ts'Length of output: 23
Script:
#!/bin/bash # Description: Search for the term `EVMContractData` within the repository to find its definition or references. rg 'EVMContractData'Length of output: 898
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files ignored due to path filters (1)
bun.lockb
is excluded by!**/bun.lockb
Files selected for processing (1)
- apps/webapp/package.json (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/webapp/package.json
Summary by Sourcery
This pull request introduces a multichain indexer to handle multiple blockchain networks. It refactors the contract exports for better organization, adds chain information to token contract data structures, and updates client creation logic to dynamically use the appropriate chain configuration. Additionally, outdated contract files were removed and replaced with updated versions.
Summary by CodeRabbit
New Features
@rainbow-me/rainbowkit
,@wagmi/connectors
, andwagmi
.Bug Fixes
Documentation
Chores