@@ -245,6 +245,58 @@ contract DynamicAccountTest is BaseTest {
245245 Test: creating an account
246246 //////////////////////////////////////////////////////////////*/
247247
248+ /// @dev benchmark test for deployment gas cost
249+ function test_deploy_dynamicAccount () public {
250+ // Setting up default extension.
251+ IExtension.Extension memory defaultExtension;
252+
253+ defaultExtension.metadata = IExtension.ExtensionMetadata ({
254+ name: "AccountExtension " ,
255+ metadataURI: "ipfs://AccountExtension " ,
256+ implementation: address (new AccountExtension ())
257+ });
258+
259+ defaultExtension.functions = new IExtension.ExtensionFunction [](7 );
260+
261+ defaultExtension.functions[0 ] = IExtension.ExtensionFunction (
262+ AccountExtension.supportsInterface.selector ,
263+ "supportsInterface(bytes4) "
264+ );
265+ defaultExtension.functions[1 ] = IExtension.ExtensionFunction (
266+ AccountExtension.execute.selector ,
267+ "execute(address,uint256,bytes) "
268+ );
269+ defaultExtension.functions[2 ] = IExtension.ExtensionFunction (
270+ AccountExtension.executeBatch.selector ,
271+ "executeBatch(address[],uint256[],bytes[]) "
272+ );
273+ defaultExtension.functions[3 ] = IExtension.ExtensionFunction (
274+ ERC721Holder .onERC721Received.selector ,
275+ "onERC721Received(address,address,uint256,bytes) "
276+ );
277+ defaultExtension.functions[4 ] = IExtension.ExtensionFunction (
278+ ERC1155Holder .onERC1155Received.selector ,
279+ "onERC1155Received(address,address,uint256,uint256,bytes) "
280+ );
281+ defaultExtension.functions[5 ] = IExtension.ExtensionFunction (
282+ bytes4 (0 ), // Selector for `receive()` function.
283+ "receive() "
284+ );
285+ defaultExtension.functions[6 ] = IExtension.ExtensionFunction (
286+ AccountExtension.isValidSignature.selector ,
287+ "isValidSignature(bytes32,bytes) "
288+ );
289+
290+ IExtension.Extension[] memory extensions = new IExtension.Extension [](1 );
291+ extensions[0 ] = defaultExtension;
292+
293+ // deploy account factory
294+ DynamicAccountFactory factory = new DynamicAccountFactory (
295+ IEntryPoint (payable (address (entrypoint))),
296+ extensions
297+ );
298+ }
299+
248300 /// @dev Create an account by directly calling the factory.
249301 function test_state_createAccount_viaFactory () public {
250302 vm.expectEmit (true , true , false , true );
@@ -590,15 +642,15 @@ contract DynamicAccountTest is BaseTest {
590642
591643 address account = accountFactory.getAddress (accountAdmin, bytes ("" ));
592644
593- assertEq (SimpleAccount ( payable (account)). getDeposit ( ), 0 );
645+ assertEq (EntryPoint (entrypoint). balanceOf (account ), 0 );
594646
595647 vm.prank (accountAdmin);
596648 SimpleAccount (payable (account)).addDeposit { value: 1000 }();
597- assertEq (SimpleAccount ( payable (account)). getDeposit ( ), 1000 );
649+ assertEq (EntryPoint (entrypoint). balanceOf (account ), 1000 );
598650
599651 vm.prank (accountAdmin);
600652 SimpleAccount (payable (account)).withdrawDepositTo (payable (accountSigner), 500 );
601- assertEq (SimpleAccount ( payable (account)). getDeposit ( ), 500 );
653+ assertEq (EntryPoint (entrypoint). balanceOf (account ), 500 );
602654 }
603655
604656 /*///////////////////////////////////////////////////////////////
0 commit comments