Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release Oct 2024 - decentralized verification #1843

Merged
merged 76 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
25f5cd5
fix: remove memo for project verification managing funds
Meriem-BM Aug 28, 2024
4f2dce1
fix: remove memo for project verification managing funds
Meriem-BM Aug 28, 2024
23bdade
add projectId and qfRoundId to qf data export
CarlosQ96 Aug 29, 2024
44488a9
fix: getDraftDonationById bug (toWalletMemo can be null)
Meriem-BM Aug 29, 2024
8128e7a
fix: add memo for stellar project address uniqueness
Meriem-BM Aug 31, 2024
ddb9d4e
fix: add memo for manage address validation
Meriem-BM Sep 1, 2024
3fe1966
fix: add duplicate address error message for stellar
Meriem-BM Sep 1, 2024
924ac42
fix: linter error
Meriem-BM Sep 1, 2024
230cc91
add index for project stellar address
Meriem-BM Sep 1, 2024
553f32b
eslint error
Meriem-BM Sep 1, 2024
ce6713e
Merge pull request #1790 from Giveth/feat/stellar_integration
Meriem-BM Sep 2, 2024
78fb64e
fix: case when owner donate to his own peoject (Stellar chain)
Meriem-BM Sep 2, 2024
0927d62
Merge pull request #1793 from Giveth/feat/stellar_integration
Meriem-BM Sep 3, 2024
6dbdffc
fix: add calculateGivbackFactor to Stellar cron job
Meriem-BM Sep 3, 2024
133f76f
Merge pull request #1795 from Giveth/feat/stellar_integration
Meriem-BM Sep 3, 2024
f77816b
onlyEndaement option added to donationResolvers to get only endaoment…
HrithikSampson Sep 4, 2024
8953798
chore: implementing coderabbitai suggestion to remove string literal
HrithikSampson Sep 4, 2024
6498495
feat: register secondary donation
Meriem-BM Sep 4, 2024
b510db1
Merge pull request #1797 from Giveth/feat/stellar_integration
Meriem-BM Sep 4, 2024
394ef30
running migration to set project banners appropriately for endaoment …
HrithikSampson Sep 4, 2024
66f3d10
Merge branch 'staging' of github.com:Giveth/impact-graph into 13_anal…
HrithikSampson Sep 6, 2024
cc79c2c
improve adminjs to import qfround matching and better filters
CarlosQ96 Sep 6, 2024
4e59a2b
fix eslint
CarlosQ96 Sep 6, 2024
2268d8c
fix: remove adding secondary donation logic
Meriem-BM Sep 7, 2024
751308d
Merge pull request #1800 from Giveth/feat/stellar_integration
Meriem-BM Sep 7, 2024
78e1911
fix minor form issues
CarlosQ96 Sep 8, 2024
84f7cca
order middleware in bootstrap file
CarlosQ96 Sep 8, 2024
d4dbb09
Merge branch 'staging' of github.com:Giveth/impact-graph into 13_anal…
HrithikSampson Sep 9, 2024
f9090c4
test: add test cases to fetch only Endaoment projects
HrithikSampson Sep 9, 2024
779f2b6
chore: change the second Project to first Project
HrithikSampson Sep 9, 2024
bc28379
chore: change the second Project to first Project
HrithikSampson Sep 9, 2024
433858b
chore: change the second Project to first Project
HrithikSampson Sep 9, 2024
1311d39
chore: change the second user to new user since it is interfering wit…
HrithikSampson Sep 10, 2024
bebce89
delete previous_round_rank when deleting a project (#1809)
mohammadranjbarz Sep 11, 2024
f85d8b4
Implement allocatedGivbacks function (#1808)
mohammadranjbarz Sep 11, 2024
9c5ab10
migration: project banners for endaoment projects need to have the co…
HrithikSampson Sep 11, 2024
5037885
Merge branch 'staging' of github.com:Giveth/impact-graph into banner-…
HrithikSampson Sep 11, 2024
1954f6e
chore: underscore before unused variable in add_endaoment_project_ban…
HrithikSampson Sep 11, 2024
52d5afa
Merge pull request #1799 from Giveth/hotfix_improve_qfround_history_m…
CarlosQ96 Sep 11, 2024
492aab4
Use Gnosis giv token for getting price of GIV
mohammadranjbarz Sep 12, 2024
bb780c2
Use superfluid mock adapter for test cases
mohammadranjbarz Sep 12, 2024
4910d7b
Use superfluid adapter on test env again
mohammadranjbarz Sep 12, 2024
b54b825
Feat/separate givback verfied (#1770)
MohammadPCh Sep 12, 2024
ffdda5a
Fix test cases related to isProjectVerified
mohammadranjbarz Sep 12, 2024
8d30b1e
add isImported And categories to project tab
CarlosQ96 Sep 12, 2024
2a564a3
fix isProjectGivbackEligible Migration in wrong folder
CarlosQ96 Sep 12, 2024
2674708
add chaintype and solana networks to tokenTab
CarlosQ96 Sep 17, 2024
bfdc9d8
Merge pull request #1827 from Giveth/hotfix_add_solana_to_adminjs_forms
CarlosQ96 Sep 17, 2024
86e315a
update branch
HrithikSampson Sep 17, 2024
1d33d40
update branch
HrithikSampson Sep 17, 2024
5d70d78
Merge branch 'staging' of github.com:Giveth/impact-graph into banner-…
HrithikSampson Sep 17, 2024
ee8617c
add environment and energy image mapping
HrithikSampson Sep 17, 2024
3d10bbf
add categories to show and edit forms in adminjs for projects
CarlosQ96 Sep 18, 2024
5c61a99
Merge pull request #1796 from Giveth/13_analytics_track_donation_stat…
HrithikSampson Sep 18, 2024
4b8d308
fix eslint
CarlosQ96 Sep 19, 2024
a14c97d
Merge pull request #1822 from Giveth/hotfix_project_additional_attrib…
CarlosQ96 Sep 19, 2024
7007987
add best match sort option
MohammadPCh Sep 19, 2024
61524cd
update addSearchQuery to prioritize the title
MohammadPCh Sep 19, 2024
93f13b6
Add Stellar to QFRound
HrithikSampson Sep 19, 2024
531e98d
Merge branch 'staging' of github.com:Giveth/impact-graph into add_ste…
HrithikSampson Sep 19, 2024
69dd31a
run linter
HrithikSampson Sep 19, 2024
7015264
Merge pull request #1831 from Giveth/add_stellar_to_qf
HrithikSampson Sep 19, 2024
d0728d8
remove eager from project categories in entity
CarlosQ96 Sep 20, 2024
f1d60da
Merge pull request #1830 from Giveth/add-best-match-sorting
MohammadPCh Sep 23, 2024
3ee817a
Add isGivbackEligible filter
mohammadranjbarz Sep 24, 2024
f49fe56
Merge branch 'staging' of github.com:Giveth/impact-graph into banner-…
HrithikSampson Sep 25, 2024
ecf4e19
Merge pull request #1813 from Giveth/banner-image-add-endaoment-project
HrithikSampson Sep 25, 2024
de13f3c
Hotfix automatic model score sync (#1849)
CarlosQ96 Oct 1, 2024
0c0aea2
merge master into staging (fix conflicts)
CarlosQ96 Oct 1, 2024
e4d210f
prevent duplicate tokens being added in adminJS
RamRamez Oct 2, 2024
046b6e8
Merge pull request #1852 from Giveth/prevent-duplicate-tokens-being-a…
RamRamez Oct 2, 2024
9cfdfc5
Ensure correct emails are sent for project status changes related to …
RamRamez Oct 2, 2024
e8a0aaa
fix test
RamRamez Oct 2, 2024
bd7c70e
fix test cases
RamRamez Oct 2, 2024
a4ae088
fix test cases
RamRamez Oct 3, 2024
f06ba5f
Merge pull request #1853 from Giveth/Ensure-correct-emails-are-sent-f…
RamRamez Oct 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class RenameIsProjectVerifiedToIsGivbackEligibleInDonation1637168932306
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE donation
RENAME COLUMN "isProjectVerified" TO "isProjectGivbackEligible";
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE donation
RENAME COLUMN "isProjectGivbackEligible" TO "isProjectVerified";
`);
}
}
1 change: 1 addition & 0 deletions migration/1646295724658-createTokensTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class createTokensTable1646295724658 implements MigrationInterface {
name text COLLATE pg_catalog."default" NOT NULL,
symbol text COLLATE pg_catalog."default" NOT NULL,
address text COLLATE pg_catalog."default" NOT NULL,
"isQR" BOOLEAN DEFAULT FALSE NOT NUL,
"networkId" integer NOT NULL,
decimals integer NOT NULL,
"order" integer,
Expand Down
2 changes: 1 addition & 1 deletion migration/1696918830123-add_octant_donations_to_db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const transactions: Partial<Donation>[] = [
transactionId:
'0x30954cb441cb7b2184e6cd1afc6acbd1318f86a68b669f6bfb2786dd459e2d6c',
currency: 'ETH',
isProjectVerified: true,
isProjectGivbackEligible: true,
isTokenEligibleForGivback: true,
amount: 5,
valueUsd: 9_458.4,
Expand Down
4 changes: 4 additions & 0 deletions migration/1716367359560-add_base_chain_tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { NETWORK_IDS } from '../src/provider';

export class AddBaseChainTokens1716367359560 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE token ADD COLUMN IF NOT EXISTS "isQR" BOOLEAN DEFAULT FALSE NOT NULL`,
);

const environment = config.get('ENVIRONMENT') as string;

const networkId =
Expand Down
23 changes: 23 additions & 0 deletions migration/1724060343213-AddIsGivbackEligibleColumnToProject.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner, TableColumn } from 'typeorm';

export class AddIsGivbackEligibleColumnToProject1637168932304
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
// Add the new column
await queryRunner.addColumn(
'project',
new TableColumn({
name: 'isGivbackEligible',
type: 'boolean',
isNullable: false,
default: false,
}),
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
// Drop the isGivbackEligible column
await queryRunner.dropColumn('project', 'isGivbackEligible');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class UpdateIsGivbackEligibleForVerifiedProjects1637168932305
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
// Update isGivbackEligible to true for verified projects
await queryRunner.query(`
UPDATE project
SET "isGivbackEligible" = true
WHERE "verified" = true;
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
// Revert the update (optional)
await queryRunner.query(`
UPDATE project
SET "isGivbackEligible" = false
WHERE "verified" = true;
`);
}
}
66 changes: 66 additions & 0 deletions migration/1724223781248-ProjectInstantPowerViewV3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class ProjectInstantPowerViewV31724223781248
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
DROP MATERIALIZED VIEW IF EXISTS public.project_instant_power_view;
CREATE MATERIALIZED VIEW IF NOT EXISTS public.project_instant_power_view AS
SELECT
innerview."projectId",
ROUND(CAST(innerview."totalPower" as NUMERIC), 2) as "totalPower",
rank() OVER (
ORDER BY
innerview."totalPower" DESC
) AS "powerRank"
FROM
(
SELECT
project.id AS "projectId",
CASE
WHEN (project.verified = true OR project."isGivbackEligible" = true) AND project."statusId" = 5 THEN COALESCE(sum(pp."boostedPower"), 0 :: double precision)
ELSE 0 :: double precision
END AS "totalPower"
FROM
project
LEFT JOIN (
SELECT
"powerBoosting"."projectId",
sum("instantPowerBalance".balance * "powerBoosting".percentage :: double precision / 100 :: double precision) AS "boostedPower",
now() AS "updateTime"
FROM
instant_power_balance "instantPowerBalance"
JOIN power_boosting "powerBoosting" ON "powerBoosting"."userId" = "instantPowerBalance"."userId"
GROUP BY
"powerBoosting"."projectId"
) pp ON pp."projectId" = project.id
GROUP BY
project.id
) innerview
ORDER BY
innerview."totalPower" DESC WITH DATA;
`);

await queryRunner.query(`
CREATE UNIQUE INDEX idx_project_instant_power_view_unique ON public.project_instant_power_view ("projectId");
`);

await queryRunner.query(`
CREATE INDEX project_instant_power_view_project_id ON public.project_instant_power_view USING hash ("projectId") TABLESPACE pg_default;
`);

await queryRunner.query(`
CREATE INDEX project_instant_power_view_total_power ON public.project_instant_power_view USING btree ("totalPower" DESC) TABLESPACE pg_default;
`);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
DROP MATERIALIZED VIEW IF EXISTS public.project_instant_power_view;
DROP INDEX IF EXISTS public.idx_project_instant_power_view_unique;
DROP INDEX IF EXISTS public.project_instant_power_view_project_id;
DROP INDEX IF EXISTS public.project_instant_power_view_total_power;
`);
}
}
66 changes: 66 additions & 0 deletions migration/1725260193333-projectGivbackRankView.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { MigrationInterface, QueryRunner } from 'typeorm';

export class ProjectGivbackRankViewV31725260193333
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`
DROP
MATERIALIZED VIEW IF EXISTS public.project_givback_rank_view;
CREATE MATERIALIZED VIEW IF NOT EXISTS public.project_givback_rank_view AS
SELECT
innerview."projectId",
ROUND(CAST(innerview."totalPower" as NUMERIC), 2) as "totalPower",
rank() OVER (
ORDER BY
innerview."totalPower" DESC
) AS "powerRank",
"powerRound".round
FROM
(
SELECT
project.id AS "projectId",
CASE project."isGivbackEligible" and project."statusId" = 5 WHEN false THEN 0 :: double precision ELSE COALESCE(
sum(pp."boostedPower"),
0 :: double precision
) END AS "totalPower"
FROM
project project
LEFT JOIN (
SELECT
"powerRound".round,
"powerBoostingSnapshot"."projectId",
"powerBoostingSnapshot"."userId",
avg(
"powerBalanceSnapshot".balance * "powerBoostingSnapshot".percentage :: double precision / 100 :: double precision
) AS "boostedPower",
now() AS "updateTime"
FROM
power_round "powerRound"
JOIN power_snapshot "powerSnapshot" ON "powerSnapshot"."roundNumber" = "powerRound".round
JOIN power_balance_snapshot "powerBalanceSnapshot" ON "powerBalanceSnapshot"."powerSnapshotId" = "powerSnapshot".id
JOIN power_boosting_snapshot "powerBoostingSnapshot" ON "powerBoostingSnapshot"."powerSnapshotId" = "powerSnapshot".id
AND "powerBoostingSnapshot"."userId" = "powerBalanceSnapshot"."userId"
GROUP BY
"powerRound".round,
"powerBoostingSnapshot"."projectId",
"powerBoostingSnapshot"."userId"
) pp ON pp."projectId" = project.id
GROUP BY
project.id
) innerview,
power_round "powerRound"
ORDER BY
innerview."totalPower" DESC WITH DATA;
CREATE UNIQUE INDEX project_givback_rank_view_project_id_round_unique ON public.project_givback_rank_view ("projectId", "round");
CREATE INDEX project_givback_rank_view_project_id ON public.project_givback_rank_view USING hash ("projectId") TABLESPACE pg_default;
CREATE INDEX project_givback_rank_view_total_power ON public.project_givback_rank_view USING btree ("totalPower" DESC) TABLESPACE pg_default;
`,
);
}

public async down(_queryRunner: QueryRunner): Promise<void> {
//
}
}
86 changes: 86 additions & 0 deletions migration/1726069430594-add_endaoment_project_banners.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
import { endaomentProjects } from './data/importedEndaomentProjects';
import { endaomentProjectCategoryMapping } from './data/endaomentProjectCategoryMapping';
import { NETWORK_IDS } from '../src/provider';
export class AddEndaomentProjectBanners1726069430594
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
const mainCategorySlugToBannerMapping = {
'environment-and-energy': 'environment-energy',
'health-and-wellness': 'health-wellness',
'art-and-culture': 'art-culture',
nature: 'nature',
community: 'community',
finance: 'finance',
education: 'education',
equality: 'equality',
other: '1',
'economic-and-infrastructure': 'economic-infrastructure',
ngo: 'non-profit',
technology: 'technology',
};
const subCategoryToCategory = await queryRunner.query(
'SELECT category.value, main_category.slug from category LEFT JOIN main_category on category."mainCategoryId" = main_category.id;',
);

const imageCategoryMapping = subCategoryToCategory.reduce(function (
categoryImageKeyPair,
category: { value: string; slug: string },
) {
const bannerLink = mainCategorySlugToBannerMapping[category.slug] || '1';
categoryImageKeyPair[category.value] = bannerLink;
return categoryImageKeyPair;
}, {});

for (const project of endaomentProjects) {
const mainnetAddress = project.mainnetAddress;
const projectAddresses = await queryRunner.query(
`SELECT * FROM project_address WHERE LOWER(address) = $1 AND "networkId" = $2 LIMIT 1`,
[mainnetAddress!.toLowerCase(), NETWORK_IDS.MAIN_NET],
);

const projectAddress = await projectAddresses?.[0];

if (!projectAddress) {
// eslint-disable-next-line no-console
console.log(`Could not find project address for ${mainnetAddress}`);
continue;
}

// Insert the project-category relationship in a single query
const getCategoryNames = (nteeCode: string): string[] => {
const mapping = endaomentProjectCategoryMapping.find(
category => category.nteeCode === nteeCode,
);
return mapping
? [
mapping.category1,
mapping.category2,
mapping.category3 || '',
mapping.category4 || '',
].filter(Boolean)
: [];
};
if (!project.nteeCode) {
// eslint-disable-next-line no-console
console.log(`Could not find nteeCode for ${mainnetAddress}`);
continue;
}
const categoryNames = getCategoryNames(String(project.nteeCode));
const bannerImage = `/images/defaultProjectImages/${imageCategoryMapping[categoryNames[1]] || '1'}.png`;
await queryRunner.query(`UPDATE project SET image = $1 WHERE id = $2`, [
bannerImage,
projectAddress.projectId,
]);
// eslint-disable-next-line no-console
console.log(
`Updated project ${projectAddress.projectId} with image ${bannerImage}`,
);
}
}

public async down(_queryRunner: QueryRunner): Promise<void> {
// No down migration
}
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@
"test:qfRoundHistoryRepository": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/repositories/qfRoundHistoryRepository.test.ts",
"test:qfRoundService": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/qfRoundService.test.ts",
"test:project": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/entities/project.test.ts",
"test:projectsTab": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/server/adminJs/tabs/projectsTab.test.ts",
"test:syncUsersModelScore": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/cronJobs/syncUsersModelScore.test.ts",
"test:notifyDonationsWithSegment": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/cronJobs/notifyDonationsWithSegment.test.ts",
"test:checkProjectVerificationStatus": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/cronJobs/checkProjectVerificationStatus.test.ts",
"test:statusReasonResolver": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/resolvers/statusReasonResolver.test.ts",
Expand Down Expand Up @@ -166,6 +168,7 @@
"test:anchorContractAddressRepository": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/repositories/anchorContractAddressRepository.test.ts",
"test:recurringDonationRepository": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/repositories/recurringDonationRepository.test.ts",
"test:userPassportScoreRepository": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/repositories/userPassportScoreRepository.test.ts",
"test:projectGivbackRepository": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/repositories/projectGivbackViewRepository.test.ts",
"test:recurringDonationService": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/services/recurringDonationService.test.ts",
"test:dbCronRepository": "NODE_ENV=test mocha -t 90000 ./test/pre-test-scripts.ts ./src/repositories/dbCronRepository.test.ts",
"test:powerBoostingResolver": "NODE_ENV=test mocha ./test/pre-test-scripts.ts ./src/resolvers/powerBoostingResolver.test.ts",
Expand Down
15 changes: 13 additions & 2 deletions src/adapters/superFluid/superFluidMockAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
FlowUpdatedEvent,
SuperFluidAdapterInterface,
} from './superFluidAdapterInterface';
import { generateRandomString } from '../../utils/utils';

export class SuperFluidMockAdapter implements SuperFluidAdapterInterface {
async streamPeriods() {
Expand Down Expand Up @@ -88,12 +89,22 @@ export class SuperFluidMockAdapter implements SuperFluidAdapterInterface {
return Promise.resolve(undefined);
}

getFlowByTxHash(_params: {
getFlowByTxHash(params: {
receiver: string;
sender: string;
flowRate: string;
transactionHash: string;
}): Promise<FlowUpdatedEvent | undefined> {
return Promise.resolve(undefined);
const { receiver, sender, flowRate, transactionHash } = params;
return Promise.resolve({
id: generateRandomString(20),
flowOperator: 'flowOperator',
flowRate,
transactionHash,
receiver,
sender,
token: '',
timestamp: String(new Date().getTime()),
});
}
}
Loading
Loading