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 cc74c98 commit 1a0d621
Show file tree
Hide file tree
Showing 11 changed files with 4,818 additions and 28 deletions.
4 changes: 2 additions & 2 deletions dist/strategies/StrategyFactory/StrategyFactory.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ export declare class StrategyFactory {
constructor({ chain, factoryType, address, rpc, }: {
chain: number;
factoryType: StrategyFactoryType;
address: `0x${string}`;
address?: `0x${string}`;
rpc?: string;
});
private checkFactoryAddress;
private getAbi;
getAddress(chainId: number): `0x${string}`;
private getAddress;
setFactoryAddress(address: `0x${string}`): void;
getCreateStrategyData(): TransactionData;
getCreateStrategyDataByChainId(chainId: number): TransactionData;
Expand Down
3 changes: 2 additions & 1 deletion dist/strategies/StrategyFactory/StrategyFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class StrategyFactory {
});
this.factoryType = factoryType;
this.client = (0, Client_1.create)(usedChain, rpc);
this.setFactoryAddress(address);
if (address)
this.setFactoryAddress(address);
}
checkFactoryAddress() {
if (!this.factory) {
Expand Down
14 changes: 12 additions & 2 deletions dist/strategies/StrategyFactory/strategyFactory.DGL.config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,16 @@ export declare const abi: readonly [{
}];
readonly name: "OwnershipTransferred";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "address";
readonly name: "strategy";
readonly type: "address";
}];
readonly name: "StrategyCreated";
readonly type: "event";
}, {
readonly inputs: readonly [];
readonly name: "allo";
Expand Down Expand Up @@ -117,7 +127,7 @@ export declare const abi: readonly [{
readonly name: "createCustomStrategy";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly name: "strategy";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
Expand All @@ -127,7 +137,7 @@ export declare const abi: readonly [{
readonly name: "createStrategy";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly name: "strategy";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
Expand Down
19 changes: 16 additions & 3 deletions dist/strategies/StrategyFactory/strategyFactory.DGL.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getAddress = (chainId) => {
switch (chainId) {
case 300: // ZkSync Era Testnet
case 324: // ZkSync Era Mainnet
return "0xa029A4cED20b2Eec7aC35892FAD6E4564e27FE7A";
return "0x235bd2A867056Ba72d48ceC08d82b418fA977D1c";
default:
throw new Error("Chain not supported by SDK");
}
Expand Down Expand Up @@ -115,6 +115,19 @@ exports.abi = [
name: "OwnershipTransferred",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "strategy",
type: "address",
},
],
name: "StrategyCreated",
type: "event",
},
{
inputs: [],
name: "allo",
Expand Down Expand Up @@ -165,7 +178,7 @@ exports.abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand All @@ -178,7 +191,7 @@ exports.abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand Down
14 changes: 12 additions & 2 deletions dist/strategies/StrategyFactory/strategyFactory.DVMDT.config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,16 @@ export declare const abi: readonly [{
}];
readonly name: "Permit2Updated";
readonly type: "event";
}, {
readonly anonymous: false;
readonly inputs: readonly [{
readonly indexed: false;
readonly internalType: "address";
readonly name: "strategy";
readonly type: "address";
}];
readonly name: "StrategyCreated";
readonly type: "event";
}, {
readonly inputs: readonly [];
readonly name: "allo";
Expand Down Expand Up @@ -123,7 +133,7 @@ export declare const abi: readonly [{
readonly name: "createStrategy";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly name: "strategy";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
Expand All @@ -145,7 +155,7 @@ export declare const abi: readonly [{
readonly name: "createStrategyCustom";
readonly outputs: readonly [{
readonly internalType: "address";
readonly name: "";
readonly name: "strategy";
readonly type: "address";
}];
readonly stateMutability: "nonpayable";
Expand Down
19 changes: 16 additions & 3 deletions dist/strategies/StrategyFactory/strategyFactory.DVMDT.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const getAddress = (chainId) => {
switch (chainId) {
case 300: // ZkSync Era Testnet
case 324: // ZkSync Era Mainnet
return "0x2b7d0c8260964210e98BA35bD413f86042a004a7";
return "0x4eed0E5f18059057fE00308773eE6D804A0Dc5Fe";
default:
throw new Error("Chain not supported by SDK");
}
Expand Down Expand Up @@ -133,6 +133,19 @@ exports.abi = [
name: "Permit2Updated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "strategy",
type: "address",
},
],
name: "StrategyCreated",
type: "event",
},
{
inputs: [],
name: "allo",
Expand Down Expand Up @@ -172,7 +185,7 @@ exports.abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand Down Expand Up @@ -201,7 +214,7 @@ exports.abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@allo-team/allo-v2-sdk",
"version": "1.0.73",
"version": "1.0.74",
"description": "sdk for allo v2",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
7 changes: 3 additions & 4 deletions src/strategies/StrategyFactory/StrategyFactory.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Chain,
PublicClient,
Transaction,
Transport,
encodeFunctionData,
extractChain,
Expand Down Expand Up @@ -37,7 +36,7 @@ export class StrategyFactory {
}: {
chain: number;
factoryType: StrategyFactoryType;
address: `0x${string}`;
address?: `0x${string}`;
rpc?: string;
}) {
const usedChain = extractChain({
Expand All @@ -48,7 +47,7 @@ export class StrategyFactory {
this.factoryType = factoryType;
this.client = create(usedChain, rpc);

this.setFactoryAddress(address);
if (address) this.setFactoryAddress(address);
}

private checkFactoryAddress(): void {
Expand All @@ -68,7 +67,7 @@ export class StrategyFactory {
}
}

public getAddress(chainId: number): `0x${string}` {
private getAddress(chainId: number): `0x${string}` {
switch (this.factoryType) {
case "DGL":
return getAddressDGL(chainId);
Expand Down
21 changes: 16 additions & 5 deletions src/strategies/StrategyFactory/strategyFactory.DGL.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Chain } from "viem";

// Factory for DirectGrantsLiteStrategy v1.0
export const getAddress = (chainId: number): `0x${string}` => {
switch (chainId) {
case 300: // ZkSync Era Testnet
case 324: // ZkSync Era Mainnet
return "0xa029A4cED20b2Eec7aC35892FAD6E4564e27FE7A";
return "0x235bd2A867056Ba72d48ceC08d82b418fA977D1c";
default:
throw new Error("Chain not supported by SDK");
}
Expand Down Expand Up @@ -114,6 +112,19 @@ export const abi = [
name: "OwnershipTransferred",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "strategy",
type: "address",
},
],
name: "StrategyCreated",
type: "event",
},
{
inputs: [],
name: "allo",
Expand Down Expand Up @@ -164,7 +175,7 @@ export const abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand All @@ -177,7 +188,7 @@ export const abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand Down
21 changes: 16 additions & 5 deletions src/strategies/StrategyFactory/strategyFactory.DVMDT.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Chain } from "viem";

// Factory for DonationVotingMerkleDistributionDirectTransferStrategy v2.1
export const getAddress = (chainId: number): `0x${string}` => {
switch (chainId) {
case 300: // ZkSync Era Testnet
case 324: // ZkSync Era Mainnet
return "0x2b7d0c8260964210e98BA35bD413f86042a004a7";
return "0x4eed0E5f18059057fE00308773eE6D804A0Dc5Fe";
default:
throw new Error("Chain not supported by SDK");
}
Expand Down Expand Up @@ -132,6 +130,19 @@ export const abi = [
name: "Permit2Updated",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "address",
name: "strategy",
type: "address",
},
],
name: "StrategyCreated",
type: "event",
},
{
inputs: [],
name: "allo",
Expand Down Expand Up @@ -171,7 +182,7 @@ export const abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand Down Expand Up @@ -200,7 +211,7 @@ export const abi = [
outputs: [
{
internalType: "address",
name: "",
name: "strategy",
type: "address",
},
],
Expand Down
Loading

0 comments on commit 1a0d621

Please sign in to comment.