forked from safe-fndn/safe-smart-account
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSafe.Proxy.spec.ts
More file actions
39 lines (37 loc) · 1.6 KB
/
Safe.Proxy.spec.ts
File metadata and controls
39 lines (37 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { buildSafeTransaction } from "../src/utils/execution";
import { benchmark } from "./utils/setup";
import { getFactory } from "../test/utils/setup";
benchmark("Proxy", async () => [
{
name: "creation",
prepare: async (contracts, _, nonce) => {
const factory = contracts.additions.factory;
const factoryAddress = await factory.getAddress();
// We're cheating and passing the factory address as a singleton address to bypass a check that singleton contract exists
const data = factory.interface.encodeFunctionData("createProxyWithNonce", [factoryAddress, "0x", 0]);
return buildSafeTransaction({ to: factoryAddress, data, safeTxGas: 1000000, nonce });
},
fixture: async () => {
return {
factory: await getFactory(),
};
},
},
]);
benchmark("Proxy", async () => [
{
name: "chain specific creation",
prepare: async (contracts, _, nonce) => {
const factory = contracts.additions.factory;
const factoryAddress = await factory.getAddress();
// We're cheating and passing the factory address as a singleton address to bypass a check that singleton contract exists
const data = factory.interface.encodeFunctionData("createChainSpecificProxyWithNonce", [factoryAddress, "0x", 0]);
return buildSafeTransaction({ to: factoryAddress, data, safeTxGas: 1000000, nonce });
},
fixture: async () => {
return {
factory: await getFactory(),
};
},
},
]);