-
Notifications
You must be signed in to change notification settings - Fork 18
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
Zkevm integration #1635
Zkevm integration #1635
Conversation
Warning Rate limit exceeded@mohammadranjbarz has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 29 minutes and 11 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe updates span across various parts of the project, focusing on integrating new scan API keys, database migrations for network tokens and donated funds, environment configuration adjustments, and workflow enhancements. Significant additions include a new read-only PostgreSQL setup, configuration for new blockchain networks, enhanced project statistics, and new tests for donation services and resolving projects. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Workflow
participant GitHubSecrets
participant Database
participant ProjectService
participant DonationService
User->>Workflow: Trigger CI/CD Pipeline
Workflow->>GitHubSecrets: Retrieve Scan API Keys
Workflow->>Database: Apply Migrations
Workflow->>ProjectService: Update Project Information
Workflow->>DonationService: Sync Donations
Workflow->>User: Notify Success
Poem
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 Configration 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.
Actionable comments posted: 20
Outside diff range and nitpick comments (10)
src/orm.ts (2)
Line range hint
8-69
: Consider refactoring static-only classes to utility functions.The class
AppDataSource
contains only static members, which could be refactored into a set of utility functions for better maintainability and to adhere to best practices.
Line range hint
71-98
: Address static context confusion.The use of
this
in the static context ofCronDataSource
can be confusing. Consider using the class name directly to access static members.- if (!this.datasource) { + if (!CronDataSource.datasource) {src/utils/validators/graphqlQueryValidators.ts (1)
Line range hint
15-18
: Use regular expression literals for better performance and readability.Consider using regular expression literals instead of the RegExp constructor to improve performance and readability. This change avoids the need for double escaping and makes the expressions easier to understand and maintain.
- const filterDateRegex = new RegExp('^[0-9]{8} [0-9]{2}:[0-9]{2}:[0-9]{2}$'); + const filterDateRegex = /^[0-9]{8} [0-9]{2}:[0-9]{2}:[0-9]{2}$/; - const resourcePerDateRegex = new RegExp('((?:19|20)\\d\\d)-(0?[1-9]|1[012])-([12][0-9]|3[01]|0?[1-9])'); + const resourcePerDateRegex = /((?:19|20)\d\d)-(0?[1-9]|1[012])-([12][0-9]|3[01]|0?[1-9])/;src/server/adminJs/tabs/qfRoundTab.ts (2)
Line range hint
293-293
: Consider avoiding the use of thedelete
operator to improve performance.- delete request.payload[`sponsorsImgs.${i}`]; + request.payload[`sponsorsImgs.${i}`] = undefined;This change avoids potential performance issues associated with the
delete
operator in JavaScript.
Line range hint
297-298
: Utilize optional chaining to simplify the code and enhance readability.- if (request.payload.bannerBgImage && request.payload.bannerBgImage.path) + if (request.payload.bannerBgImage?.path)This change leverages optional chaining to make the code more concise and robust against null and undefined values.
src/services/recurringDonationService.ts (1)
Line range hint
149-162
: Theelse
clause is unnecessary and can be omitted to simplify the logic.- else if (tokenInDb) { + if (tokenInDb) {Removing the unnecessary
else
clause simplifies the control flow, making the code cleaner and easier to understand.Tools
Biome
[error] 221-222: Change to an optional chain. (lint/complexity/useOptionalChain)
Unsafe fix: Change to an optional chain.
src/entities/project.ts (2)
Line range hint
431-431
: Misuse ofthis
in a static context.Using
this
in a static context can lead to confusion and potential bugs. It's recommended to replacethis
with the class name to clearly indicate the static nature of the method.- this.createQueryBuilder('project') + Project.createQueryBuilder('project')
Line range hint
532-538
: Redundant else clause after a return statement.The
else
clause following thereturn
statement inmayUpdateStatus
method is unnecessary and can be omitted to improve code readability.- } else { - throw new Error( - i18n.__( - translationErrorMessagesKeys.YOU_DONT_HAVE_ACCESS_TO_DEACTIVATE_THIS_PROJECT, - ), - ); - } + throw new Error( + i18n.__( + translationErrorMessagesKeys.YOU_DONT_HAVE_ACCESS_TO_DEACTIVATE_THIS_PROJECT, + ), + );src/services/chains/index.test.ts (1)
Line range hint
93-93
: The literal value for the transaction amount will lose precision at runtime due to JavaScript's handling of floating-point numbers. Consider using a string or a library likebig.js
for precise decimal operations.- const amount = 4492.059297640078891631; + const amount = "4492.059297640078891631"; // Use string to maintain precisionTools
Biome
[error] 621-621: This number literal will lose precision at runtime. (lint/correctness/noPrecisionLoss)
The value at runtime will be 0.4535499088024773
test/testUtils.ts (1)
Line range hint
216-216
: Consider using optional chaining for improved safety.- const user = await User.findOne({ where: { id } }); + const user = await User.findOne({ where: { id } })?.firstName;This change ensures that the code does not throw an error if
User.findOne
returnsnull
, enhancing the robustness of your token generation logic.
src/resolvers/projectResolver.ts
Outdated
@Info() info: any, | ||
) { | ||
const fields = graphqlFields(info); | ||
|
||
let query = this.projectRepository | ||
.createQueryBuilder('project') | ||
.where(`project.id=:id`, { | ||
id, | ||
}) | ||
.leftJoinAndSelect('project.status', 'status') | ||
.leftJoinAndSelect( | ||
'project.categories', | ||
'categories', | ||
'categories.isActive = :isActive', | ||
{ isActive: true }, | ||
) | ||
.leftJoinAndSelect('categories.mainCategory', 'mainCategory') | ||
.leftJoinAndSelect('project.addresses', 'addresses') | ||
.leftJoinAndSelect('project.socialMedia', 'socialMedia') | ||
.leftJoinAndSelect('project.anchorContracts', 'anchor_contract_address') | ||
.leftJoinAndSelect('project.organization', 'organization') | ||
.leftJoin('project.adminUser', 'user') | ||
.addSelect(publicSelectionFields); // aliased selection | ||
query = ProjectResolver.addUserReaction(query, connectedWalletUserId, user); | ||
.leftJoinAndSelect('project.status', 'status'); | ||
|
||
if (fields.categories) { | ||
query = query | ||
.leftJoinAndSelect( | ||
'project.categories', | ||
'categories', | ||
'categories.isActive = :isActive', | ||
{ isActive: true }, | ||
) | ||
.leftJoinAndSelect('categories.mainCategory', 'mainCategory'); | ||
} | ||
if (fields.organization) { | ||
query = query.leftJoinAndSelect('project.organization', 'organization'); | ||
} | ||
if (fields.addresses) { | ||
query = query.leftJoinAndSelect('project.addresses', 'addresses'); | ||
} | ||
if (fields.socialMedia) { | ||
query = query.leftJoinAndSelect('project.socialMedia', 'socialMedia'); | ||
} | ||
if (fields.anchorContracts) { | ||
query = query.leftJoinAndSelect( | ||
'project.anchorContracts', | ||
'anchor_contract_address', | ||
); | ||
} | ||
if (fields.adminUser) { | ||
const adminUserFields = Object.keys(fields.adminUser).map( | ||
field => `user.${field}`, | ||
); | ||
const filterByPublicFields = publicSelectionFields.filter(field => | ||
adminUserFields.includes(field), | ||
); | ||
query = query | ||
.leftJoin('project.adminUser', 'user') | ||
.addSelect( | ||
filterByPublicFields.length > 0 | ||
? filterByPublicFields | ||
: publicSelectionFields, | ||
); // aliased selection | ||
} | ||
if (fields.reaction) { | ||
query = ProjectResolver.addUserReaction( | ||
query, | ||
connectedWalletUserId, | ||
user, | ||
); | ||
} | ||
|
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.
Optimize the query construction by directly using field selections.
Consider refactoring the conditional blocks that add joins and selects based on the fields requested. This can be optimized by mapping fields to their respective query modifications in a dictionary or using a more structured approach to build the query based on requested fields.
Tools
Biome
[error] 835-835: Decorators are not valid here. (parse)
Decorators are only valid on class declarations, class expressions, and class methods.
You can enable parameter decorators by setting theunsafeParameterDecoratorsEnabled
option totrue
in your configuration file.
src/resolvers/projectResolver.ts
Outdated
qb.where('project.title %> :searchTerm ', { | ||
searchTerm, | ||
}) | ||
.orWhere('project.description % :searchTerm ', { | ||
.orWhere('project.description %> :searchTerm ', { | ||
searchTerm, | ||
}) | ||
.orWhere('project.impactLocation % :searchTerm', { | ||
.orWhere('project.impactLocation %> :searchTerm', { |
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.
Refactor the search query to use proper SQL syntax for similarity.
- qb.where('project.title %> :searchTerm ', {
- searchTerm,
- })
- .orWhere('project.description %> :searchTerm ', {
- searchTerm,
- })
- .orWhere('project.impactLocation %> :searchTerm', {
- searchTerm,
- });
+ qb.where('project.title ILIKE :searchTerm', {
+ searchTerm: `%${searchTerm}%`,
+ })
+ .orWhere('project.description ILIKE :searchTerm', {
+ searchTerm: `%${searchTerm}%`,
+ })
+ .orWhere('project.impactLocation ILIKE :searchTerm', {
+ searchTerm: `%${searchTerm}%`,
+ });
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
qb.where('project.title %> :searchTerm ', { | |
searchTerm, | |
}) | |
.orWhere('project.description % :searchTerm ', { | |
.orWhere('project.description %> :searchTerm ', { | |
searchTerm, | |
}) | |
.orWhere('project.impactLocation % :searchTerm', { | |
.orWhere('project.impactLocation %> :searchTerm', { | |
qb.where('project.title ILIKE :searchTerm', { | |
searchTerm: `%${searchTerm}%`, | |
}) | |
.orWhere('project.description ILIKE :searchTerm', { | |
searchTerm: `%${searchTerm}%`, | |
}) | |
.orWhere('project.impactLocation ILIKE :searchTerm', { | |
searchTerm: `%${searchTerm}%`, | |
}); |
test/pre-test-scripts.ts
Outdated
for (const token of SEED_DATA.TOKENS.base_mainnet) { | ||
const tokenData = { | ||
...token, | ||
networkId: NETWORK_IDS.BASE_MAINNET, | ||
isGivbackEligible: true, | ||
}; | ||
if (token.symbol === 'GIV') { | ||
// TODO I'm not sure whether we support GIV or not | ||
(tokenData as any).order = 1; | ||
} else if (token.symbol === 'ETH') { | ||
(tokenData as any).order = 2; | ||
} | ||
await Token.create(tokenData as Token).save(); | ||
} | ||
for (const token of SEED_DATA.TOKENS.base_sepolia) { | ||
const tokenData = { | ||
...token, | ||
networkId: NETWORK_IDS.BASE_SEPOLIA, | ||
isGivbackEligible: true, | ||
}; | ||
if (token.symbol === 'GIV') { | ||
// TODO I'm not sure whether we support GIV or not | ||
(tokenData as any).order = 1; | ||
} else if (token.symbol === 'ETH') { | ||
(tokenData as any).order = 2; | ||
} | ||
await Token.create(tokenData as Token).save(); | ||
} | ||
for (const token of SEED_DATA.TOKENS.zkevm_mainnet) { | ||
const tokenData = { | ||
...token, | ||
networkId: NETWORK_IDS.ZKEVM_MAINNET, | ||
isGivbackEligible: true, | ||
}; | ||
if (token.symbol === 'GIV') { | ||
// TODO I'm not sure whether we support GIV or not | ||
(tokenData as any).order = 1; | ||
} else if (token.symbol === 'ETH') { | ||
(tokenData as any).order = 2; | ||
} | ||
await Token.create(tokenData as Token).save(); | ||
} | ||
for (const token of SEED_DATA.TOKENS.zkevm_cardano) { | ||
const tokenData = { | ||
...token, | ||
networkId: NETWORK_IDS.ZKEVM_CARDONA, | ||
isGivbackEligible: true, | ||
}; | ||
if (token.symbol === 'GIV') { | ||
// TODO I'm not sure whether we support GIV or not | ||
(tokenData as any).order = 1; | ||
} else if (token.symbol === 'ETH') { | ||
(tokenData as any).order = 2; | ||
} | ||
await Token.create(tokenData as Token).save(); | ||
} |
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.
The repeated TODO
comments about uncertainty regarding GIV token support should be resolved.
Please verify and update the token support status for GIV in the respective network configurations. It's crucial to maintain accurate and clear documentation and code comments to avoid confusion and ensure the codebase is up-to-date with the actual functionalities.
config/example.env
Outdated
BASE_SCAN_API_URL=https://api.basescan.org/api | ||
BASE_SCAN_API_KEY=0000000000000000000000000000000000 | ||
BASE_SEPOLIA_SCAN_API_URL=https://api-sepolia.basescan.org/api | ||
BASE_SEPOLIA_SCAN_API_KEY=0000000000000000000000000000000000 | ||
|
||
# BASE MAINNET | ||
BASE_MAINNET_NODE_HTTP_URL= | ||
|
||
# BASE SEPOLIA | ||
BASE_SEPOLIA_NODE_HTTP_URL= | ||
|
||
|
||
ZKEVM_MAINNET_SCAN_API_URL=https://api-zkevm.polygonscan.com/api | ||
ZKEVM_MAINET_SCAN_API_KEY=0000000000000000000000000000000000 | ||
ZKEVM_CARDONA_SCAN_API_URL=https://api-cardona-zkevm.polygonscan.com/api | ||
ZKEVM_CARDONA_SCAN_API_KEY=0000000000000000000000000000000000 | ||
|
||
# ZKEVM MAINNET we should fill it as Infura doesnt support polygon zkevm | ||
ZKEVM_MAINNET_NODE_HTTP_URL= | ||
|
||
# ZKEVM CARDONA we should fill it as Infura doesnt support polygon zkevm | ||
ZKEVM_CARDONA_NODE_HTTP_URL= |
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.
Ensure that API keys are securely managed and not hardcoded in environment files for production.
Consider using environment variables for API keys to enhance security. This is critical especially for production environments where sensitive data exposure can lead to significant vulnerabilities.
assert.equal(transactionInfo.currency, 'ETH'); | ||
assert.equal(transactionInfo.amount, amount); | ||
}); | ||
|
||
it('should return transaction detail for OP token transfer on optimistic', async () => { | ||
// https://optimistic.etherscan.io/tx/0xf11be189d967831bb8a76656882eeeac944a799bd222acbd556f2156fdc02db4 | ||
const amount = 0.453549908802477308; |
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.
Similar to the previous comment, the amount here will lose precision at runtime. It's advisable to handle such values as strings to maintain accuracy.
- const amount = 0.453549908802477308;
+ const amount = "0.453549908802477308"; // Use string to maintain precision
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
const amount = 0.453549908802477308; | |
const amount = "0.453549908802477308"; // Use string to maintain precision |
Tools
Biome
[error] 621-621: This number literal will lose precision at runtime. (lint/correctness/noPrecisionLoss)
The value at runtime will be 0.4535499088024773
export const getQfRoundHistoryMatchingValueUsd = async ( | ||
projectId: number, | ||
): Promise<number> => { | ||
try { | ||
logger.debug('Executing query to fetch matching fund values'); | ||
const result = await QfRoundHistory.createQueryBuilder('q') | ||
.select('COALESCE(SUM(q."matchingFundPriceUsd"),0)', 'total') | ||
.where('q.projectId = :projectId', { projectId }) | ||
.getRawOne(); | ||
|
||
return result.total; | ||
} catch (e) { | ||
logger.error('Error in getQfRoundHistoryMatchingValueUsd', e); | ||
throw e; | ||
} | ||
}; |
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.
Ensure exception handling is consistent and informative.
The error logging in getQfRoundHistoryMatchingValueUsd
could be more informative by including the projectId
in the error message. This would help in debugging issues related to specific projects.
- logger.error('Error in getQfRoundHistoryMatchingValueUsd', e);
+ logger.error(`Error in getQfRoundHistoryMatchingValueUsd for project ID ${projectId}:`, e);
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const getQfRoundHistoryMatchingValueUsd = async ( | |
projectId: number, | |
): Promise<number> => { | |
try { | |
logger.debug('Executing query to fetch matching fund values'); | |
const result = await QfRoundHistory.createQueryBuilder('q') | |
.select('COALESCE(SUM(q."matchingFundPriceUsd"),0)', 'total') | |
.where('q.projectId = :projectId', { projectId }) | |
.getRawOne(); | |
return result.total; | |
} catch (e) { | |
logger.error('Error in getQfRoundHistoryMatchingValueUsd', e); | |
throw e; | |
} | |
}; | |
export const getQfRoundHistoryMatchingValueUsd = async ( | |
projectId: number, | |
): Promise<number> => { | |
try { | |
logger.debug('Executing query to fetch matching fund values'); | |
const result = await QfRoundHistory.createQueryBuilder('q') | |
.select('COALESCE(SUM(q."matchingFundPriceUsd"),0)', 'total') | |
.where('q.projectId = :projectId', { projectId }) | |
.getRawOne(); | |
return result.total; | |
} catch (e) { | |
logger.error(`Error in getQfRoundHistoryMatchingValueUsd for project ID ${projectId}:`, e); | |
throw e; | |
} | |
}; |
export const findAllQfRounds = async ({ | ||
slug, | ||
activeOnly, | ||
}: QfRoundsArgs): Promise<QfRound[]> => { | ||
const query = QfRound.createQueryBuilder('qf_round').addOrderBy( | ||
'qf_round.id', | ||
'DESC', | ||
); | ||
if (slug) { | ||
query.where('slug = :slug', { slug }); | ||
} | ||
if (activeOnly) { | ||
query.andWhere('"isActive" = true'); | ||
} | ||
if (slug || activeOnly) { | ||
const res = await query.getOne(); | ||
return res ? [res] : []; | ||
} | ||
return query.getMany(); |
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.
Refactor the function for clarity and potential performance improvements.
The function findAllQfRounds
could be refactored for better clarity and potential performance improvements. Consider using a single query with conditional logic inside the SQL instead of separate if conditions in code, which can help in reducing the overhead of multiple conditional checks and make the function more concise.
- if (slug) {
- query.where('slug = :slug', { slug });
- }
- if (activeOnly) {
- query.andWhere('"isActive" = true');
- }
- if (slug || activeOnly) {
- const res = await query.getOne();
- return res ? [res] : [];
- }
+ query.where('1=1');
+ if (slug) query.andWhere('slug = :slug', { slug });
+ if (activeOnly) query.andWhere('"isActive" = true');
+ return await query.getMany();
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
export const findAllQfRounds = async ({ | |
slug, | |
activeOnly, | |
}: QfRoundsArgs): Promise<QfRound[]> => { | |
const query = QfRound.createQueryBuilder('qf_round').addOrderBy( | |
'qf_round.id', | |
'DESC', | |
); | |
if (slug) { | |
query.where('slug = :slug', { slug }); | |
} | |
if (activeOnly) { | |
query.andWhere('"isActive" = true'); | |
} | |
if (slug || activeOnly) { | |
const res = await query.getOne(); | |
return res ? [res] : []; | |
} | |
return query.getMany(); | |
export const findAllQfRounds = async ({ | |
slug, | |
activeOnly, | |
}: QfRoundsArgs): Promise<QfRound[]> => { | |
const query = QfRound.createQueryBuilder('qf_round').addOrderBy( | |
'qf_round.id', | |
'DESC', | |
); | |
query.where('1=1'); | |
if (slug) query.andWhere('slug = :slug', { slug }); | |
if (activeOnly) query.andWhere('"isActive" = true'); | |
return await query.getMany(); |
config/test.env
Outdated
BASE_SCAN_API_URL=https://api.basescan.org/api | ||
BASE_SCAN_API_KEY=0000000000000000000000000000000000 | ||
BASE_SEPOLIA_SCAN_API_URL=https://api-sepolia.basescan.org/api | ||
BASE_SEPOLIA_SCAN_API_KEY=0000000000000000000000000000000000 | ||
|
||
GNOSISSCAN_API_URL=https://api.gnosisscan.io/api |
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.
Ensure API keys and URLs are managed securely.
The addition of BASE and BASE_SEPOLIA API keys and URLs is noted. It's crucial to ensure these keys are managed securely and not exposed in environments where they could be compromised. Consider using environment variables or secret management tools to handle these sensitive values.
src/services/donationService.ts
Outdated
@@ -44,6 +44,7 @@ import { getTransactionInfoFromNetwork } from './chains'; | |||
import { getEvmTransactionTimestamp } from './chains/evm/transactionService'; | |||
import { getOrttoPersonAttributes } from '../adapters/notifications/NotificationCenterAdapter'; | |||
import { CustomToken, getTokenPrice } from './priceService'; | |||
import { updateProjectStatistics } from './projectService'; |
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.
TODO comment about adding a transaction link is still present.
Consider addressing this TODO or removing it if it's no longer relevant.
src/services/donationService.ts
Outdated
await insertDonationsFromQfRoundHistory(); | ||
await refreshProjectEstimatedMatchingView(); | ||
await refreshProjectDonationSummaryView(); | ||
|
||
await updateProjectStatistics(donation.projectId); | ||
|
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.
Consider refining the error handling in syncDonationStatusWithBlockchainNetwork
to provide more specific feedback and actions based on different types of blockchain-related errors.
Add error handling or transaction management in insertDonationsFromQfRoundHistory
to ensure data consistency and reliability, especially given the complexity of the SQL operations involved.
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.
I just have 2 comments, overall the code LGTM!
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: 3
Outside diff range and nitpick comments (3)
src/entities/project.ts (2)
Line range hint
431-431
: Refactor the use ofthis
in static context to use the class name directly.- this.createQueryBuilder('project') + Project.createQueryBuilder('project')
Line range hint
532-538
: Remove unnecessaryelse
clause to simplify control flow.- else { - throw new Error( - i18n.__( - translationErrorMessagesKeys.YOU_DONT_HAVE_ACCESS_TO_DEACTIVATE_THIS_PROJECT, - ), - ); - }src/resolvers/projectResolver.ts (1)
Line range hint
653-653
: Incorrect usage of decorators in a non-class context.The static analysis tool has flagged multiple lines where decorators are used incorrectly. Decorators in TypeScript are only valid on class declarations, class expressions, and class methods. You may need to enable parameter decorators by setting the
unsafeParameterDecoratorsEnabled
option totrue
in your configuration file, or review the placement of these decorators.Also applies to: 655-655, 689-689, 705-705, 719-719, 795-795, 797-797, 831-831, 832-832, 834-834, 835-835, 910-910, 911-911, 913-913, 914-914, 1047-1047, 1048-1048, 1049-1049, 1208-1208, 1209-1209
@@ -1065,6 +1065,126 @@ function allProjectsTestCases() { | |||
); | |||
}); | |||
|
|||
/////// Beginning of ZKEVM filter test | |||
it.only('should return projects, filter by accept donation on zkevm', async () => { |
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.
Remove the focus from the test to ensure all tests are executed.
The it.only
method is used, which restricts the test runner to this test case only. This is typically used during development for debugging but should be removed in production code to ensure all tests are executed.
- it.only('should return projects, filter by accept donation on zkevm', async () => {
+ it('should return projects, filter by accept donation on zkevm', async () => {
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
it.only('should return projects, filter by accept donation on zkevm', async () => { | |
it('should return projects, filter by accept donation on zkevm', async () => { |
Tools
Biome
[error] 1069-1069: Don't focus the test. (lint/suspicious/noFocusedTests)
The 'only' method is often used for debugging or during implementation. It should be removed before deploying to production.
Consider removing 'only' to ensure all tests are executed.
Unsafe fix: Remove focus from test.
ZKEVM_MAINNET_SCAN_API_URL=https://api-zkevm.polygonscan.com/api | ||
ZKEVM_MAINET_SCAN_API_KEY=0000000000000000000000000000000000 | ||
ZKEVM_CARDONA_SCAN_API_URL=https://api-cardona-zkevm.polygonscan.com/api | ||
ZKEVM_CARDONA_SCAN_API_KEY=0000000000000000000000000000000000 | ||
# ZKEVM MAINNET we should fill it as Infura doesnt support polygon zkevm, I found this rpc link from https://chainlist.org/chain/1101 | ||
ZKEVM_MAINNET_NODE_HTTP_URL=https://polygon-zkevm.drpc.org | ||
|
||
# ZKEVM CARDONA we should fill it as Infura doesnt support polygon zkevm, I found this rpc link from https://chainlist.org/chain/2442 | ||
ZKEVM_CARDONA_NODE_HTTP_URL=https://rpc.cardona.zkevm-rpc.com |
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.
Tip
Codebase Verification
Ensure the security of API keys and URLs, especially for new ZKEVM network settings.
- The API key
0000000000000000000000000000000000
and addresses are found in multiple files, including test and migration scripts. These should be reviewed to avoid exposure in production environments.test/testUtils.ts
src/provider.ts
src/workers/draftDonationMatchWorker.test.ts
src/types/etherscan.ts
src/services/Idriss/contractDonations.ts
src/services/chains/evm/draftDonationService.test.ts
src/services/onramper/webhookHandler.test.ts
src/services/onramper/donationService.ts
src/adapters/superFluid/superFluidMockAdapter.ts
src/adapters/superFluid/superFluidAdapter.ts
migration/1679383446020-addOptimisticNativeToken.ts
migration/1709204568033-addCoingeckoId.ts
migration/1716549958362-add_donations_mannually_to_db.ts
migration/data/seedTokens.ts
README.md
Please ensure these keys and addresses are securely managed and not exposed in the public repository.
Analysis chain
Ensure the security of API keys and URLs, especially for new ZKEVM network settings.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify that the API keys and URLs are not exposed in public repositories.
# Test: Search for the API keys in the entire repository. Expect: No occurrences outside of secure contexts.
rg --type all '0000000000000000000000000000000000'
Length of output: 7868
* Change for Project Ownship * i have fixed the issue for transfer project ownership in adminBro and fixed for eslint * Revert "651 run migration files as js file (#1604)" This reverts commit 5140a93. * Update staging-pipeline.yml * Update staging-pipeline.yml * Update staging-pipeline.yml * Create funding.json * Fix issue in db migration scripts (#1608) * Change commands to use typeorm cli * Select migration files based on node env * Fix eslint errors on staging branch * add cache to mainCategories query * add cache to findQfRounds query * add cache to findQfRounds query * fix MainCategory test case * removed unnecessary comments and changed email to admin id * fix: filter unique donors based on passport score and knownAsSybilAddress * set cache duration as env var * allow refresh concurrently of materialized views (#1611) * add logger to updateProjectStatistics * fix: add new field isDataAnalysisDone to QF Round * fix: refactor condition where data analysis shouldn't be edited * fix: issue while listing recurrring donations * revert concurrent flag for failed views * fix: requested change (using subquery to get unique donors count) * add getUserAnalysisScore * revert all materialized views concurrent flag * reactivate concurrent flag for all materialized views * move refresh estimated matching view last * Add some error logs and complete some error messages (#1623) * move refreshProjectEstimatedMatchingView * fix: retrieve correct usd value of donations for an archived QF round * skip if there's a wrong tx hash * skip if there's a wrong error in insertDonationsFromQfRoundHistory * Get giv price from coingecko instead of subgraph (#1621) * Get giv price from coingecko instead of subgraph related to Giveth/giveth-dapps-v2#4168 * Fix linter errors * Remove poignArt stuff * remove unused logs * remove unused logs * force findActiveQfRound to use read replica * rewrite updateProjectStatistics * move refreshProjectEstimatedMatchingView * optimize updateProjectStatistics * ProjectEstimatedMatchingView V3 * resolve ProjectEstimatedMatchingView V2 errors * update donationRepository.test.ts * update donationRepository.ts * update project.ts * update ProjectEstimatedMatchingView.ts * update projectRepository.ts * update projectService.ts with new estimated matching structure * update qfRoundHistory.ts with new estimated matching structure * update qfRoundRepository.test.ts with new estimated matching structure * update qfRoundRepository.ts with new estimated matching structure * update qfRoundResolver.ts with new estimated matching structure * update qfUtils.ts with new estimated matching structure * add verified status * add minimumPassportScore to getProjectQfRoundStats * add check for begin and end date to getProjectQfRoundStats * remove refreshProjectEstimatedMatchingView from tests * fix qfRoundRepository.test.ts tests * remove qfRound stats from projects when added or removed from QF round * update added projects only * update added projects only * optimize refreshProjectEstimatedMatchingView * set NODE_ENV for refreshProjectEstimatedMatchingView * merge getQfRoundUniqueDonors and getQfRoundTotalDonations * fix adding valueUsd to query * add userQfRoundModelScore * remove minimumPassportScore from getProjectQfRoundStats * remove user join from getProjectQfRoundStats * remove insertDonationsFromQfRoundHistory from syncDonationStatusWithBlockchainNetwork * enable replica * projectVerificationRepository.ts replace .save with update method * projectVerificationRepository.ts replace .save with update method * remove unused fields from logs * remove user from badge warning * optimize projectsWithoutUpdateAfterTimeFrame * Zkevm integration (#1635) * Integrate with zkevm chain related to #1617 #1615 #1618 #1619 #1614 #1620 * Add coingeckoId for wbtc zkevm token * Fix lint errors * Remove duplicate keys in provider.ts * Fix AAve token on zkevm chain * fix merge conflicts * add projectId to projectRepository.ts * remove unnecessary updatedAt * fix: get unique_donors based on user wallet address not added to sybil table * add cache to findActiveQfRound * Add on conflicrt do nothing for add zkevm tokens * Fix add polygon zkevm token migration * remove updateTotalDonationsOfProject from migrations * replace updateTotalDonationsOfProject with updateProjectStatistics * replace updateTotalDonationsOfProject with updateProjectStatistics * remove sumDonationValueUsd from project * do email verification on project verification form through Ortto * add solana to available networks for qfround * remove knownAsSybilAddress from user * wrong query cache in some functions * User Story - Rejected project owner reason * use networkId instead of optimism-only flag (#1653) * Use networkId instead of optimismOnly flag * Update graphql queries for tests * fatal errors (#1640) * change critical error logs to fatal * add fatal log for donation verification failure with time threshold * added on final step for verification project data * Replace ortto External Embedded Webform for Onboarding guide * fix: findArchivedQfRounds query * fix subscribeOnboarding args * change output to boolean * WIP: add API key to request & add fetch MBD score record from DB * fixed last step verification * fixed typo * WIP: add field to user that holds user MBD score for an active round * disable DB Replica on staging * fetch data uere with the score from MBD & remove non needed query * Fix some test cases about stable coin donations * fix: issue with adminJs authentication when user has hash as null * "Last Update" on project card is not correct * Fix some test cases about stable coin donations (#1665) * Fix some test cases about stable coin donations * Fix few test cases of projectResolver * Fix few test cases of projectResolver * Fix test cases of project resolver * Fix donationResolver test cases * Bump follow-redirects from 1.15.5 to 1.15.6 (#1414) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.15.5...v1.15.6) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump @solana/web3.js from 1.87.6 to 1.87.7 (#1492) Bumps [@solana/web3.js](https://github.com/solana-labs/solana-web3.js) from 1.87.6 to 1.87.7. - [Release notes](https://github.com/solana-labs/solana-web3.js/releases) - [Commits](https://github.com/solana-labs/solana-web3.js/commits) --- updated-dependencies: - dependency-name: "@solana/web3.js" dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump express from 4.18.2 to 4.19.2 (#1430) Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](expressjs/express@4.18.2...4.19.2) --- updated-dependencies: - dependency-name: express dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump braces from 3.0.2 to 3.0.3 (#1629) Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](micromatch/braces@3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump undici from 5.28.3 to 5.28.4 (#1454) Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4. - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](nodejs/undici@v5.28.3...v5.28.4) --- updated-dependencies: - dependency-name: undici dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * fix types * Updated project verification form resolver test fixed previos 3 test with terms and condition update and added one last step test when user complete form and clicked "FINISH" button * fix extracting last comment * get donation to giveth with donation box analytics (#1661) * Add a method for finding relevant donations to the donationRepository.ts * Add a method for calculating donations metrics to the donationService.ts * Add a gql resolver for donations metrics to the donationResolver.ts * Add unit test for gql query resolver * Fix division by zero issue * times 100 average percentage to represent percent * add useDonationBox field to donation and draftDonation * fill useDonationBox field with correct data in migrations * Change donationMetrics endpoint based on change in data schema * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add false removed imports * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix tests based on changes * fix tests * send useDonationBox as last arg and make it optional * add relevant donation tx hash to donation creation flow * calculate related donations based on relevant donation tx hash * add unit tests * update unit test * fix bug * fix bug in donation repository and tests are pass * Clear All donations after donation metrics test cases * Add new function for deleting project from db and use it to don't affect other test cases * comment new test cases to ensure bug is related to that or not * Clear donations after tests * Comments new test cases in donationRepository.test.ts * uncomment tests and Clean up test effects on DB * Remove project addresses too * Add a new method to testUtils.ts for removing project from db by id * change donation dates to now * Remove clear donations sections * Change update count to a bigger number to pass test --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add test for fetching and refreshing qfroundscore for model * revert changes on package,json * revert changes on package,json * fix migration error * fix migration error * fix: turn minimumValidUsdValue to nullable when querying * remove updatedAt from projects tab * Remove old donation and add new ones (#1674) * remove verified from projects tab edit menu * remove verified from projectVerificationTab edit menu * fix total donations query * fix archived_round totals * fix latestUpdate column if not exists * fix join for totals * fix total donations with subquery * fix add some error handling and remove commented interface * fix: resolve conflict * fix: resolve conflict * fix USD value not showing * fix: convert timestap retrieved from RPC provider to milisconds * fix: donation test cases (milliseconds) * fix: donation test cases (milliseconds) * Endaoment integration (#1663) * Remove giving block projects that don't have any donation related to #1599 * Add needed fields to organization entity for endaoment projects related to Giveth/Roadmap#111 * Remove giving-blocks stuff and endaoment integration thing * Add categories to endaoment projects * Fix test cases * Fix some test cases about stable coin donations * Add endaoment categories * Fix remove giving-blocks projects migration * Add default image for endaoment projects * Fix linter * Fix add useDonationBox to draft_donation migration * Fix migration of adding useDonationBox to donation * Fix eslint error * Fix disabling recurring donations for endaoment projects * Change givingBlock organization to endaoment in pre-test script * Remove test case of accepted tokens of giving blocks * Relate all base, optimism and mainnet tokens to endaoment organization related to #1626 * Fix migration query syntax * fix: donation test cases (milliseconds) * fix: donation test cases (milliseconds) * Modify ormconfig for running migrations * Run ts files for migrations * Make isRecipient of project_addresses of endaoment project true * Fix type error of one of endaoment projects * add test case for filling prices * Modify add endaoment organization migration to pass the tests * fix: convert minimumUserAnalysisScore to Float on qfRound entity * fix: revert migration changes * add log for filling prices * feat: add github on project socialmedia enum * Merge master to staging (#1696) * Release relevant donations (#1687) * get donation to giveth with donation box analytics (#1661) * Add a method for finding relevant donations to the donationRepository.ts * Add a method for calculating donations metrics to the donationService.ts * Add a gql resolver for donations metrics to the donationResolver.ts * Add unit test for gql query resolver * Fix division by zero issue * times 100 average percentage to represent percent * add useDonationBox field to donation and draftDonation * fill useDonationBox field with correct data in migrations * Change donationMetrics endpoint based on change in data schema * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add false removed imports * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix tests based on changes * fix tests * send useDonationBox as last arg and make it optional * add relevant donation tx hash to donation creation flow * calculate related donations based on relevant donation tx hash * add unit tests * update unit test * fix bug * fix bug in donation repository and tests are pass * Clear All donations after donation metrics test cases * Add new function for deleting project from db and use it to don't affect other test cases * comment new test cases to ensure bug is related to that or not * Clear donations after tests * Comments new test cases in donationRepository.test.ts * uncomment tests and Clean up test effects on DB * Remove project addresses too * Add a new method to testUtils.ts for removing project from db by id * change donation dates to now * Remove clear donations sections * Change update count to a bigger number to pass test --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Remove old donation and add new ones (#1674) * Remove unused variable --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * release analytics dashboard dropdown menu related chagnes (#1686) * use networkId instead of optimism-only flag (#1653) * Use networkId instead of optimismOnly flag * Update graphql queries for tests * Change network id to float in gql schema to fix unit tests --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Add organization filter to projectsTab.ts in admin panel related to #1599 (comment) * Fill description summary for endaoment projects related to #1599 (comment) * Fix eslint errors * Replace special characters of slugs of endaoment projects with - related to Giveth/giveth-dapps-v2#4280 (comment) * Fix eslint errors * return hardcoded as user MBD score * rename qfRound minimumUserAnalysisScore field * Resolve conflicts (#1703) * Release relevant donations (#1687) * get donation to giveth with donation box analytics (#1661) * Add a method for finding relevant donations to the donationRepository.ts * Add a method for calculating donations metrics to the donationService.ts * Add a gql resolver for donations metrics to the donationResolver.ts * Add unit test for gql query resolver * Fix division by zero issue * times 100 average percentage to represent percent * add useDonationBox field to donation and draftDonation * fill useDonationBox field with correct data in migrations * Change donationMetrics endpoint based on change in data schema * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add false removed imports * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix tests based on changes * fix tests * send useDonationBox as last arg and make it optional * add relevant donation tx hash to donation creation flow * calculate related donations based on relevant donation tx hash * add unit tests * update unit test * fix bug * fix bug in donation repository and tests are pass * Clear All donations after donation metrics test cases * Add new function for deleting project from db and use it to don't affect other test cases * comment new test cases to ensure bug is related to that or not * Clear donations after tests * Comments new test cases in donationRepository.test.ts * uncomment tests and Clean up test effects on DB * Remove project addresses too * Add a new method to testUtils.ts for removing project from db by id * change donation dates to now * Remove clear donations sections * Change update count to a bigger number to pass test --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Remove old donation and add new ones (#1674) * Remove unused variable --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * release analytics dashboard dropdown menu related chagnes (#1686) * use networkId instead of optimism-only flag (#1653) * Use networkId instead of optimismOnly flag * Update graphql queries for tests * Change network id to float in gql schema to fix unit tests --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Modify endaoment categories and relate them to projects related to #1664 (comment) * Add canUseOnFrontend to category so can show a category but don't allow users to select them when create/update projects related to #1685 * Fix project resolver test case * fix CPU spikes * add new test case for project update * fix test case * Fix add endaoment integration * Filter isActive and canUseOnFrontend categories in projectResolver * Filter isActive and canUseOnFrontend categories in projectResolver * Return canUseOnFrontend in main category list * Comment migrations related to endaoment (#1706) * 1.24.0 * Test ci/cd * Fix build problem --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Lovel George <[email protected]> Co-authored-by: Lovel George <[email protected]> Co-authored-by: Ramin <[email protected]> Co-authored-by: Moe Shehab <[email protected]> Co-authored-by: Mitch <[email protected]> Co-authored-by: ali ebrahimi <[email protected]> Co-authored-by: Meriem-BM <[email protected]> Co-authored-by: CarlosQ96 <[email protected]> Co-authored-by: Carlos <[email protected]> Co-authored-by: kkatusic <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: Reshzera <[email protected]>
* update qfRoundResolver.ts with new estimated matching structure * update qfUtils.ts with new estimated matching structure * add verified status * add minimumPassportScore to getProjectQfRoundStats * add check for begin and end date to getProjectQfRoundStats * remove refreshProjectEstimatedMatchingView from tests * fix qfRoundRepository.test.ts tests * remove qfRound stats from projects when added or removed from QF round * update added projects only * update added projects only * optimize refreshProjectEstimatedMatchingView * set NODE_ENV for refreshProjectEstimatedMatchingView * merge getQfRoundUniqueDonors and getQfRoundTotalDonations * fix adding valueUsd to query * add userQfRoundModelScore * remove minimumPassportScore from getProjectQfRoundStats * remove user join from getProjectQfRoundStats * remove insertDonationsFromQfRoundHistory from syncDonationStatusWithBlockchainNetwork * enable replica * projectVerificationRepository.ts replace .save with update method * projectVerificationRepository.ts replace .save with update method * remove unused fields from logs * remove user from badge warning * optimize projectsWithoutUpdateAfterTimeFrame * Zkevm integration (#1635) * Integrate with zkevm chain related to #1617 #1615 #1618 #1619 #1614 #1620 * Add coingeckoId for wbtc zkevm token * Fix lint errors * Remove duplicate keys in provider.ts * Fix AAve token on zkevm chain * fix merge conflicts * add projectId to projectRepository.ts * remove unnecessary updatedAt * fix: get unique_donors based on user wallet address not added to sybil table * add cache to findActiveQfRound * Add on conflicrt do nothing for add zkevm tokens * Fix add polygon zkevm token migration * remove updateTotalDonationsOfProject from migrations * replace updateTotalDonationsOfProject with updateProjectStatistics * replace updateTotalDonationsOfProject with updateProjectStatistics * remove sumDonationValueUsd from project * do email verification on project verification form through Ortto * add solana to available networks for qfround * remove knownAsSybilAddress from user * wrong query cache in some functions * User Story - Rejected project owner reason * use networkId instead of optimism-only flag (#1653) * Use networkId instead of optimismOnly flag * Update graphql queries for tests * fatal errors (#1640) * change critical error logs to fatal * add fatal log for donation verification failure with time threshold * added on final step for verification project data * Replace ortto External Embedded Webform for Onboarding guide * fix: findArchivedQfRounds query * fix subscribeOnboarding args * change output to boolean * WIP: add API key to request & add fetch MBD score record from DB * fixed last step verification * fixed typo * WIP: add field to user that holds user MBD score for an active round * disable DB Replica on staging * fetch data uere with the score from MBD & remove non needed query * Fix some test cases about stable coin donations * fix: issue with adminJs authentication when user has hash as null * "Last Update" on project card is not correct * Fix some test cases about stable coin donations (#1665) * Fix some test cases about stable coin donations * Fix few test cases of projectResolver * Fix few test cases of projectResolver * Fix test cases of project resolver * Fix donationResolver test cases * Bump follow-redirects from 1.15.5 to 1.15.6 (#1414) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.15.5...v1.15.6) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump @solana/web3.js from 1.87.6 to 1.87.7 (#1492) Bumps [@solana/web3.js](https://github.com/solana-labs/solana-web3.js) from 1.87.6 to 1.87.7. - [Release notes](https://github.com/solana-labs/solana-web3.js/releases) - [Commits](https://github.com/solana-labs/solana-web3.js/commits) --- updated-dependencies: - dependency-name: "@solana/web3.js" dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump express from 4.18.2 to 4.19.2 (#1430) Bumps [express](https://github.com/expressjs/express) from 4.18.2 to 4.19.2. - [Release notes](https://github.com/expressjs/express/releases) - [Changelog](https://github.com/expressjs/express/blob/master/History.md) - [Commits](expressjs/express@4.18.2...4.19.2) --- updated-dependencies: - dependency-name: express dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump braces from 3.0.2 to 3.0.3 (#1629) Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3. - [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md) - [Commits](micromatch/braces@3.0.2...3.0.3) --- updated-dependencies: - dependency-name: braces dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * Bump undici from 5.28.3 to 5.28.4 (#1454) Bumps [undici](https://github.com/nodejs/undici) from 5.28.3 to 5.28.4. - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](nodejs/undici@v5.28.3...v5.28.4) --- updated-dependencies: - dependency-name: undici dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: mohammadranjbarz <[email protected]> * fix types * Updated project verification form resolver test fixed previos 3 test with terms and condition update and added one last step test when user complete form and clicked "FINISH" button * fix extracting last comment * get donation to giveth with donation box analytics (#1661) * Add a method for finding relevant donations to the donationRepository.ts * Add a method for calculating donations metrics to the donationService.ts * Add a gql resolver for donations metrics to the donationResolver.ts * Add unit test for gql query resolver * Fix division by zero issue * times 100 average percentage to represent percent * add useDonationBox field to donation and draftDonation * fill useDonationBox field with correct data in migrations * Change donationMetrics endpoint based on change in data schema * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add false removed imports * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix tests based on changes * fix tests * send useDonationBox as last arg and make it optional * add relevant donation tx hash to donation creation flow * calculate related donations based on relevant donation tx hash * add unit tests * update unit test * fix bug * fix bug in donation repository and tests are pass * Clear All donations after donation metrics test cases * Add new function for deleting project from db and use it to don't affect other test cases * comment new test cases to ensure bug is related to that or not * Clear donations after tests * Comments new test cases in donationRepository.test.ts * uncomment tests and Clean up test effects on DB * Remove project addresses too * Add a new method to testUtils.ts for removing project from db by id * change donation dates to now * Remove clear donations sections * Change update count to a bigger number to pass test --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add test for fetching and refreshing qfroundscore for model * revert changes on package,json * revert changes on package,json * fix migration error * fix migration error * fix: turn minimumValidUsdValue to nullable when querying * remove updatedAt from projects tab * Remove old donation and add new ones (#1674) * remove verified from projects tab edit menu * remove verified from projectVerificationTab edit menu * fix total donations query * fix archived_round totals * fix latestUpdate column if not exists * fix join for totals * fix total donations with subquery * fix add some error handling and remove commented interface * fix: resolve conflict * fix: resolve conflict * fix USD value not showing * fix: convert timestap retrieved from RPC provider to milisconds * fix: donation test cases (milliseconds) * fix: donation test cases (milliseconds) * Endaoment integration (#1663) * Remove giving block projects that don't have any donation related to #1599 * Add needed fields to organization entity for endaoment projects related to Giveth/Roadmap#111 * Remove giving-blocks stuff and endaoment integration thing * Add categories to endaoment projects * Fix test cases * Fix some test cases about stable coin donations * Add endaoment categories * Fix remove giving-blocks projects migration * Add default image for endaoment projects * Fix linter * Fix add useDonationBox to draft_donation migration * Fix migration of adding useDonationBox to donation * Fix eslint error * Fix disabling recurring donations for endaoment projects * Change givingBlock organization to endaoment in pre-test script * Remove test case of accepted tokens of giving blocks * Relate all base, optimism and mainnet tokens to endaoment organization related to #1626 * Fix migration query syntax * fix: donation test cases (milliseconds) * fix: donation test cases (milliseconds) * Modify ormconfig for running migrations * Run ts files for migrations * Make isRecipient of project_addresses of endaoment project true * Fix type error of one of endaoment projects * add test case for filling prices * Modify add endaoment organization migration to pass the tests * fix: convert minimumUserAnalysisScore to Float on qfRound entity * fix: revert migration changes * add log for filling prices * feat: add github on project socialmedia enum * Merge master to staging (#1696) * Release relevant donations (#1687) * get donation to giveth with donation box analytics (#1661) * Add a method for finding relevant donations to the donationRepository.ts * Add a method for calculating donations metrics to the donationService.ts * Add a gql resolver for donations metrics to the donationResolver.ts * Add unit test for gql query resolver * Fix division by zero issue * times 100 average percentage to represent percent * add useDonationBox field to donation and draftDonation * fill useDonationBox field with correct data in migrations * Change donationMetrics endpoint based on change in data schema * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add false removed imports * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix tests based on changes * fix tests * send useDonationBox as last arg and make it optional * add relevant donation tx hash to donation creation flow * calculate related donations based on relevant donation tx hash * add unit tests * update unit test * fix bug * fix bug in donation repository and tests are pass * Clear All donations after donation metrics test cases * Add new function for deleting project from db and use it to don't affect other test cases * comment new test cases to ensure bug is related to that or not * Clear donations after tests * Comments new test cases in donationRepository.test.ts * uncomment tests and Clean up test effects on DB * Remove project addresses too * Add a new method to testUtils.ts for removing project from db by id * change donation dates to now * Remove clear donations sections * Change update count to a bigger number to pass test --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Remove old donation and add new ones (#1674) * Remove unused variable --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * release analytics dashboard dropdown menu related chagnes (#1686) * use networkId instead of optimism-only flag (#1653) * Use networkId instead of optimismOnly flag * Update graphql queries for tests * Change network id to float in gql schema to fix unit tests --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Add organization filter to projectsTab.ts in admin panel related to #1599 (comment) * Fill description summary for endaoment projects related to #1599 (comment) * Fix eslint errors * Replace special characters of slugs of endaoment projects with - related to Giveth/giveth-dapps-v2#4280 (comment) * Fix eslint errors * return hardcoded as user MBD score * rename qfRound minimumUserAnalysisScore field * Resolve conflicts (#1703) * Release relevant donations (#1687) * get donation to giveth with donation box analytics (#1661) * Add a method for finding relevant donations to the donationRepository.ts * Add a method for calculating donations metrics to the donationService.ts * Add a gql resolver for donations metrics to the donationResolver.ts * Add unit test for gql query resolver * Fix division by zero issue * times 100 average percentage to represent percent * add useDonationBox field to donation and draftDonation * fill useDonationBox field with correct data in migrations * Change donationMetrics endpoint based on change in data schema * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * remove unused import Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * add false removed imports * add default value for useDonationBox field Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix tests based on changes * fix tests * send useDonationBox as last arg and make it optional * add relevant donation tx hash to donation creation flow * calculate related donations based on relevant donation tx hash * add unit tests * update unit test * fix bug * fix bug in donation repository and tests are pass * Clear All donations after donation metrics test cases * Add new function for deleting project from db and use it to don't affect other test cases * comment new test cases to ensure bug is related to that or not * Clear donations after tests * Comments new test cases in donationRepository.test.ts * uncomment tests and Clean up test effects on DB * Remove project addresses too * Add a new method to testUtils.ts for removing project from db by id * change donation dates to now * Remove clear donations sections * Change update count to a bigger number to pass test --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Remove old donation and add new ones (#1674) * Remove unused variable --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * release analytics dashboard dropdown menu related chagnes (#1686) * use networkId instead of optimism-only flag (#1653) * Use networkId instead of optimismOnly flag * Update graphql queries for tests * Change network id to float in gql schema to fix unit tests --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Modify endaoment categories and relate them to projects related to #1664 (comment) * Add canUseOnFrontend to category so can show a category but don't allow users to select them when create/update projects related to #1685 * Fix project resolver test case * feat: add tacking recurring donations queries * fix: delete unwanted recurring donation test cases * fix CPU spikes * add new test case for project update * fix test case * Fix add endaoment integration * Filter isActive and canUseOnFrontend categories in projectResolver * Filter isActive and canUseOnFrontend categories in projectResolver * Return canUseOnFrontend in main category list * optimize projectUpdates query * Comment migrations related to endaoment (#1706) * 1.24.0 * Test ci/cd * Fix build problem * optimize projectUpdates endpoint * optimize projectUpdates endpoint - add cache * add dynamic field selection * add a default value for etc mordor url (#1709) * Remove redundant backslash * fix test cases * feat: add per token data for recurring donations statistcs (pie chart - dashboard analytics) * Change commands to run migrations as js (#1714) * Change commands to run migrations as js * Remove unnecessary mkdir steps from build command in package.json * Fix migrations address in ormconfig.ts * Fix build command (#1715) * make config directory and the copy the configs * Add -p option to mkdir command * Check config directory existing and then copy content to it * Revert migration changes (#1717) * Revert "Check config directory existing and then copy content to it" This reverts commit 1fb9fa2. * Revert "Fix build command (#1715)" This reverts commit 4b570a7. * Revert "Change commands to run migrations as js (#1714)" This reverts commit 18f3239. * Optimise relevant donation flow (#1698) * Add migrations to add donation percentage and fill it * Add donation percentage and use it in donation metrics calculation * Fix bug in converting to number * Fix bug unit test * Add donation percentage to test data to correctly calculate donation metrics * remove giveth old project to fix the test * Apply review changes * Skip heavy migrations related to relevantDonations on test environment to speedup pipelines * Fix typo * change argument name * Fix tests based on changes * fix: minimumPassportScore issue when tapping float number on adminJS * Add index to useDonationBox field (#1723) * Run migrations as js files (#1718) * Change commands to run migrations as js * Remove unnecessary mkdir steps from build command in package.json * Fix migrations address in ormconfig.ts * Change build command to work correctly if config folder is not exists * Revert "Run migrations as js files (#1718)" (#1724) This reverts commit 015e383. * Which tokens are used the most on each chain by unique donors * change getDonationStats to typeorm * update Bull * Use raw select query instead of find function from typeorm (#1729) * gitcoin API update * gitcoin API update * gitcoin API update * Add all network labels in admin panel, project tab * Fix eslint errors * added graphql query to fetch recurring donations by date adn project id * fixed lint * Add all network labels in admin panel, project tab * allow to download email addresses * fix: returning QF tag to the user bookmarked projects * removed unnecessary ql fields * added test cases for recurring donations by date resolver * Make sure all Endaoment projects have been added to our DB (#1751) * Make sure all Endaoment projects have been added to our DB related to #1598 (comment) * Fix eslint errors * Add appropriate banner images for imported endaoment projects related to #1600 (comment) * Add on conflict do nothing for create endaoment organization migration * Make organizationId serial if it's not already * Fix eslint errors * Fix add endaoment organization migration * Fix eslint errors * Comment run migrations on production ci * Fix categories of endaoment projects --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Ramin <[email protected]> Co-authored-by: Carlos <[email protected]> Co-authored-by: Meriem-BM <[email protected]> Co-authored-by: Ali Ebrahimi <[email protected]> Co-authored-by: kkatusic <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CarlosQ96 <[email protected]> Co-authored-by: Reshzera <[email protected]> Co-authored-by: ali ebrahimi <[email protected]> Co-authored-by: Lovel George <[email protected]>
related to related to #1617 #1615 #1618 #1619 #1614 #1620
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Documentation
Tests
Chores
package.json
test scripts to include additional test files.