Skip to content

Commit

Permalink
add retrofunding to builder
Browse files Browse the repository at this point in the history
  • Loading branch information
thelostone-mc committed Jan 15, 2025
1 parent 4d78de3 commit b87b020
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 7 deletions.
10 changes: 10 additions & 0 deletions packages/builder/src/actions/rounds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ export const loadRound =
roundEndTime = Date.parse(v2Round.applicationsEndTime) / 1000;
break;

case "allov2.EasyRetroFundingStrategy":
roundPayoutStrategy = RoundCategory.Retrofunding;
applicationsStartTime =
Date.parse(v2Round.applicationsStartTime) / 1000;
applicationsEndTime =

Check failure on line 100 in packages/builder/src/actions/rounds.ts

View workflow job for this annotation

GitHub Actions / lint-test-typecheck

Delete `⏎·········`
Date.parse(v2Round.applicationsEndTime) / 1000;
roundStartTime = Date.parse(v2Round.applicationsStartTime) / 1000;
roundEndTime = Date.parse(v2Round.applicationsEndTime) / 1000;
break;

case "allov1.QF":
case "allov2.DonationVotingMerkleDistributionDirectTransferStrategy":
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ export default function RoundListItem({
Direct Grant
</span>
) : null}
{roundPayoutStrategy === RoundCategory.Retrofunding ? (
<span className={`text-${colorScheme?.text} text-sm`}>
Retrofunding
</span>
) : null}
</Badge>
</span>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test:watch": "vitest watch"
},
"dependencies": {
"@allo-team/allo-v2-sdk": "1.0.79",
"@allo-team/allo-v2-sdk": "1.1.1",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@gitcoin/gitcoin-chain-data": "^1.0.43",
Expand Down
18 changes: 18 additions & 0 deletions packages/common/src/allo/backends/allo-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
DonationVotingMerkleDistributionDirectTransferStrategyAbi,
DonationVotingMerkleDistributionStrategy,
DonationVotingMerkleDistributionStrategyTypes,
EasyRetroFundingStrategy,
Registry,
RegistryAbi,
StrategyFactory,
Expand Down Expand Up @@ -730,6 +731,23 @@ export class AlloV2 implements Allo {
break;
}

case RoundCategory.Retrofunding: {
const strategyInstance = new EasyRetroFundingStrategy({
chain: this.chainId,
poolId: BigInt(args.roundId),
});

registerRecipientTx = strategyInstance.getRegisterRecipientData({
registryAnchor: args.projectId,
recipientAddress: metadata.application.recipient,
metadata: {
protocol: 1n,
pointer: ipfsResult.value,
},
});
break;
}

default:
throw new AlloError("Unsupported strategy");
}
Expand Down
8 changes: 7 additions & 1 deletion packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ export type RoundPayoutTypeNew =
| "allov2.DirectAllocationStrategy"
| ""; // This is to handle the cases where the strategyName is not set in a round, mostly spam rounds

export type RoundStrategyType = "QuadraticFunding" | "DirectGrants";
export type RoundStrategyType = "QuadraticFunding" | "DirectGrants" | "Retrofunding";

export function getRoundStrategyTitle(name: string) {
switch (getRoundStrategyType(name)) {
Expand All @@ -359,6 +359,9 @@ export function getRoundStrategyTitle(name: string) {

case "QuadraticFunding":
return "Quadratic Funding";

case "Retrofunding":
return "Retro Funding";
}
}

Expand All @@ -375,6 +378,9 @@ export function getRoundStrategyType(name: string): RoundStrategyType {
case "allov2.DonationVotingMerkleDistributionDirectTransferStrategy":
return "QuadraticFunding";

case "allov2.EasyRetroFundingStrategy":
return "Retrofunding";

default:
throw new Error(`Unknown round strategy type: ${name}`);
}
Expand Down
1 change: 1 addition & 0 deletions packages/data-layer/src/data.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type RoundVisibilityType = "public" | "private";
export enum RoundCategory {
QuadraticFunding,
Direct,
Retrofunding,
}

export type ApplicationStatus =
Expand Down
3 changes: 3 additions & 0 deletions packages/data-layer/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ export const strategyNameToCategory = (
case "allov2.DirectGrantsLiteStrategy":
return RoundCategory.Direct;

case "allov2.EasyRetroFundingStrategy":
return RoundCategory.Retrofunding;

case "allov1.QF":
case "allov2.DonationVotingMerkleDistributionDirectTransferStrategy":
return RoundCategory.QuadraticFunding;
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b87b020

Please sign in to comment.