|
1 | | -import "@nomiclabs/hardhat-ethers"; |
2 | 1 | import { buildSafeTransaction } from "../src/utils/execution"; |
3 | | -import { benchmark } from "./utils/setup" |
| 2 | +import { benchmark } from "./utils/setup"; |
4 | 3 | import { getFactory } from "../test/utils/setup"; |
5 | 4 |
|
6 | | -benchmark("Proxy", [{ |
7 | | - name: "creation", |
8 | | - prepare: async (contracts,_,nonce) => { |
9 | | - const factory = contracts.additions.factory |
10 | | - // We're cheating and passing the factory address as a singleton address to bypass a check that singleton contract exists |
11 | | - const data = factory.interface.encodeFunctionData("createProxyWithNonce", [factory.address, "0x", 0]) |
12 | | - return buildSafeTransaction({ to: factory.address, data, safeTxGas: 1000000, nonce }) |
| 5 | +benchmark("Proxy", async () => [ |
| 6 | + { |
| 7 | + name: "creation", |
| 8 | + prepare: async (contracts, _, nonce) => { |
| 9 | + const factory = contracts.additions.factory; |
| 10 | + const factoryAddress = await factory.getAddress(); |
| 11 | + // We're cheating and passing the factory address as a singleton address to bypass a check that singleton contract exists |
| 12 | + const data = factory.interface.encodeFunctionData("createProxyWithNonce", [factoryAddress, "0x", 0]); |
| 13 | + return buildSafeTransaction({ to: factoryAddress, data, safeTxGas: 1000000, nonce }); |
| 14 | + }, |
| 15 | + fixture: async () => { |
| 16 | + return { |
| 17 | + factory: await getFactory(), |
| 18 | + }; |
| 19 | + }, |
13 | 20 | }, |
14 | | - fixture: async () => { |
15 | | - return { |
16 | | - factory: await getFactory(), |
17 | | - } |
18 | | - } |
19 | | -}]) |
| 21 | +]); |
20 | 22 |
|
21 | | -benchmark("Proxy", [{ |
22 | | - name: "chain specific creation", |
23 | | - prepare: async (contracts,_,nonce) => { |
24 | | - const factory = contracts.additions.factory |
25 | | - // We're cheating and passing the factory address as a singleton address to bypass a check that singleton contract exists |
26 | | - const data = factory.interface.encodeFunctionData("createChainSpecificProxyWithNonce", [factory.address, "0x", 0]) |
27 | | - return buildSafeTransaction({ to: factory.address, data, safeTxGas: 1000000, nonce }) |
| 23 | +benchmark("Proxy", async () => [ |
| 24 | + { |
| 25 | + name: "chain specific creation", |
| 26 | + prepare: async (contracts, _, nonce) => { |
| 27 | + const factory = contracts.additions.factory; |
| 28 | + const factoryAddress = await factory.getAddress(); |
| 29 | + // We're cheating and passing the factory address as a singleton address to bypass a check that singleton contract exists |
| 30 | + const data = factory.interface.encodeFunctionData("createChainSpecificProxyWithNonce", [factoryAddress, "0x", 0]); |
| 31 | + return buildSafeTransaction({ to: factoryAddress, data, safeTxGas: 1000000, nonce }); |
| 32 | + }, |
| 33 | + fixture: async () => { |
| 34 | + return { |
| 35 | + factory: await getFactory(), |
| 36 | + }; |
| 37 | + }, |
28 | 38 | }, |
29 | | - fixture: async () => { |
30 | | - return { |
31 | | - factory: await getFactory(), |
32 | | - } |
33 | | - } |
34 | | -}]) |
| 39 | +]); |
0 commit comments