Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKurt committed May 21, 2024
1 parent b36a2a9 commit cc74c98
Show file tree
Hide file tree
Showing 14 changed files with 1,444 additions and 47 deletions.
6 changes: 5 additions & 1 deletion dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { SQFSuperFluidStrategy } from "./strategies/SuperFluidStrategy/SQFSuperF
import { DonationVotingMerkleDistributionStrategy } from "./strategies/DonationVotingMerkleDistributionStrategy/DonationVotingMerkleDistribution";
import { DirectGrantsStrategy } from "./strategies/DirectGrants/DirectGrantsStrategy";
import { DirectGrantsLiteStrategy } from "./strategies/DirectGrantsLiteStrategy/DirectGrantsLite";
import { StrategyFactory } from "./strategies/StrategyFactory/StrategyFactory";
export * from "./types";
export * from "./strategies/types";
export * from "./Registry/types";
Expand All @@ -14,6 +15,7 @@ export * as MicroGrantsStrategyTypes from "./strategies/MicroGrantsStrategy/type
export * as SQFSuperFluidStrategyTypes from "./strategies/SuperFluidStrategy/types";
export * as DirectGrantsStrategyTypes from "./strategies/DirectGrants/types";
export * as DirectGrantsLiteStrategyTypes from "./strategies/DirectGrantsLiteStrategy/types";
export { StrategyFactoryType } from "./strategies/StrategyFactory/StrategyFactory";
export { abi as AlloAbi } from "./Allo/allo.config";
export { abi as RegistryAbi } from "./Registry/registry.config";
export { abi as DonationVotingMerkleDistributionDirectTransferStrategyAbi } from "./strategies/DonationVotingMerkleDistributionStrategy/donationVotingDirect.config";
Expand All @@ -22,4 +24,6 @@ export { abi as MicroGrantsStrategyAbi } from "./strategies/MicroGrantsStrategy/
export { abi as SQFSuperFluidStrategyAbi } from "./strategies/SuperFluidStrategy/superfluid.config";
export { abi as DirectGrantsStrategyAbi } from "./strategies/DirectGrants/directGrants.config";
export { abi as DirectGrantsLiteStrategyAbi } from "./strategies/DirectGrantsLiteStrategy/directGrantsLite.config";
export { Allo, Registry, MicroGrantsStrategy, SQFSuperFluidStrategy, DonationVotingMerkleDistributionStrategy, DirectGrantsStrategy, DirectGrantsLiteStrategy, };
export { abi as StrategyFactoryDGLAbi } from "./strategies/StrategyFactory/strategyFactory.DGL.config";
export { abi as StrategyFactoryDVMDTAbi } from "./strategies/StrategyFactory/strategyFactory.DVMDT.config";
export { Allo, Registry, MicroGrantsStrategy, SQFSuperFluidStrategy, DonationVotingMerkleDistributionStrategy, DirectGrantsStrategy, DirectGrantsLiteStrategy, StrategyFactory, };
8 changes: 7 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DirectGrantsLiteStrategy = exports.DirectGrantsStrategy = exports.DonationVotingMerkleDistributionStrategy = exports.SQFSuperFluidStrategy = exports.MicroGrantsStrategy = exports.Registry = exports.Allo = exports.DirectGrantsLiteStrategyAbi = exports.DirectGrantsStrategyAbi = exports.SQFSuperFluidStrategyAbi = exports.MicroGrantsStrategyAbi = exports.DonationVotingMerkleDistributionVaultStrategyAbi = exports.DonationVotingMerkleDistributionDirectTransferStrategyAbi = exports.RegistryAbi = exports.AlloAbi = exports.DirectGrantsLiteStrategyTypes = exports.DirectGrantsStrategyTypes = exports.SQFSuperFluidStrategyTypes = exports.MicroGrantsStrategyTypes = exports.DonationVotingMerkleDistributionStrategyTypes = void 0;
exports.StrategyFactory = exports.DirectGrantsLiteStrategy = exports.DirectGrantsStrategy = exports.DonationVotingMerkleDistributionStrategy = exports.SQFSuperFluidStrategy = exports.MicroGrantsStrategy = exports.Registry = exports.Allo = exports.StrategyFactoryDVMDTAbi = exports.StrategyFactoryDGLAbi = exports.DirectGrantsLiteStrategyAbi = exports.DirectGrantsStrategyAbi = exports.SQFSuperFluidStrategyAbi = exports.MicroGrantsStrategyAbi = exports.DonationVotingMerkleDistributionVaultStrategyAbi = exports.DonationVotingMerkleDistributionDirectTransferStrategyAbi = exports.RegistryAbi = exports.AlloAbi = exports.DirectGrantsLiteStrategyTypes = exports.DirectGrantsStrategyTypes = exports.SQFSuperFluidStrategyTypes = exports.MicroGrantsStrategyTypes = exports.DonationVotingMerkleDistributionStrategyTypes = void 0;
const Allo_1 = require("./Allo/Allo");
Object.defineProperty(exports, "Allo", { enumerable: true, get: function () { return Allo_1.Allo; } });
const Registry_1 = require("./Registry/Registry");
Expand All @@ -29,6 +29,8 @@ const DirectGrantsStrategy_1 = require("./strategies/DirectGrants/DirectGrantsSt
Object.defineProperty(exports, "DirectGrantsStrategy", { enumerable: true, get: function () { return DirectGrantsStrategy_1.DirectGrantsStrategy; } });
const DirectGrantsLite_1 = require("./strategies/DirectGrantsLiteStrategy/DirectGrantsLite");
Object.defineProperty(exports, "DirectGrantsLiteStrategy", { enumerable: true, get: function () { return DirectGrantsLite_1.DirectGrantsLiteStrategy; } });
const StrategyFactory_1 = require("./strategies/StrategyFactory/StrategyFactory");
Object.defineProperty(exports, "StrategyFactory", { enumerable: true, get: function () { return StrategyFactory_1.StrategyFactory; } });
__exportStar(require("./types"), exports);
__exportStar(require("./strategies/types"), exports);
__exportStar(require("./Registry/types"), exports);
Expand All @@ -54,3 +56,7 @@ var directGrants_config_1 = require("./strategies/DirectGrants/directGrants.conf
Object.defineProperty(exports, "DirectGrantsStrategyAbi", { enumerable: true, get: function () { return directGrants_config_1.abi; } });
var directGrantsLite_config_1 = require("./strategies/DirectGrantsLiteStrategy/directGrantsLite.config");
Object.defineProperty(exports, "DirectGrantsLiteStrategyAbi", { enumerable: true, get: function () { return directGrantsLite_config_1.abi; } });
var strategyFactory_DGL_config_1 = require("./strategies/StrategyFactory/strategyFactory.DGL.config");
Object.defineProperty(exports, "StrategyFactoryDGLAbi", { enumerable: true, get: function () { return strategyFactory_DGL_config_1.abi; } });
var strategyFactory_DVMDT_config_1 = require("./strategies/StrategyFactory/strategyFactory.DVMDT.config");
Object.defineProperty(exports, "StrategyFactoryDVMDTAbi", { enumerable: true, get: function () { return strategyFactory_DVMDT_config_1.abi; } });

Large diffs are not rendered by default.

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions dist/strategies/StrategyFactory/StrategyFactory.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { TransactionData } from "../../types";
export type StrategyFactoryType = "DGL" | "DVMDT";
export declare class StrategyFactory {
private client;
private contract;
private factory;
private factoryType;
constructor({ chain, factoryType, address, rpc, }: {
chain: number;
factoryType: StrategyFactoryType;
address: `0x${string}`;
rpc?: string;
});
private checkFactoryAddress;
private getAbi;
getAddress(chainId: number): `0x${string}`;
setFactoryAddress(address: `0x${string}`): void;
getCreateStrategyData(): TransactionData;
getCreateStrategyDataByChainId(chainId: number): TransactionData;
}
83 changes: 83 additions & 0 deletions dist/strategies/StrategyFactory/StrategyFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StrategyFactory = void 0;
const viem_1 = require("viem");
const chains_config_1 = require("../../chains.config");
const Client_1 = require("../../Client/Client");
const strategyFactory_DGL_config_1 = require("./strategyFactory.DGL.config");
const strategyFactory_DVMDT_config_1 = require("./strategyFactory.DVMDT.config");
class StrategyFactory {
constructor({ chain, factoryType, address, rpc, }) {
const usedChain = (0, viem_1.extractChain)({
chains: chains_config_1.supportedChains,
id: chain,
});
this.factoryType = factoryType;
this.client = (0, Client_1.create)(usedChain, rpc);
this.setFactoryAddress(address);
}
checkFactoryAddress() {
if (!this.factory) {
throw new Error("No factory address provided");
}
}
getAbi() {
switch (this.factoryType) {
case "DGL":
return strategyFactory_DGL_config_1.abi;
case "DVMDT":
return strategyFactory_DVMDT_config_1.abi;
default:
throw new Error("Invalid factory type");
}
}
getAddress(chainId) {
switch (this.factoryType) {
case "DGL":
return (0, strategyFactory_DGL_config_1.getAddress)(chainId);
case "DVMDT":
return (0, strategyFactory_DVMDT_config_1.getAddress)(chainId);
default:
throw new Error("Invalid factory type");
}
}
setFactoryAddress(address) {
if (address) {
this.contract = (0, viem_1.getContract)({
address: address,
abi: this.getAbi(),
client: {
public: this.client,
},
});
this.factory = address;
}
}
getCreateStrategyData() {
this.checkFactoryAddress();
const encodedData = (0, viem_1.encodeFunctionData)({
abi: this.getAbi(),
functionName: "createStrategy",
args: [],
});
return {
to: this.factory,
data: encodedData,
value: "0",
};
}
getCreateStrategyDataByChainId(chainId) {
this.checkFactoryAddress();
const encodedData = (0, viem_1.encodeFunctionData)({
abi: this.getAbi(),
functionName: "createStrategy",
args: [],
});
return {
to: this.getAddress(chainId),
data: encodedData,
value: "0",
};
}
}
exports.StrategyFactory = StrategyFactory;
211 changes: 211 additions & 0 deletions dist/strategies/StrategyFactory/strategyFactory.DGL.config.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,211 @@
export declare const getAddress: (chainId: number) => `0x${string}`;
export declare const abi: readonly [{
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "_allo";
readonly type: "address";
}, {
readonly internalType: "string";
readonly name: "_name";
readonly type: "string";
}];
readonly stateMutability: "nonpayable";
readonly type: "constructor";
}, {
readonly inputs: readonly [];
readonly name: "NewOwnerIsZeroAddress";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "NoHandoverRequest";
readonly type: "error";
}, {
readonly inputs: readonly [];
readonly name: "Unauthorized";
readonly type: "error";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "address";
readonly name: "allo";
readonly type: "address";
}];
readonly name: "AlloUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "string";
readonly name: "name";
readonly type: "string";
}];
readonly name: "NameUpdated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "address";
readonly name: "pendingOwner";
readonly type: "address";
}];
readonly name: "OwnershipHandoverCanceled";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "address";
readonly name: "pendingOwner";
readonly type: "address";
}];
readonly name: "OwnershipHandoverRequested";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: true;
readonly internalType: "address";
readonly name: "oldOwner";
readonly type: "address";
}, {
readonly indexed: true;
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "OwnershipTransferred";
readonly type: "event";
}, {
readonly inputs: readonly [];
readonly name: "allo";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "cancelOwnershipHandover";
readonly outputs: readonly [];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "pendingOwner";
readonly type: "address";
}];
readonly name: "completeOwnershipHandover";
readonly outputs: readonly [];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "_allo";
readonly type: "address";
}, {
readonly internalType: "string";
readonly name: "_name";
readonly type: "string";
}];
readonly name: "createCustomStrategy";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "createStrategy";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "name";
readonly outputs: readonly [{
readonly internalType: "string";
readonly name: "";
readonly type: "string";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "owner";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "result";
readonly type: "address";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "pendingOwner";
readonly type: "address";
}];
readonly name: "ownershipHandoverExpiresAt";
readonly outputs: readonly [{
readonly internalType: "uint256";
readonly name: "result";
readonly type: "uint256";
}];
readonly stateMutability: "view";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "renounceOwnership";
readonly outputs: readonly [];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [];
readonly name: "requestOwnershipHandover";
readonly outputs: readonly [];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "newOwner";
readonly type: "address";
}];
readonly name: "transferOwnership";
readonly outputs: readonly [];
readonly stateMutability: "payable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "address";
readonly name: "_allo";
readonly type: "address";
}];
readonly name: "updateAllo";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}, {
readonly inputs: readonly [{
readonly internalType: "string";
readonly name: "_name";
readonly type: "string";
}];
readonly name: "updateName";
readonly outputs: readonly [];
readonly stateMutability: "nonpayable";
readonly type: "function";
}];
Loading

0 comments on commit cc74c98

Please sign in to comment.