@show-karma/karma-gap-sdk 0.3.23 → 0.3.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/abi/Allo.json +864 -0
- package/core/abi/AlloRegistry.json +582 -0
- package/core/class/Attestation.js +1 -1
- package/core/class/GrantProgramRegistry/Allo.d.ts +16 -0
- package/core/class/GrantProgramRegistry/Allo.js +86 -0
- package/core/class/GrantProgramRegistry/AlloRegistry.d.ts +14 -0
- package/core/class/GrantProgramRegistry/AlloRegistry.js +64 -0
- package/core/class/Schema.js +2 -0
- package/core/class/entities/Project.d.ts +2 -1
- package/core/class/entities/Project.js +3 -2
- package/core/class/entities/ProjectImpact.d.ts +43 -0
- package/core/class/entities/ProjectImpact.js +89 -0
- package/core/class/types/allo.d.ts +78 -0
- package/core/class/types/allo.js +2 -0
- package/core/class/types/attestations.d.ts +0 -15
- package/core/class/types/attestations.js +1 -8
- package/core/consts.d.ts +18 -0
- package/core/consts.js +67 -3
- package/core/types.d.ts +8 -8
- package/package.json +2 -1
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AlloBase = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const Allo_json_1 = __importDefault(require("../../abi/Allo.json"));
|
|
9
|
+
const consts_1 = require("../../consts");
|
|
10
|
+
const ethers_2 = require("ethers");
|
|
11
|
+
const allo_v2_sdk_1 = require("@allo-team/allo-v2-sdk/");
|
|
12
|
+
class AlloBase {
|
|
13
|
+
constructor(signer, ipfsStorage, chainId) {
|
|
14
|
+
this.signer = signer;
|
|
15
|
+
this.contract = new ethers_1.ethers.Contract(consts_1.AlloContracts.alloProxy, Allo_json_1.default, signer);
|
|
16
|
+
this.allo = new allo_v2_sdk_1.Allo({ chain: chainId });
|
|
17
|
+
AlloBase.ipfsClient = ipfsStorage;
|
|
18
|
+
}
|
|
19
|
+
async saveAndGetCID(data) {
|
|
20
|
+
try {
|
|
21
|
+
const blob = new Blob([JSON.stringify(data)], {
|
|
22
|
+
type: "application/json",
|
|
23
|
+
});
|
|
24
|
+
const cid = await AlloBase.ipfsClient.storeBlob(blob);
|
|
25
|
+
return cid;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw new Error(`Error adding data to IPFS: ${error}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async encodeStrategyInitData(applicationStart, applicationEnd, roundStart, roundEnd, payoutToken) {
|
|
32
|
+
const encoder = new ethers_2.AbiCoder();
|
|
33
|
+
const initStrategyData = encoder.encode(["bool", "bool", "uint256", "uint256", "uint256", "uint256", "address[]"], [
|
|
34
|
+
false, // useRegistryAnchor
|
|
35
|
+
true, // metadataRequired
|
|
36
|
+
applicationStart, // Eg. Curr + 1 hour later registrationStartTime
|
|
37
|
+
applicationEnd, // Eg. Curr + 5 days later registrationEndTime
|
|
38
|
+
roundStart, // Eg. Curr + 2 hours later allocationStartTime
|
|
39
|
+
roundEnd, // Eg. Curr + 10 days later allocaitonEndTime
|
|
40
|
+
[payoutToken],
|
|
41
|
+
]);
|
|
42
|
+
return initStrategyData;
|
|
43
|
+
}
|
|
44
|
+
async createGrant(args) {
|
|
45
|
+
console.log("Creating grant...");
|
|
46
|
+
const walletBalance = await this.signer.provider.getBalance(await this.signer.getAddress());
|
|
47
|
+
console.log("Wallet balance:", (0, ethers_1.formatEther)(walletBalance.toString()), " ETH");
|
|
48
|
+
try {
|
|
49
|
+
const metadata_cid = await this.saveAndGetCID({
|
|
50
|
+
round: args.roundMetadata,
|
|
51
|
+
application: args.applicationMetadata,
|
|
52
|
+
});
|
|
53
|
+
const metadata = {
|
|
54
|
+
protocol: BigInt(1),
|
|
55
|
+
pointer: metadata_cid,
|
|
56
|
+
};
|
|
57
|
+
const initStrategyData = (await this.encodeStrategyInitData(args.applicationStart, args.applicationEnd, args.roundStart, args.roundEnd, args.payoutToken));
|
|
58
|
+
const createPoolArgs = {
|
|
59
|
+
profileId: args.profileId,
|
|
60
|
+
strategy: args.strategy,
|
|
61
|
+
initStrategyData: initStrategyData, // unique to the strategy
|
|
62
|
+
token: args.payoutToken,
|
|
63
|
+
amount: BigInt(args.matchingFundAmt),
|
|
64
|
+
metadata: metadata,
|
|
65
|
+
managers: args.managers,
|
|
66
|
+
};
|
|
67
|
+
const txData = this.allo.createPool(createPoolArgs);
|
|
68
|
+
const tx = await this.signer.sendTransaction({
|
|
69
|
+
data: txData.data,
|
|
70
|
+
to: txData.to,
|
|
71
|
+
value: BigInt(txData.value),
|
|
72
|
+
});
|
|
73
|
+
const receipt = await tx.wait();
|
|
74
|
+
// Get ProfileCreated event
|
|
75
|
+
const poolId = receipt.logs[receipt.logs.length - 1].topics[0];
|
|
76
|
+
return {
|
|
77
|
+
poolId: poolId,
|
|
78
|
+
txHash: tx.hash,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
console.error(`Failed to create pool: ${error}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.AlloBase = AlloBase;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ethers } from "ethers";
|
|
2
|
+
import { ProfileMetadata } from "../types/allo";
|
|
3
|
+
import { NFTStorage } from "nft.storage";
|
|
4
|
+
export declare class AlloRegistry {
|
|
5
|
+
private contract;
|
|
6
|
+
private static ipfsClient;
|
|
7
|
+
constructor(signer: ethers.Signer, ipfsStorage: NFTStorage);
|
|
8
|
+
saveAndGetCID(data: any): Promise<import("nft.storage").CIDString>;
|
|
9
|
+
createProgram(nonce: number, name: string, profileMetadata: ProfileMetadata, owner: string, members: string[]): Promise<{
|
|
10
|
+
profileId: any;
|
|
11
|
+
txHash: any;
|
|
12
|
+
}>;
|
|
13
|
+
updateProgramMetadata(profileId: string, profileMetadata: ProfileMetadata): Promise<any>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AlloRegistry = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const AlloRegistry_json_1 = __importDefault(require("../../abi/AlloRegistry.json"));
|
|
9
|
+
const consts_1 = require("../../consts");
|
|
10
|
+
class AlloRegistry {
|
|
11
|
+
constructor(signer, ipfsStorage) {
|
|
12
|
+
this.contract = new ethers_1.ethers.Contract(consts_1.AlloContracts.registry, AlloRegistry_json_1.default, signer);
|
|
13
|
+
AlloRegistry.ipfsClient = ipfsStorage;
|
|
14
|
+
}
|
|
15
|
+
async saveAndGetCID(data) {
|
|
16
|
+
try {
|
|
17
|
+
const blob = new Blob([JSON.stringify(data)], {
|
|
18
|
+
type: "application/json",
|
|
19
|
+
});
|
|
20
|
+
const cid = await AlloRegistry.ipfsClient.storeBlob(blob);
|
|
21
|
+
return cid;
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
throw new Error(`Error adding data to IPFS: ${error}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async createProgram(nonce, name, profileMetadata, owner, members) {
|
|
28
|
+
console.log("Creating program...");
|
|
29
|
+
try {
|
|
30
|
+
const metadata_cid = await this.saveAndGetCID(profileMetadata);
|
|
31
|
+
const metadata = {
|
|
32
|
+
protocol: 1,
|
|
33
|
+
pointer: metadata_cid,
|
|
34
|
+
};
|
|
35
|
+
const tx = await this.contract.createProfile(nonce, name, metadata, owner, members);
|
|
36
|
+
const receipt = await tx.wait();
|
|
37
|
+
// Get ProfileCreated event
|
|
38
|
+
const profileCreatedEvent = receipt.logs.find((event) => event.eventName === "ProfileCreated");
|
|
39
|
+
return {
|
|
40
|
+
profileId: profileCreatedEvent.args[0],
|
|
41
|
+
txHash: receipt.hash,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
console.error(`Failed to register program: ${error}`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async updateProgramMetadata(profileId, profileMetadata) {
|
|
49
|
+
try {
|
|
50
|
+
const metadata_cid = await this.saveAndGetCID(profileMetadata);
|
|
51
|
+
const metadata = {
|
|
52
|
+
protocol: 1,
|
|
53
|
+
pointer: metadata_cid,
|
|
54
|
+
};
|
|
55
|
+
const tx = await this.contract.updateProfileMetadata(profileId, metadata);
|
|
56
|
+
const receipt = await tx.wait();
|
|
57
|
+
return receipt;
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
console.error(`Failed to update profile metadata: ${error}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.AlloRegistry = AlloRegistry;
|
package/core/class/Schema.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { Attestation } from '../Attestation';
|
|
2
|
-
import { Grantee, MemberDetails, ProjectDetails, ProjectEndorsement
|
|
2
|
+
import { Grantee, MemberDetails, ProjectDetails, ProjectEndorsement } from '../types/attestations';
|
|
3
3
|
import { Hex, MultiAttestPayload, SignerOrProvider, TNetwork } from 'core/types';
|
|
4
4
|
import { Grant } from './Grant';
|
|
5
5
|
import { MemberOf } from './MemberOf';
|
|
6
6
|
import { IProjectResponse } from '../karma-indexer/api/types';
|
|
7
|
+
import { ProjectImpact } from './ProjectImpact';
|
|
7
8
|
export interface IProject {
|
|
8
9
|
project: true;
|
|
9
10
|
}
|
|
@@ -10,6 +10,7 @@ const consts_1 = require("../../consts");
|
|
|
10
10
|
const MemberOf_1 = require("./MemberOf");
|
|
11
11
|
const GapContract_1 = require("../contract/GapContract");
|
|
12
12
|
const AllGapSchemas_1 = require("../AllGapSchemas");
|
|
13
|
+
const ProjectImpact_1 = require("./ProjectImpact");
|
|
13
14
|
class Project extends Attestation_1.Attestation {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
@@ -246,7 +247,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
246
247
|
}
|
|
247
248
|
if (attestation.impacts) {
|
|
248
249
|
project.impacts = attestation.impacts.map((pi) => {
|
|
249
|
-
const impact = new
|
|
250
|
+
const impact = new ProjectImpact_1.ProjectImpact({
|
|
250
251
|
...pi,
|
|
251
252
|
data: {
|
|
252
253
|
...pi.data,
|
|
@@ -274,7 +275,7 @@ class Project extends Attestation_1.Attestation {
|
|
|
274
275
|
});
|
|
275
276
|
}
|
|
276
277
|
async attestImpact(signer, data) {
|
|
277
|
-
const projectImpact = new
|
|
278
|
+
const projectImpact = new ProjectImpact_1.ProjectImpact({
|
|
278
279
|
data: {
|
|
279
280
|
...data,
|
|
280
281
|
type: 'project-impact',
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SignerOrProvider, TNetwork } from '../../types';
|
|
2
|
+
import { Attestation, AttestationArgs } from '../Attestation';
|
|
3
|
+
import { GapSchema } from '../GapSchema';
|
|
4
|
+
export interface _IProjectImpact extends ProjectImpact {
|
|
5
|
+
}
|
|
6
|
+
type IStatus = 'verified';
|
|
7
|
+
export interface IProjectImpactStatus {
|
|
8
|
+
type: `project-impact-${IStatus}`;
|
|
9
|
+
reason?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare class ProjectImpactStatus extends Attestation<IProjectImpactStatus> implements IProjectImpactStatus {
|
|
12
|
+
type: `project-impact-${IStatus}`;
|
|
13
|
+
reason?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IProjectImpact {
|
|
16
|
+
work: string;
|
|
17
|
+
impact: string;
|
|
18
|
+
proof: string;
|
|
19
|
+
completedAt: number;
|
|
20
|
+
type?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class ProjectImpact extends Attestation<IProjectImpact> implements IProjectImpact {
|
|
23
|
+
work: string;
|
|
24
|
+
impact: string;
|
|
25
|
+
proof: string;
|
|
26
|
+
completedAt: number;
|
|
27
|
+
type?: string;
|
|
28
|
+
verified: ProjectImpactStatus[];
|
|
29
|
+
constructor(data: AttestationArgs<IProjectImpact, GapSchema>);
|
|
30
|
+
/**
|
|
31
|
+
* Attest Project Impact.
|
|
32
|
+
*/
|
|
33
|
+
private attestStatus;
|
|
34
|
+
/**
|
|
35
|
+
* Verify this ProjectImpact. If the ProjectImpact is not already verified,
|
|
36
|
+
* it will throw an error.
|
|
37
|
+
* @param signer
|
|
38
|
+
* @param reason
|
|
39
|
+
*/
|
|
40
|
+
verify(signer: SignerOrProvider, reason?: string): Promise<void>;
|
|
41
|
+
static from(attestations: _IProjectImpact[], network: TNetwork): ProjectImpact[];
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProjectImpact = exports.ProjectImpactStatus = void 0;
|
|
4
|
+
const Attestation_1 = require("../Attestation");
|
|
5
|
+
const SchemaError_1 = require("../SchemaError");
|
|
6
|
+
const AllGapSchemas_1 = require("../AllGapSchemas");
|
|
7
|
+
const consts_1 = require("../../consts");
|
|
8
|
+
class ProjectImpactStatus extends Attestation_1.Attestation {
|
|
9
|
+
}
|
|
10
|
+
exports.ProjectImpactStatus = ProjectImpactStatus;
|
|
11
|
+
class ProjectImpact extends Attestation_1.Attestation {
|
|
12
|
+
constructor(data) {
|
|
13
|
+
data.data.type = "project-impact";
|
|
14
|
+
super(data);
|
|
15
|
+
this.verified = [];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Attest Project Impact.
|
|
19
|
+
*/
|
|
20
|
+
async attestStatus(signer, schema) {
|
|
21
|
+
const eas = this.schema.gap.eas.connect(signer);
|
|
22
|
+
try {
|
|
23
|
+
const tx = await eas.attest({
|
|
24
|
+
schema: schema.uid,
|
|
25
|
+
data: {
|
|
26
|
+
recipient: this.recipient,
|
|
27
|
+
data: schema.encode(),
|
|
28
|
+
refUID: this.uid,
|
|
29
|
+
expirationTime: 0n,
|
|
30
|
+
revocable: schema.revocable,
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const uid = await tx.wait();
|
|
34
|
+
console.log(uid);
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
console.error(error);
|
|
38
|
+
throw new SchemaError_1.AttestationError('ATTEST_ERROR', error.message);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Verify this ProjectImpact. If the ProjectImpact is not already verified,
|
|
43
|
+
* it will throw an error.
|
|
44
|
+
* @param signer
|
|
45
|
+
* @param reason
|
|
46
|
+
*/
|
|
47
|
+
async verify(signer, reason = '') {
|
|
48
|
+
console.log('Verifying ProjectImpact');
|
|
49
|
+
const schema = this.schema.gap.findSchema('GrantUpdateStatus');
|
|
50
|
+
schema.setValue('type', 'project-impact-verified');
|
|
51
|
+
schema.setValue('reason', reason);
|
|
52
|
+
console.log('Before attest project impact verified');
|
|
53
|
+
await this.attestStatus(signer, schema);
|
|
54
|
+
console.log('After attest project impact verified');
|
|
55
|
+
this.verified.push(new ProjectImpactStatus({
|
|
56
|
+
data: {
|
|
57
|
+
type: 'project-impact-verified',
|
|
58
|
+
reason,
|
|
59
|
+
},
|
|
60
|
+
refUID: this.uid,
|
|
61
|
+
schema: schema,
|
|
62
|
+
recipient: this.recipient,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
static from(attestations, network) {
|
|
66
|
+
return attestations.map((attestation) => {
|
|
67
|
+
const grantUpdate = new ProjectImpact({
|
|
68
|
+
...attestation,
|
|
69
|
+
data: {
|
|
70
|
+
...attestation.data,
|
|
71
|
+
},
|
|
72
|
+
schema: new AllGapSchemas_1.AllGapSchemas().findSchema('ProjectImpact', consts_1.chainIdToNetwork[attestation.chainID]),
|
|
73
|
+
chainID: attestation.chainID,
|
|
74
|
+
});
|
|
75
|
+
if (attestation.verified?.length > 0) {
|
|
76
|
+
grantUpdate.verified = attestation.verified.map(m => new ProjectImpactStatus({
|
|
77
|
+
...m,
|
|
78
|
+
data: {
|
|
79
|
+
...m.data,
|
|
80
|
+
},
|
|
81
|
+
schema: new AllGapSchemas_1.AllGapSchemas().findSchema('GrantUpdateStatus', consts_1.chainIdToNetwork[attestation.chainID]),
|
|
82
|
+
chainID: attestation.chainID,
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
return grantUpdate;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.ProjectImpact = ProjectImpact;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export type RoundMetadata = {
|
|
2
|
+
name: string;
|
|
3
|
+
support: {
|
|
4
|
+
info: string;
|
|
5
|
+
type: string;
|
|
6
|
+
};
|
|
7
|
+
roundType: "public" | string;
|
|
8
|
+
eligibility: {
|
|
9
|
+
description: string;
|
|
10
|
+
requirements: Array<{
|
|
11
|
+
requirement: string;
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
feesAddress: string;
|
|
15
|
+
feesPercentage: number;
|
|
16
|
+
programContractAddress: string;
|
|
17
|
+
quadraticFundingConfig?: {
|
|
18
|
+
matchingCap: boolean;
|
|
19
|
+
sybilDefense: boolean;
|
|
20
|
+
matchingCapAmount: number;
|
|
21
|
+
minDonationThreshold: boolean;
|
|
22
|
+
matchingFundsAvailable: number;
|
|
23
|
+
minDonationThresholdAmount: number;
|
|
24
|
+
};
|
|
25
|
+
category: string;
|
|
26
|
+
source: string;
|
|
27
|
+
};
|
|
28
|
+
export type Address = `0x${string}`;
|
|
29
|
+
export type GrantArgs = {
|
|
30
|
+
profileId: Address;
|
|
31
|
+
roundMetadata: RoundMetadata;
|
|
32
|
+
applicationStart: number;
|
|
33
|
+
applicationEnd: number;
|
|
34
|
+
roundStart: number;
|
|
35
|
+
roundEnd: number;
|
|
36
|
+
matchingFundAmt: number;
|
|
37
|
+
applicationMetadata: ApplicationMetadata;
|
|
38
|
+
managers: Address[];
|
|
39
|
+
strategy: Address;
|
|
40
|
+
payoutToken: Address;
|
|
41
|
+
};
|
|
42
|
+
export type ApplicationMetadata = {
|
|
43
|
+
version: string;
|
|
44
|
+
lastUpdatedOn: number;
|
|
45
|
+
applicationSchema: {
|
|
46
|
+
questions: Array<{
|
|
47
|
+
id: number;
|
|
48
|
+
info: string;
|
|
49
|
+
type: "email" | "short-answer" | "link" | "number" | "paragraph" | "address" | "checkbox" | "multiple-choice";
|
|
50
|
+
title: string;
|
|
51
|
+
hidden: boolean;
|
|
52
|
+
choices?: string[];
|
|
53
|
+
required: boolean;
|
|
54
|
+
encrypted: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
requirements: {
|
|
57
|
+
github: {
|
|
58
|
+
required: boolean;
|
|
59
|
+
verification: boolean;
|
|
60
|
+
};
|
|
61
|
+
twitter: {
|
|
62
|
+
required: boolean;
|
|
63
|
+
verification: boolean;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export type ProfileMetadata = {
|
|
69
|
+
title: string;
|
|
70
|
+
description: string;
|
|
71
|
+
website: string;
|
|
72
|
+
projectTwitter: string;
|
|
73
|
+
logoImg: string;
|
|
74
|
+
bannerImg: string;
|
|
75
|
+
logoImgData: any;
|
|
76
|
+
bannerImgData: any;
|
|
77
|
+
createdAt: number;
|
|
78
|
+
};
|
|
@@ -118,21 +118,6 @@ export interface IGrantDetailsQuestion {
|
|
|
118
118
|
explanation: string;
|
|
119
119
|
type: string;
|
|
120
120
|
}
|
|
121
|
-
export interface IProjectImpact {
|
|
122
|
-
work: string;
|
|
123
|
-
impact: string;
|
|
124
|
-
proof: string;
|
|
125
|
-
completedAt: number;
|
|
126
|
-
type?: string;
|
|
127
|
-
}
|
|
128
|
-
export declare class ProjectImpact extends Attestation<IProjectImpact> implements IProjectImpact {
|
|
129
|
-
work: string;
|
|
130
|
-
impact: string;
|
|
131
|
-
proof: string;
|
|
132
|
-
completedAt: number;
|
|
133
|
-
type?: string;
|
|
134
|
-
constructor(data: AttestationArgs<IProjectImpact, GapSchema>);
|
|
135
|
-
}
|
|
136
121
|
export interface IProjectEndorsement {
|
|
137
122
|
comment?: string;
|
|
138
123
|
type?: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ProjectEndorsement = exports.
|
|
3
|
+
exports.ProjectEndorsement = exports.GrantCompleted = exports.Grantee = exports.ProjectDetails = exports.Tag = exports.MilestoneCompleted = exports.MemberDetails = exports.GrantVerified = exports.GrantRound = exports.GrantDetails = exports.CommunityDetails = void 0;
|
|
4
4
|
const Attestation_1 = require("../Attestation");
|
|
5
5
|
const GrantUpdate_1 = require("../entities/GrantUpdate");
|
|
6
6
|
class CommunityDetails extends Attestation_1.Attestation {
|
|
@@ -54,13 +54,6 @@ exports.Grantee = Grantee;
|
|
|
54
54
|
class GrantCompleted extends GrantUpdate_1.GrantUpdate {
|
|
55
55
|
}
|
|
56
56
|
exports.GrantCompleted = GrantCompleted;
|
|
57
|
-
class ProjectImpact extends Attestation_1.Attestation {
|
|
58
|
-
constructor(data) {
|
|
59
|
-
data.data.type = "project-impact";
|
|
60
|
-
super(data);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.ProjectImpact = ProjectImpact;
|
|
64
57
|
class ProjectEndorsement extends Attestation_1.Attestation {
|
|
65
58
|
constructor(data) {
|
|
66
59
|
data.data.type = "project-endorsement";
|
package/core/consts.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare const chainIdToNetwork: {
|
|
|
9
9
|
42161: string;
|
|
10
10
|
10: string;
|
|
11
11
|
11155111: string;
|
|
12
|
+
84532: string;
|
|
12
13
|
};
|
|
13
14
|
export declare const nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
14
15
|
export declare const nullResolver = "0x0000000000000000000000000000000000000000";
|
|
@@ -23,3 +24,20 @@ export declare const Networks: Record<TNetwork, EASNetworkConfig>;
|
|
|
23
24
|
* @returns
|
|
24
25
|
*/
|
|
25
26
|
export declare const MountEntities: (network: EASNetworkConfig) => Record<TSchemaName, SchemaInterface<TSchemaName>>;
|
|
27
|
+
export declare const alloSupportedNetworks: {
|
|
28
|
+
mainnet: number[];
|
|
29
|
+
testnet: number[];
|
|
30
|
+
};
|
|
31
|
+
export declare const AlloContracts: {
|
|
32
|
+
registry: string;
|
|
33
|
+
alloProxy: string;
|
|
34
|
+
alloImplementation: string;
|
|
35
|
+
strategy: {
|
|
36
|
+
DonationVotingMerkleDistributionDirectTransferStrategy: string;
|
|
37
|
+
DirectGrantsSimpleStrategy: string;
|
|
38
|
+
RFPSimpleStrategy: string;
|
|
39
|
+
RFPCommitteeStrategy: string;
|
|
40
|
+
QVSimple: string;
|
|
41
|
+
};
|
|
42
|
+
factory: string;
|
|
43
|
+
};
|
package/core/consts.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MountEntities = exports.Networks = exports.zeroAddress = exports.nullResolver = exports.nullRef = exports.chainIdToNetwork = exports.useDefaultAttestation = void 0;
|
|
3
|
+
exports.AlloContracts = exports.alloSupportedNetworks = exports.MountEntities = exports.Networks = exports.zeroAddress = exports.nullResolver = exports.nullRef = exports.chainIdToNetwork = exports.useDefaultAttestation = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* Schemas that should use default EAS attestation
|
|
6
6
|
* instead of the custom contract.
|
|
@@ -10,13 +10,14 @@ exports.useDefaultAttestation = [
|
|
|
10
10
|
"MilestoneCompleted",
|
|
11
11
|
"GrantVerified",
|
|
12
12
|
"Community",
|
|
13
|
-
"GrantUpdateStatus"
|
|
13
|
+
"GrantUpdateStatus",
|
|
14
14
|
];
|
|
15
15
|
exports.chainIdToNetwork = {
|
|
16
16
|
11155420: 'optimism-sepolia',
|
|
17
17
|
42161: 'arbitrum',
|
|
18
18
|
10: 'optimism',
|
|
19
|
-
11155111: 'sepolia'
|
|
19
|
+
11155111: 'sepolia',
|
|
20
|
+
84532: 'base-sepolia'
|
|
20
21
|
};
|
|
21
22
|
exports.nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
22
23
|
// TODO: Remove null resolver and change usage to zero address
|
|
@@ -120,6 +121,52 @@ exports.Networks = {
|
|
|
120
121
|
Project: "0xec77990a252b54b17673955c774b9712766de5eecb22ca5aa2c440e0e93257fb",
|
|
121
122
|
},
|
|
122
123
|
},
|
|
124
|
+
"base-sepolia": {
|
|
125
|
+
chainId: 84532,
|
|
126
|
+
url: "https://base-sepolia.easscan.org/graphql",
|
|
127
|
+
rpcUrl: "https://sepolia.base.org",
|
|
128
|
+
contracts: {
|
|
129
|
+
eas: "0x4200000000000000000000000000000000000021",
|
|
130
|
+
schema: "0x4200000000000000000000000000000000000020",
|
|
131
|
+
multicall: "0x4Ca7230fB6b78875bdd1B1e4F665B7B7f1891239",
|
|
132
|
+
projectResolver: "0xC891F8eBA218f5034bf3a472528408BE19E1130E",
|
|
133
|
+
communityResolver: "0x009dC7dF3Ea3b23CE80Fd3Ba811d5bA5675934A1",
|
|
134
|
+
},
|
|
135
|
+
schemas: {
|
|
136
|
+
Community: "0xe130107659909d20cbd75a2c82e1988b09b1c08fd39ad6f4397ce27c089e0e95",
|
|
137
|
+
Details: "0x9b06f811608d135f913c18295486693fe626f35e213a7d132be87b1f952e508c",
|
|
138
|
+
Grant: "0x2fb93aac9ef8450a5f615ac6916684d50978ea2a405ac5f918d6d9f367366a78",
|
|
139
|
+
GrantVerified: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
|
|
140
|
+
MemberOf: "0x857398d86e2d31bec5af882b950ee7b00d1fefefba2432737ab28b68ee041eb8",
|
|
141
|
+
MilestoneApproved: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
|
|
142
|
+
MilestoneCompleted: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
|
|
143
|
+
GrantUpdateStatus: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
|
|
144
|
+
Project: "0x5ddd6b7a11406771308431ca9bd146cc717848b74b52993a532dc1aad0ccc83f",
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
"celo": {
|
|
148
|
+
chainId: 42220,
|
|
149
|
+
url: "https://celo.easscan.org/graphql",
|
|
150
|
+
rpcUrl: "https://forno.celo.org",
|
|
151
|
+
contracts: {
|
|
152
|
+
eas: "0x72E1d8ccf5299fb36fEfD8CC4394B8ef7e98Af92",
|
|
153
|
+
schema: "0x5ece93bE4BDCF293Ed61FA78698B594F2135AF34",
|
|
154
|
+
multicall: "0x8791Ac8c099314bB1D1514D76de13a1E80275950",
|
|
155
|
+
projectResolver: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
|
|
156
|
+
communityResolver: "0xfddb660F2F1C27d219372210745BB9f73431856E",
|
|
157
|
+
},
|
|
158
|
+
schemas: {
|
|
159
|
+
Community: "0x3c2231024f4f17f3718b5bd9ed9ff29cc323dea5449f9ceba11a9888bfbdd0e1",
|
|
160
|
+
Details: "0x9895e82115987d8e3e02b35ced92e6a0509293890333f58f50ec291b34853dac",
|
|
161
|
+
Grant: "0x7afa603a89cee2d8f93d30007e2c64efddc6509fd76aa95d2ccd97b6e34acc71",
|
|
162
|
+
GrantVerified: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
163
|
+
MemberOf: "0xb4186a2401f40a4c78768941ef9140e1fbe5fe595053a65d44f31d6df180b712",
|
|
164
|
+
MilestoneApproved: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
165
|
+
MilestoneCompleted: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
166
|
+
GrantUpdateStatus: "0xf45fdf2c064073f0623416571c2746085d785cde5a57fd0696ff88bdf78bcbdc",
|
|
167
|
+
Project: "0xf3f753b41e04d1052b5a5ec7624d1dfdb6c2da288a985120e477ddbcac071022",
|
|
168
|
+
},
|
|
169
|
+
}
|
|
123
170
|
};
|
|
124
171
|
const DetailsSchema = [{ type: "string", name: "json", value: null }];
|
|
125
172
|
/**
|
|
@@ -242,3 +289,20 @@ const MountEntities = (network) => ({
|
|
|
242
289
|
},
|
|
243
290
|
});
|
|
244
291
|
exports.MountEntities = MountEntities;
|
|
292
|
+
exports.alloSupportedNetworks = {
|
|
293
|
+
mainnet: [1, 10, 250, 42220, 42161, 8453, 137, 43114, 534352],
|
|
294
|
+
testnet: [11155111, 11155420, 4002, 44787, 421614, 80001, 43113],
|
|
295
|
+
};
|
|
296
|
+
exports.AlloContracts = {
|
|
297
|
+
registry: "0x4AAcca72145e1dF2aeC137E1f3C5E3D75DB8b5f3",
|
|
298
|
+
alloProxy: "0x1133eA7Af70876e64665ecD07C0A0476d09465a1",
|
|
299
|
+
alloImplementation: "0xB087535DB0df98fC4327136e897A5985E5Cfbd66",
|
|
300
|
+
strategy: {
|
|
301
|
+
DonationVotingMerkleDistributionDirectTransferStrategy: "0x787eC93Dd71a90563979417879F5a3298389227f",
|
|
302
|
+
DirectGrantsSimpleStrategy: "0x8564d522b19836b7f5b4324e7ee8cb41810e9f9e",
|
|
303
|
+
RFPSimpleStrategy: "0xc0379c3e6e3140cae35588c09e081f2d8529c7e3",
|
|
304
|
+
RFPCommitteeStrategy: "0x8def91f220f3d1c16d406097ffb0daee0732772f",
|
|
305
|
+
QVSimple: "0xa9e9110fe3b4b169b2ca0e8825c7ce76eb0b9438",
|
|
306
|
+
},
|
|
307
|
+
factory: "0xE195743480D1591B79106FF9B296A0cD38aDa807",
|
|
308
|
+
};
|
package/core/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { BytesLike } from
|
|
2
|
-
import { AttestationRequestData, EAS, MultiAttestationRequest, SchemaItem } from
|
|
3
|
-
import { Attestation } from
|
|
4
|
-
import { Fetcher } from
|
|
1
|
+
import { BytesLike } from "ethers";
|
|
2
|
+
import { AttestationRequestData, EAS, MultiAttestationRequest, SchemaItem } from "@ethereum-attestation-service/eas-sdk";
|
|
3
|
+
import { Attestation } from "./class";
|
|
4
|
+
import { Fetcher } from "./class/Fetcher";
|
|
5
5
|
export type Hex = `0x${string}`;
|
|
6
6
|
export type SignerOrProvider = any;
|
|
7
7
|
export interface SchemaInterface<T extends string = string> {
|
|
@@ -21,10 +21,10 @@ export interface AttestArgs<T = unknown> {
|
|
|
21
21
|
refUID?: Hex;
|
|
22
22
|
signer: SignerOrProvider;
|
|
23
23
|
}
|
|
24
|
-
export type TSchemaName =
|
|
25
|
-
export type TResolvedSchemaNames =
|
|
26
|
-
export type TExternalLink =
|
|
27
|
-
export type TNetwork =
|
|
24
|
+
export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement";
|
|
25
|
+
export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "GrantUpdateStatus";
|
|
26
|
+
export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord";
|
|
27
|
+
export type TNetwork = "optimism" | 'celo' | "optimism-sepolia" | "arbitrum" | 'sepolia' | 'base-sepolia';
|
|
28
28
|
/**
|
|
29
29
|
* Generic GAP Facade interface.
|
|
30
30
|
* This supplies the GAP class with the necessary properties.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.3.
|
|
6
|
+
"version": "0.3.25",
|
|
7
7
|
"description": "Simple and easy interface between EAS and Karma GAP.",
|
|
8
8
|
"main": "./index.js",
|
|
9
9
|
"author": "KarmaHQ",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"publish-npm": "npm version patch && tsc && cd .dist && npm publish --scope=@show-karma/karma-gap-sdk --access public"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
+
"@allo-team/allo-v2-sdk": "^1.0.63",
|
|
22
23
|
"@ethereum-attestation-service/eas-sdk": "1.4.2",
|
|
23
24
|
"@gelatonetwork/relay-sdk": "^5.2.0",
|
|
24
25
|
"@types/sha256": "^0.2.0",
|