Skip to content

Commit 7fbda13

Browse files
authored
Merge branch 'main' into bug/3291-cant-select-full-area-project-logo
2 parents 28880a6 + 1806aad commit 7fbda13

File tree

20 files changed

+640
-305
lines changed

20 files changed

+640
-305
lines changed

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@allo-team/allo-v2-sdk": "^1.0.78",
2020
"@ethersproject/abstract-signer": "^5.7.0",
2121
"@ethersproject/providers": "^5.7.2",
22-
"@gitcoin/gitcoin-chain-data": "^1.0.27",
22+
"@gitcoin/gitcoin-chain-data": "^1.0.34",
2323
"@gitcoinco/passport-sdk-types": "^0.2.0",
2424
"@openzeppelin/merkle-tree": "^1.0.2",
2525
"@rainbow-me/rainbowkit": "2.1.2",

packages/common/src/allo/allo.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,19 @@ export interface Allo {
245245
}
246246
>;
247247

248+
manageProfileMembers: (args: {
249+
profileId: Hex;
250+
members: Address[];
251+
addOrRemove: "add" | "remove";
252+
}) => AlloOperation<
253+
Result<null>,
254+
{
255+
transaction: Result<Hex>;
256+
transactionStatus: Result<TransactionReceipt>;
257+
indexingStatus: Result<null>;
258+
}
259+
>;
260+
248261
directAllocation: (args: {
249262
tokenAddress: Address;
250263
poolId: string;

packages/common/src/allo/backends/allo-v1.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,25 @@ export class AlloV1 implements Allo {
13111311
});
13121312
}
13131313

1314+
manageProfileMembers(args: {
1315+
profileId: Hex;
1316+
members: Address[];
1317+
addOrRemove: "add" | "remove";
1318+
}): AlloOperation<
1319+
Result<null>,
1320+
{
1321+
transaction: Result<Hex>;
1322+
transactionStatus: Result<TransactionReceipt>;
1323+
indexingStatus: Result<null>;
1324+
}
1325+
> {
1326+
return new AlloOperation(async () => {
1327+
const result = new AlloError(`Unsupported on v1 ${args}`);
1328+
return error(result);
1329+
});
1330+
}
1331+
1332+
13141333
directAllocation(args: {
13151334
tokenAddress: Address;
13161335
poolId: string;

packages/common/src/allo/backends/allo-v2.ts

Lines changed: 62 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -83,74 +83,6 @@ export function getAlloAddress(chainId: number) {
8383
return allo.address();
8484
}
8585

86-
export function getDirectAllocationPoolId(chainId: number) {
87-
switch (chainId) {
88-
case 11155111:
89-
return 386;
90-
case 10:
91-
return 58;
92-
case 42161:
93-
return 390;
94-
case 42220:
95-
return 12;
96-
case 8453:
97-
return 36;
98-
case 43114:
99-
return 15;
100-
case 534352:
101-
case 534353:
102-
return 22;
103-
case 250:
104-
return 4;
105-
case 1:
106-
return 11;
107-
case 1329:
108-
case 808:
109-
return 8;
110-
case 42:
111-
return 3;
112-
case 1088:
113-
return 1;
114-
default:
115-
return undefined;
116-
}
117-
}
118-
119-
export function getDirectAllocationStrategyAddress(chainId: number) {
120-
switch (chainId) {
121-
case 11155111:
122-
return "0xd60BCfa8714949c478d88da51A7450703A32Cf35";
123-
case 10:
124-
return "0x56662F9c0174cD6ae14b214fC52Bd6Eb6B6eA602";
125-
case 42161:
126-
return "0x56662F9c0174cD6ae14b214fC52Bd6Eb6B6eA602";
127-
case 42220:
128-
return "0x56662F9c0174cD6ae14b214fC52Bd6Eb6B6eA602";
129-
case 8453:
130-
return "0x56662F9c0174cD6ae14b214fC52Bd6Eb6B6eA602";
131-
case 43114:
132-
return "0x86b4329E7CB8674b015477C81356420D79c71A53";
133-
case 534353:
134-
return "0x56662F9c0174cD6ae14b214fC52Bd6Eb6B6eA602";
135-
case 534352:
136-
return "0x9da0a7978b7bd826e06800427cbf1ec1200393e3";
137-
case 250:
138-
return "0x1E18cdce56B3754c4Dca34CB3a7439C24E8363de";
139-
case 1:
140-
return "0x56662F9c0174cD6ae14b214fC52Bd6Eb6B6eA602";
141-
case 808:
142-
return "0x1cfa7A687cd18b99D255bFc25930d3a0b05EB00F";
143-
case 1329:
144-
return "0x7836f59bd6dc1d87a45df8b9a74eefcdf25bc8a9";
145-
case 42:
146-
return "0xeB6325d9daCD1E46A20C02F46E41d4CAE45C0980";
147-
case 1088:
148-
return "0x56662F9c0174cD6ae14b214fC52Bd6Eb6B6eA602";
149-
default:
150-
return undefined;
151-
}
152-
}
153-
15486
export class AlloV2 implements Allo {
15587
private transactionSender: TransactionSender;
15688
private ipfsUploader: IpfsUploader;
@@ -1505,6 +1437,66 @@ export class AlloV2 implements Allo {
15051437
});
15061438
}
15071439

1440+
manageProfileMembers(args: {
1441+
profileId: Hex;
1442+
members: Address[];
1443+
addOrRemove: "add" | "remove";
1444+
}): AlloOperation<
1445+
Result<null>,
1446+
{
1447+
transaction: Result<Hex>;
1448+
transactionStatus: Result<TransactionReceipt>;
1449+
indexingStatus: Result<null>;
1450+
}
1451+
> {
1452+
return new AlloOperation(async ({ emit }) => {
1453+
const txData =
1454+
args.addOrRemove === "add"
1455+
? this.registry.addMembers({
1456+
profileId: args.profileId,
1457+
members: args.members,
1458+
})
1459+
: this.registry.removeMembers({
1460+
profileId: args.profileId,
1461+
members: args.members,
1462+
});
1463+
1464+
const txResult = await sendRawTransaction(this.transactionSender, {
1465+
to: txData.to,
1466+
data: txData.data,
1467+
value: BigInt(txData.value),
1468+
});
1469+
1470+
emit("transaction", txResult);
1471+
1472+
if (txResult.type === "error") {
1473+
return error(txResult.error);
1474+
}
1475+
1476+
let receipt: TransactionReceipt;
1477+
try {
1478+
receipt = await this.transactionSender.wait(txResult.value);
1479+
emit("transactionStatus", success(receipt));
1480+
} catch (err) {
1481+
console.log(err);
1482+
const result = new AlloError(
1483+
`Failed to ${args.addOrRemove} profile members`
1484+
);
1485+
emit("transactionStatus", error(result));
1486+
return error(result);
1487+
}
1488+
1489+
await this.waitUntilIndexerSynced({
1490+
chainId: this.chainId,
1491+
blockNumber: receipt.blockNumber,
1492+
});
1493+
1494+
emit("indexingStatus", success(null));
1495+
1496+
return success(null);
1497+
});
1498+
}
1499+
15081500
directAllocation(args: {
15091501
tokenAddress: Address;
15101502
poolId: string;
@@ -1533,7 +1525,8 @@ export class AlloV2 implements Allo {
15331525
poolId: poolId,
15341526
});
15351527

1536-
const strategyAddress = getDirectAllocationStrategyAddress(this.chainId);
1528+
const strategyAddress = getChainById(this.chainId).contracts
1529+
.directAllocationStrategyAddress;
15371530

15381531
if (strategyAddress === undefined) {
15391532
return error(new AlloError("Direct allocation strategy not found"));

packages/common/src/index.ts

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -477,25 +477,6 @@ export function isChainIdSupported(chainId: number) {
477477
return getChainById(chainId) !== undefined;
478478
}
479479

480-
const gg20Rounds = [
481-
//GG20 rounds
482-
{ roundId: "23", chainId: 42161 }, // Hackathon Alumni
483-
{ roundId: "24", chainId: 42161 }, // ENS
484-
{ roundId: "25", chainId: 42161 }, // dApps & Apps
485-
{ roundId: "26", chainId: 42161 }, // WEB3 Infrastructure
486-
{ roundId: "27", chainId: 42161 }, // Developer Tooling
487-
{ roundId: "28", chainId: 42161 }, // Hypercerts Ecosystem
488-
{ roundId: "29", chainId: 42161 }, // Climate Solutions
489-
{ roundId: "31", chainId: 42161 }, // Open Civics
490-
{ roundId: "36", chainId: 42161 }, // Regenerative Land Projects
491-
{ roundId: "39", chainId: 42161 }, // DeSci
492-
{ roundId: "9", chainId: 10 }, // Token Engineering Commons (TEC)
493-
];
494-
495-
export function isGG20Round(roundId: string, chainId: number) {
496-
return gg20Rounds.some((r) => r.roundId === roundId && r.chainId === chainId);
497-
}
498-
499480
export function isLitUnavailable(chainId: number) {
500481
return [
501482
4201, // LUKSO_TESTNET,

packages/grant-explorer/src/checkoutStore.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export const useCheckoutStore = create<CheckoutState>()(
180180
client: walletClient,
181181
});
182182
nonce = await erc20Contract.read.nonces([owner]);
183-
const tokenName = await erc20Contract.read.name();
183+
let tokenName = await erc20Contract.read.name();
184184
if (getPermitType(token, chainId) === "dai") {
185185
sig = await signPermitDai({
186186
walletClient: walletClient,
@@ -194,6 +194,13 @@ export const useCheckoutStore = create<CheckoutState>()(
194194
permitVersion: token.permitVersion ?? "1",
195195
});
196196
} else {
197+
// cUSD is a special case where the token symbol is used for permit instead of the name
198+
if (
199+
chainId === 42220 &&
200+
token.address.toLowerCase() ===
201+
"0x765de816845861e75a25fca122bb6898b8b1282a".toLowerCase()
202+
)
203+
tokenName = "cUSD";
197204
sig = await signPermit2612({
198205
walletClient: walletClient,
199206
value: totalDonationPerChain[chainId],

0 commit comments

Comments
 (0)