Skip to content

Commit

Permalink
Don't rely on zodiac tooling function anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
cristovaoth committed Oct 30, 2023
1 parent cf28dad commit b0f8d47
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions packages/evm/test/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import assert from "assert";
import { BigNumberish } from "ethers";
import { BytesLike, solidityPack } from "ethers/lib/utils";
import { BigNumberish, Signer } from "ethers";
import {
BytesLike,
getAddress,
parseEther,
solidityPack,
} from "ethers/lib/utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { getSingletonFactory } from "@gnosis.pm/zodiac/dist/src/factory/singletonFactory";
import { ConditionFlatStruct } from "../typechain-types/contracts/Integrity";

export const logGas = async (
Expand Down Expand Up @@ -238,3 +242,35 @@ export function toConditionsFlat(root: ConditionStruct): ConditionFlatStruct[] {

return result;
}

async function getSingletonFactory(signer: Signer) {
const factoryAddress = getAddress(
"0xce0042b868300000d44a59004da54a005ffdcf9f"
);
const deployerAddress = getAddress(
"0xBb6e024b9cFFACB947A71991E386681B1Cd1477D"
);

const provider = signer.provider;
assert(provider);

// check if singleton factory is deployed.
if ((await provider.getCode(factoryAddress)) === "0x") {
// fund the singleton factory deployer account
await signer.sendTransaction({
to: deployerAddress,
value: parseEther("0.0247"),
});

// deploy the singleton factory
await (
await provider.sendTransaction(
"0xf9016c8085174876e8008303c4d88080b90154608060405234801561001057600080fd5b50610134806100206000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c80634af63f0214602d575b600080fd5b60cf60048036036040811015604157600080fd5b810190602081018135640100000000811115605b57600080fd5b820183602082011115606c57600080fd5b80359060200191846001830284011164010000000083111715608d57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550509135925060eb915050565b604080516001600160a01b039092168252519081900360200190f35b6000818351602085016000f5939250505056fea26469706673582212206b44f8a82cb6b156bfcc3dc6aadd6df4eefd204bc928a4397fd15dacf6d5320564736f6c634300060200331b83247000822470"
)
)?.wait();

if ((await provider.getCode(factoryAddress)) == "0x") {
throw Error("Singleton factory could not be deployed to correct address");
}
}
}

0 comments on commit b0f8d47

Please sign in to comment.