-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
1,444 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
dist/strategies/DirectGrantsLiteStrategy/directGrantsLite.config.d.ts
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
dist/strategies/DirectGrantsLiteStrategy/directGrantsLite.config.js
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
211
dist/strategies/StrategyFactory/strategyFactory.DGL.config.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"; | ||
}]; |
Oops, something went wrong.