Skip to content

Commit

Permalink
start for updates on DV
Browse files Browse the repository at this point in the history
  • Loading branch information
codenamejason committed Feb 27, 2024
1 parent 1c2d890 commit b174ed1
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 45 deletions.
12 changes: 12 additions & 0 deletions artifacts/artifacts.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// This file was autogenerated by hardhat-viem, do not edit it.
// prettier-ignore
// tslint:disable
// eslint-disable

import "hardhat/types/artifacts";

declare module "hardhat/types/artifacts" {
interface ArtifactsMap {

}
}
2 changes: 1 addition & 1 deletion dist/__live__/createSuperfluidpool.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const createPool = () => __awaiter(void 0, void 0, void 0, function* () {
const params = {
useRegistryAnchor: true,
metadataRequired: false,
passportDecoder: "0xE7eB5D2b5b188777df902e89c54570E7Ef4F59CE", // todo: remove dummy address
passportDecoder: "0xE7eB5D2b5b188777df902e89c54570E7Ef4F59CE",
superfluidHost: "0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9",
allocationSuperToken: "0xf2d68898557ccb2cf4c10c3ef2b034b2a69dad00",
registrationStartTime: BigInt((startDate.getTime() / 1000 - 100).toFixed(0)),
Expand Down
4 changes: 2 additions & 2 deletions dist/strategies/DirectGrants/DirectGrantsStrategy.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ class DirectGrantsStrategy {
params.registryGating,
params.metadataRequired,
params.grantAmountRequired,
BigInt(params.registrationStartTime),
BigInt(params.registrationEndTime),
params.registrationStartTime,
params.registrationEndTime,
]);
return encoded;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ export type Permit2Data = {
permit: PermitTransferFrom;
signature: `0x${string}`;
};
export type PermitType = "Permit" | "Permit2" | "PermitDAI";
export type Allocation = {
recipientId: `0x${string}`;
permitType: PermitType;
permit2Data: Permit2Data;
};
export type Claim = {
Expand Down
2 changes: 1 addition & 1 deletion dist/strategies/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ var Status;
Status[Status["Appealed"] = 4] = "Appealed";
Status[Status["InReview"] = 5] = "InReview";
Status[Status["Canceled"] = 6] = "Canceled";
})(Status || (exports.Status = Status = {}));
})(Status = exports.Status || (exports.Status = {}));
4 changes: 2 additions & 2 deletions package-lock.json

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

46 changes: 23 additions & 23 deletions src/strategies/DirectGrants/DirectGrantsStrategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ export class DirectGrantsStrategy {
params.registryGating,
params.metadataRequired,
params.grantAmountRequired,
BigInt(params.registrationStartTime),
BigInt(params.registrationEndTime),
],
params.registrationStartTime,
params.registrationEndTime,
]
);

return encoded;
Expand All @@ -80,7 +80,7 @@ export class DirectGrantsStrategy {
public getDeployParams(): DeployParams {
const constructorArgs: `0x${string}` = encodeAbiParameters(
parseAbiParameters("address, string"),
[this.allo.address(), "DirectGrantsSimpleStrategy1.1"],
[this.allo.address(), "DirectGrantsSimpleStrategy1.1"]
);
const constructorArgsNo0x = constructorArgs.slice(2);

Expand Down Expand Up @@ -111,14 +111,14 @@ export class DirectGrantsStrategy {
private checkPoolId(): void {
if (this.poolId === -1)
throw new Error(
"DirectGrantsStrategy: No poolId provided. Please call `setPoolId` first.",
"DirectGrantsStrategy: No poolId provided. Please call `setPoolId` first."
);
}

private checkStrategy(): void {
if (!this.strategy)
throw new Error(
"DirectGrantsStrategy: No strategy address provided. Please call `setContract` first.",
"DirectGrantsStrategy: No strategy address provided. Please call `setContract` first."
);
}

Expand Down Expand Up @@ -223,7 +223,7 @@ export class DirectGrantsStrategy {

public async getMilestoneStatus(
recipientId: `0x${string}`,
milestoneId: number,
milestoneId: number
): Promise<Status> {
this.checkStrategy();

Expand All @@ -236,7 +236,7 @@ export class DirectGrantsStrategy {
}

public async getMilestones(
recipientAddress: `0x${string}`,
recipientAddress: `0x${string}`
): Promise<`0x${string}`> {
this.checkStrategy();

Expand All @@ -258,7 +258,7 @@ export class DirectGrantsStrategy {
}

public async getPayouts(
recipientIds: `0x${string}`[],
recipientIds: `0x${string}`[]
): Promise<PayoutSummary[]> {
this.checkStrategy();

Expand Down Expand Up @@ -287,7 +287,7 @@ export class DirectGrantsStrategy {
this.checkPoolId();
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("uint256"),
[BigInt(amount)],
[BigInt(amount)]
);

const encodedData = encodeFunctionData({
Expand All @@ -305,7 +305,7 @@ export class DirectGrantsStrategy {

public getSetMilestonesData(
recipientId: `0x${string}`,
milestones: Milestone[],
milestones: Milestone[]
): TransactionData {
this.checkPoolId();
const encodedMilestones: `0x${string}`[] = [];
Expand All @@ -317,7 +317,7 @@ export class DirectGrantsStrategy {
BigInt(milestone.amountPercentage),
[milestone.metadata.protocol, milestone.metadata.pointer],
BigInt(milestone.milestoneStatus),
],
]
);

encodedMilestones.push(encoded);
Expand All @@ -338,12 +338,12 @@ export class DirectGrantsStrategy {

public getReviewSetMilestonesData(
recipientId: `0x${string}`,
status: Status,
status: Status
): TransactionData {
this.checkPoolId();
const encoded = encodeAbiParameters(
parseAbiParameters("address, uint256"),
[recipientId, BigInt(status)],
[recipientId, BigInt(status)]
);

return {
Expand All @@ -356,7 +356,7 @@ export class DirectGrantsStrategy {
public getSubmitMilestonesData(
recipientId: `0x${string}`,
milestoneId: number,
metadata: Metadata,
metadata: Metadata
): TransactionData {
this.checkPoolId();

Expand All @@ -375,7 +375,7 @@ export class DirectGrantsStrategy {

public getRejectMilestoneData(
recipientId: `0x${string}`,
milestoneId: number,
milestoneId: number
): TransactionData {
this.checkPoolId();

Expand All @@ -393,7 +393,7 @@ export class DirectGrantsStrategy {
}

public getSetRecipientStatusToInReviewData(
recipientIds: `0x${string}`[],
recipientIds: `0x${string}`[]
): TransactionData {
this.checkPoolId();

Expand Down Expand Up @@ -435,7 +435,7 @@ export class DirectGrantsStrategy {
data.recipientAddress,
data.grantAmount,
[data.metadata.protocol, data.metadata.pointer],
],
]
);

const encodedData = encodeFunctionData({
Expand Down Expand Up @@ -463,7 +463,7 @@ export class DirectGrantsStrategy {
registerData.recipientAddress,
registerData.grantAmount,
[registerData.metadata.protocol, registerData.metadata.pointer],
],
]
);

encodedParams.push(encoded);
Expand All @@ -487,12 +487,12 @@ export class DirectGrantsStrategy {
public getAllocationData(
recipientId: `0x${string}`,
status: Status,
grantAmount: bigint,
grantAmount: bigint
): TransactionData {
this.checkPoolId();
const encoded: `0x${string}` = encodeAbiParameters(
parseAbiParameters("address, uint8, uint256"),
[recipientId, status, grantAmount],
[recipientId, status, grantAmount]
);

const encodedData = encodeFunctionData({
Expand Down Expand Up @@ -520,7 +520,7 @@ export class DirectGrantsStrategy {
allocation.recipientId,
allocation.status,
BigInt(allocation.grantAmount),
],
]
);

encodedParams.push(encoded);
Expand Down Expand Up @@ -562,7 +562,7 @@ export class DirectGrantsStrategy {

public getUpdatePoolTimestampsData(
registrationStartTime: bigint,
registrationEndTime: bigint,
registrationEndTime: bigint
): TransactionData {
this.checkStrategy();
const encodedData = encodeFunctionData({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,11 @@ export type Permit2Data = {
signature: `0x${string}`;
};

export type PermitType = "Permit" | "Permit2" | "PermitDAI";

export type Allocation = {
recipientId: `0x${string}`;
permitType: PermitType;
permit2Data: Permit2Data;
};

Expand Down
24 changes: 8 additions & 16 deletions test/DirectGrants.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import { expect } from "chai";
import * as dotenv from "dotenv";
import {
AbiCoder,
Contract,
ContractFactory,
JsonRpcProvider,
keccak256,
solidityPackedKeccak256,
toUtf8Bytes,
} from "ethers";
import { AbiCoder, JsonRpcProvider, keccak256 } from "ethers";
import { Log } from "viem";
import { Allo } from "../src/Allo/Allo";
import { CreatePoolArgs } from "../src/Allo/types";
Expand Down Expand Up @@ -63,9 +55,9 @@ describe("DirectGrantsStrategy", function () {
});

describe("should test deployed successfully", () => {
it("DirectGrantsStrategy SHOULD deploy properly", async () => {
it.skip("DirectGrantsStrategy SHOULD deploy properly", async () => {
const idString = keccak256(
new AbiCoder().encode(["string"], ["DirectGrantsv1"]),
new AbiCoder().encode(["string"], ["DirectGrantsv1.1"])
);
const deployedIdString = await strategy.getStrategyId();

Expand Down Expand Up @@ -109,8 +101,6 @@ describe("DirectGrantsStrategy", function () {
blockHash: receipt.blockHash,
});

console.log("logs", logs);

// todo: get the profile id from the logs
const iface = new ethers.Interface(registryAbi);

Expand All @@ -124,14 +114,16 @@ describe("DirectGrantsStrategy", function () {
});

// todo:
it("should create a pool and initialize", async () => {
it.skip("should create a pool and initialize", async () => {
const [user] = await ethers.getSigners();

// Create a pool and initialize it
const initParams: InitializeParams = {
registryGating: true,
metadataRequired: true,
grantAmountRequired: true,
registrationStartTime: BigInt(0),
registrationEndTime: BigInt(0),
};
const initStrategyData = strategy.getInitializeData(initParams);
const poolCreationData: CreatePoolArgs = {
Expand Down Expand Up @@ -221,11 +213,11 @@ const sendRawTx = async (signer: any, txData: TransactionData) => {};

const deployContract = async (
signer: any,
dpData: DeployParams,
dpData: DeployParams
): Promise<`0x${string}`> => {
const response = await signer.sendTransaction({
data: dpData.bytecode,
});
const receipt = await response.wait();
return receipt.contractAddress as `0x${string}`;
};
};

0 comments on commit b174ed1

Please sign in to comment.