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
34 lines (32 loc) · 1.36 KB
/
Safe.Proxy.spec.ts
File metadata and controls
34 lines (32 loc) · 1.36 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
import "@nomiclabs/hardhat-ethers";
import { buildSafeTransaction } from "../src/utils/execution";
import { benchmark } from "./utils/setup"
import { getFactory } from "../test/utils/setup";
benchmark("Proxy", [{
name: "creation",
prepare: async (contracts,_,nonce) => {
const factory = contracts.additions.factory
// 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", [factory.address, "0x", 0])
return buildSafeTransaction({ to: factory.address, data, safeTxGas: 1000000, nonce })
},
fixture: async () => {
return {
factory: await getFactory(),
}
}
}])
benchmark("Proxy", [{
name: "chain specific creation",
prepare: async (contracts,_,nonce) => {
const factory = contracts.additions.factory
// 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", [factory.address, "0x", 0])
return buildSafeTransaction({ to: factory.address, data, safeTxGas: 1000000, nonce })
},
fixture: async () => {
return {
factory: await getFactory(),
}
}
}])