Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
111 commits
Select commit Hold shift + click to select a range
dd378a1
created interfaces for Account recovery feature
Oct 16, 2023
37e2c9d
guardian interface and contract
Oct 17, 2023
1b09442
added test suite for Guardian.sol
Oct 20, 2023
3f4e74c
Merge branch 'thirdweb-dev:main' into account-social-recovery
alfheimrShiven Oct 20, 2023
a3cc320
AccountGuardian contract
Oct 20, 2023
f22fb72
added test suite for AccountGuardian contract
Oct 21, 2023
d3e6fe0
dependency injection for social recovery feature
Oct 21, 2023
3dba350
account lock req creation, signature validation and acceptance check
Oct 24, 2023
2ee0e32
Chainlink automation for lock request evaluation and lock account fea…
Oct 26, 2023
c642267
refactored deploy script for smart account util contracts
Oct 27, 2023
c476031
Deploy script for util contracts and its test
Oct 28, 2023
d7bd5d6
added link to feature doc in Readme
Oct 28, 2023
5bd148f
Merge pull request #1 from alfheimrShiven/account-social-recovery
alfheimrShiven Oct 30, 2023
14dfa8f
fixing..
Oct 30, 2023
8395b06
brought back DeployGuardian as DeploySmartAccountUtilContracts script…
Oct 30, 2023
b106090
Merge pull request #2 from alfheimrShiven/account-social-recovery
alfheimrShiven Oct 30, 2023
8001b8b
moved account util contract deployments to Account.sol, commented out…
Nov 1, 2023
c72f748
switched AccountLock to single instance deployment (as per the system…
Nov 2, 2023
a8ca25f
Merge pull request #3 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 2, 2023
19f18e3
restoring to util contract deployments to createAccount()
Nov 4, 2023
0ddb444
Changed the approach of calling Account.sol from AccountLock.sol
Nov 8, 2023
9c15308
added modifier to restrict an Account's lock status change by Account…
Nov 8, 2023
493001e
Merge pull request #4 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 8, 2023
f6b4843
made AccountGuardianTest compatible with deployment of AccountGuardia…
Nov 8, 2023
53b9588
replaced DeployGuardian script with DeploySmartAccountUtilContracts s…
Nov 10, 2023
38e568d
Merge pull request #5 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 10, 2023
3f763ed
sending AccountLock address while initilizing Account clones for acco…
Nov 14, 2023
665f243
Merge pull request #6 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 14, 2023
bb6c8ba
AccountLock tests: createLockRequest() unit tests
Nov 14, 2023
dc9a859
[Buggy] ECDSA.recover(hash, signature) throwing error
Nov 16, 2023
5a7d6aa
Merge pull request #7 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 16, 2023
a6f7e33
foundry error
codypharm Nov 17, 2023
82c9281
depencies added but errors persist
codypharm Nov 17, 2023
598de03
error comntinues
codypharm Nov 17, 2023
3be95eb
build error persists
codypharm Nov 17, 2023
896717d
updated chainlink remappings
Nov 17, 2023
b15ce17
ECDSA.recover(...) bug fixed, made lockRequest hash EIP 191 compatibl…
Nov 17, 2023
fe87435
Merge pull request #8 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 17, 2023
819a0a7
unlock request feature, refactored concensys evaluation to both lock/…
Nov 18, 2023
a764396
Merge pull request #9 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 18, 2023
4ae52bb
added unit tests for account unlock feature
Nov 18, 2023
a50e537
Merge pull request #10 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 19, 2023
0aee37b
Makefile
Nov 21, 2023
ad2a9b1
Merge pull request #11 from alfheimrShiven/account-social-recovery
alfheimrShiven Nov 22, 2023
cb6691e
cross chain transaction now includes estimated amount deposit
codypharm Nov 28, 2023
11c2173
slippage calvualtion added
codypharm Nov 29, 2023
1687b2f
bugs fixed
codypharm Nov 30, 2023
0bc9b51
stopped at this stage
codypharm Dec 4, 2023
20e1477
added IAccountRecovery
Dec 5, 2023
ecab36c
native payment intiation done
codypharm Dec 5, 2023
c3c5a31
link transfer initiator done
codypharm Dec 5, 2023
e822483
Account Recovery interface
Dec 5, 2023
42322c5
stock with userOp
codypharm Dec 5, 2023
0f95847
external signing implemented
codypharm Dec 5, 2023
37c3a36
recovery request guardian signature collection & concensus evaluation
Dec 7, 2023
78bb350
used isValidSignature but review is needed
codypharm Dec 7, 2023
7ceeb42
comments added and code made more dynamic
codypharm Dec 7, 2023
0bf4596
private key restoration
Dec 8, 2023
fc7af00
now using just one estimate function
codypharm Dec 9, 2023
4d4a248
proceed now has _
codypharm Dec 9, 2023
5c6ada8
Merge pull request #13 from alfheimrShiven/account-social-recovery
alfheimrShiven Dec 9, 2023
aaee738
Merge branch 'main' into cross-chain-transactions
codypharm Dec 9, 2023
b81a628
cross chain contracts deployed with accessible address
codypharm Dec 10, 2023
921b5c8
merge added
codypharm Dec 10, 2023
706d43e
getter added for account lock
codypharm Dec 10, 2023
c48ef73
Merge pull request #12 from alfheimrShiven/cross-chain-transactions
codypharm Dec 10, 2023
b818a8b
cross chain script sample added
codypharm Dec 10, 2023
faed719
Merge pull request #14 from alfheimrShiven/cross-chain-script
codypharm Dec 10, 2023
67ab98b
interface changes
Dec 10, 2023
e838c6d
Updated contract deploy script, fixed backward compatibility issues d…
Dec 10, 2023
318e840
Code optimized
codypharm Dec 10, 2023
7ec5c55
restructured functions
codypharm Dec 10, 2023
c036372
link address also added to constructot
codypharm Dec 10, 2023
3ad8a0b
master deployment updated
codypharm Dec 11, 2023
648be6c
one step skipped
codypharm Dec 11, 2023
e426334
last trial
codypharm Dec 11, 2023
21c1db4
Merge pull request #16 from alfheimrShiven/Fix-compilation
alfheimrShiven Dec 11, 2023
13454b1
Merge pull request #15 from alfheimrShiven/account-social-recovery
alfheimrShiven Dec 11, 2023
9994ac3
Update README.md
alfheimrShiven Dec 11, 2023
ddf5634
building cancelling
codypharm Dec 16, 2023
4e07d7c
resolved conflicts with main
Dec 18, 2023
4d11bd3
added AccountRecovery to deploy script
Dec 19, 2023
d968a8b
commented out both CCIP contracts [build still failing]
Dec 19, 2023
b17bd89
[FIX]: Fixed the stack too deep error by removing the _router, _link …
Dec 19, 2023
4b0133d
updating owner of smart account
Dec 22, 2023
89d12a4
Email verification to generate recovery request
Dec 24, 2023
669d16f
uncommented the CCIP contracts
Dec 24, 2023
15718b2
moved the deployment of CCIP contracts from BaseAccountFactory to non…
Dec 24, 2023
6a28d89
Merge pull request #17 from alfheimrShiven/revert/debugging
alfheimrShiven Dec 24, 2023
6413321
merged with main
Dec 24, 2023
14cc533
Merge pull request #18 from alfheimrShiven/account-social-recovery
alfheimrShiven Dec 24, 2023
a91ba30
updated account util deploy script and test
Dec 25, 2023
e12640a
Moved smart account creation to deploy script, updated deployment scr…
Dec 27, 2023
ab94b18
Merge pull request #19 from alfheimrShiven/account-social-recovery
alfheimrShiven Dec 27, 2023
17ed4de
generateRecoveryReq(..) tests
Dec 31, 2023
b9b472e
collectGuardianSignaturesOnRecoveryRequest(..) unit tests
Dec 31, 2023
b5490d4
refactored AccountRecovery unit tests
Dec 31, 2023
6abbb81
Consensus evaluation tests
Dec 31, 2023
f694b4f
Merge pull request #20 from alfheimrShiven/account-social-recovery
alfheimrShiven Dec 31, 2023
abbeeff
fixed Account::updateAdmin() function signature and call from Account…
Jan 3, 2024
6454a6c
Merge pull request #21 from alfheimrShiven/account-social-recovery
alfheimrShiven Jan 3, 2024
625340b
removed _generateSalt dependency on account admin, as it can get upda…
Jan 4, 2024
b0d399a
finished AccountRecovery unit tests. Coverage: 92%
Jan 4, 2024
af976db
Merge pull request #22 from alfheimrShiven/account-social-recovery
alfheimrShiven Jan 4, 2024
faf0a62
reduced params for commitEmailVerificationHash()
Jan 5, 2024
41099ca
Merge pull request #23 from alfheimrShiven/account-social-recovery
alfheimrShiven Jan 5, 2024
047eac0
updated Readme: Problem statement, Architecture
Jan 6, 2024
548776e
Merge pull request #24 from alfheimrShiven/account-social-recovery
alfheimrShiven Jan 6, 2024
d4162c5
updated Readme: Benefits of smart wallets
Jan 8, 2024
d54fdb5
Readme touchups
Jan 8, 2024
8b9536a
Merge pull request #25 from alfheimrShiven/account-social-recovery
alfheimrShiven Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated contract deploy script, fixed backward compatibility issues d…
…ue to CCIP router & link params to AccountFactory
  • Loading branch information
Shivendra Singh committed Dec 10, 2023
commit e838c6d5b59c01b80b78dac6d18d4163f38df6ec
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ build:; forge build

test :; forge test

test_anvil :; forge test --rpc-url $(ANVIL_RPC_URL)
test_anvil :; forge test --rpc-url $(SEPOLIA_RPC_URL)

snapshot :; forge snapshot

format :; forge fmt

anvil :; anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1

NETWORK_ARGS := --rpc-url $(ANVIL_RPC_URL) --private-key $(ANVIL_PRIVATE_KEY) --broadcast
SEPOLIA_NETWORK_ARGS := --rpc-url $(SEPOLIA_RPC_URL) --private-key $(SEPOLIA_PRIVATE_KEY) --broadcast

# ifeq ($(findstring --network sepolia,$(ARGS)),--network sepolia)
# NETWORK_ARGS := --rpc-url $(SEPOLIA_RPC_URL) --private-key $(SEPOLIA_PRIVATE_KEY) --broadcast --verify --etherscan-api-key $(ETHERSCAN_API_KEY) -vvvv
Expand All @@ -44,4 +44,4 @@ NETWORK_ARGS := --rpc-url $(ANVIL_RPC_URL) --private-key $(ANVIL_PRIVATE_KEY) --
# endif

deploy:
@forge script scripts/DeploySmartAccountUtilContracts.s.sol:DeploySmartAccountUtilContracts $(NETWORK_ARGS)
@forge script scripts/DeploySmartAccountUtilContracts.s.sol:DeploySmartAccountUtilContracts $(SEPOLIA_NETWORK_ARGS)
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ import "forge-std/console.sol";
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/

contract AccountFactory is BaseAccountFactory, ContractMetadata, PermissionsEnumerable {
// Events //
event AccountFactoryContractDeployed(address indexed);

/*///////////////////////////////////////////////////////////////
Constructor
//////////////////////////////////////////////////////////////*/
Expand All @@ -39,6 +42,8 @@ contract AccountFactory is BaseAccountFactory, ContractMetadata, PermissionsEnum
address _link
) BaseAccountFactory(address(new Account(_entrypoint, address(this))), address(_entrypoint), _router, _link) {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);

emit AccountFactoryContractDeployed(address(this));
}

///@dev returns cross chain contract details
Expand Down
27 changes: 21 additions & 6 deletions contracts/prebuilts/account/utils/BaseAccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,34 +32,47 @@ import { AccountRecovery } from "../utils/AccountRecovery.sol";
abstract contract BaseAccountFactory is IAccountFactory, Multicall {
using EnumerableSet for EnumerableSet.AddressSet;

// Events //

event GuardianContractDeployed(address indexed);
event AccountLockContractDeployed(address indexed);
event CrossChainTokenTransferContractDeployed(address indexed);
event CrossChainTokenTransferMasterContractDeployed(address indexed);
event AccountGuardianContractDeployed(address indexed);
event SmartAccountContractDeployed(address indexed);
event AccountRecoveryContractDeployed(address indexed);
/*///////////////////////////////////////////////////////////////
State
//////////////////////////////////////////////////////////////*/

address public immutable accountImplementation;
address public immutable entrypoint;
Guardian public guardian = new Guardian();
AccountLock public accountLock = new AccountLock(guardian);
Guardian public guardian;
AccountLock public accountLock;
AccountGuardian public accountGuardian;
CrossChainTokenTransfer public crossChainTokenTransfer;
CrossChainTokenTransferMaster public crossChainTokenTransferMaster;
AccountRecovery public accountRecovery;
EnumerableSet.AddressSet private allAccounts;
mapping(address => EnumerableSet.AddressSet) internal accountsOfSigner;

event CrossChainData(address crossChainTokenTransfer, address crossChainTokenTransferMaster);

/*///////////////////////////////////////////////////////////////
Constructor
//////////////////////////////////////////////////////////////*/

constructor(address _accountImpl, address _entrypoint, address _router, address _link) {
accountImplementation = _accountImpl;
entrypoint = _entrypoint;
guardian = new Guardian();
accountLock = new AccountLock(guardian);
crossChainTokenTransfer = new CrossChainTokenTransfer(_router, _link);
crossChainTokenTransferMaster = new CrossChainTokenTransferMaster();
// // emit the contract addresses
// emit CrossChainData(address(crossChainTokenTransfer), address(crossChainTokenTransferMaster));
// emit the contract addresses
emit SmartAccountContractDeployed(_accountImpl);
emit GuardianContractDeployed(address(guardian));
emit AccountLockContractDeployed(address(accountLock));
emit CrossChainTokenTransferContractDeployed(address(crossChainTokenTransfer));
emit CrossChainTokenTransferMasterContractDeployed(address(crossChainTokenTransferMaster));
}

/*///////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -87,9 +100,11 @@ abstract contract BaseAccountFactory is IAccountFactory, Multicall {

accountGuardian = new AccountGuardian(guardian, accountLock, account);
guardian.linkAccountToAccountGuardian(account, address(accountGuardian));
emit AccountGuardianContractDeployed(address(accountGuardian));

accountRecovery = new AccountRecovery(account, address(accountGuardian));
guardian.linkAccountToAccountRecovery(account, address(accountRecovery));
emit AccountRecoveryContractDeployed(address(accountRecovery));

return account;
}
Expand Down
38 changes: 34 additions & 4 deletions scripts/DeploySmartAccountUtilContracts.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,51 @@ import { AccountFactory } from "contracts/prebuilts/account/non-upgradeable/Acco
import { Account } from "contracts/prebuilts/account/non-upgradeable/Account.sol";
import { Guardian } from "contracts/prebuilts/account/utils/Guardian.sol";
import { AccountGuardian } from "contracts/prebuilts/account/utils/AccountGuardian.sol";
import { AccountRecovery } from "contracts/prebuilts/account/utils/AccountRecovery.sol";
import { CrossChainTokenTransfer } from "contracts/prebuilts/account/utils/CrossChainTokenTransfer.sol";
import { CrossChainTokenTransferMaster } from "contracts/prebuilts/account/utils/CrossChainTokenTransferMaster.sol";

contract DeploySmartAccountUtilContracts is Script {
address public admin = makeAddr("admin");

function run() external returns (AccountFactory, address, Guardian, AccountLock, AccountGuardian) {
vm.startBroadcast(vm.envUint("ANVIL_PRIVATE_KEY"));
function run()
external
returns (
AccountFactory,
address,
Guardian,
AccountLock,
AccountGuardian,
CrossChainTokenTransfer,
CrossChainTokenTransferMaster,
AccountRecovery
)
{
vm.startBroadcast(vm.envUint("SEPOLIA_PRIVATE_KEY"));
address router = address(0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59);
address link = address(0x779877A7B0D9E8603169DdbD7836e478b4624789);

EntryPoint entryPoint = new EntryPoint();
AccountFactory accountFactory = new AccountFactory(entryPoint);
AccountFactory accountFactory = new AccountFactory(entryPoint, router, link);
address account = accountFactory.createAccount(admin, "");
vm.stopBroadcast();

Guardian guardianContract = accountFactory.guardian();
AccountLock accountLock = accountFactory.accountLock();
CrossChainTokenTransfer ccTokenTranferContract = accountFactory.crossChainTokenTransfer();
CrossChainTokenTransferMaster ccTokenTranferContractMaster = accountFactory.crossChainTokenTransferMaster();
AccountGuardian accountGuardian = accountFactory.accountGuardian();
AccountRecovery accountRecovery = accountFactory.accountRecovery();

return (accountFactory, account, guardianContract, accountLock, accountGuardian);
return (
accountFactory,
account,
guardianContract,
accountLock,
accountGuardian,
ccTokenTranferContract,
ccTokenTranferContractMaster,
accountRecovery
);
}
}
12 changes: 6 additions & 6 deletions src/test/benchmark/AccountBenchmark.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,9 @@ contract AccountBenchmarkTest is BaseTest {

event AccountCreated(address indexed account, address indexed accountAdmin);

function _signSignerPermissionRequest(IAccountPermissions.SignerPermissionRequest memory _req)
internal
view
returns (bytes memory signature)
{
function _signSignerPermissionRequest(
IAccountPermissions.SignerPermissionRequest memory _req
) internal view returns (bytes memory signature) {
bytes32 typehashSignerPermissionRequest = keccak256(
"SignerPermissionRequest(address signer,uint8 isAdmin,address[] approvedTargets,uint256 nativeTokenLimitPerTransaction,uint128 permissionStartTimestamp,uint128 permissionEndTimestamp,uint128 reqValidityStartTimestamp,uint128 reqValidityEndTimestamp,bytes32 uid)"
);
Expand Down Expand Up @@ -180,8 +178,10 @@ contract AccountBenchmarkTest is BaseTest {

// Setup contracts
entrypoint = new EntryPoint();
address router = address(0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59);
address link = address(0x779877A7B0D9E8603169DdbD7836e478b4624789);
// deploy account factory
accountFactory = new AccountFactory(IEntryPoint(payable(address(entrypoint))));
accountFactory = new AccountFactory(IEntryPoint(payable(address(entrypoint))), router, link);
// deploy dummy contract
numberContract = new Number();
}
Expand Down
4 changes: 3 additions & 1 deletion src/test/smart-wallet/Account.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,10 @@ contract SimpleAccountTest is BaseTest {

// Setup contracts
entrypoint = new EntryPoint();
address router = address(0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59);
address link = address(0x779877A7B0D9E8603169DdbD7836e478b4624789);
// deploy account factory
accountFactory = new AccountFactory(IEntryPoint(payable(address(entrypoint))));
accountFactory = new AccountFactory(IEntryPoint(payable(address(entrypoint))), router, link);
// deploy dummy contract
numberContract = new Number();
}
Expand Down
26 changes: 10 additions & 16 deletions src/test/smart-wallet/AccountVulnPOC.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,7 @@ contract Number {
num += 1;
}

function setNumBySignature(
address owner,
uint256 newNum,
bytes calldata signature
) public {
function setNumBySignature(address owner, uint256 newNum, bytes calldata signature) public {
if (owner.code.length == 0) {
// Signature verification by ECDSA
} else {
Expand Down Expand Up @@ -80,11 +76,9 @@ contract SimpleAccountVulnPOCTest is BaseTest {

event AccountCreated(address indexed account, address indexed accountAdmin);

function _prepareSignature(IAccountPermissions.SignerPermissionRequest memory _req)
internal
view
returns (bytes32 typedDataHash)
{
function _prepareSignature(
IAccountPermissions.SignerPermissionRequest memory _req
) internal view returns (bytes32 typedDataHash) {
bytes32 typehashSignerPermissionRequest = keccak256(
"SignerPermissionRequest(address signer,uint8 isAdmin,address[] approvedTargets,uint256 nativeTokenLimitPerTransaction,uint128 permissionStartTimestamp,uint128 permissionEndTimestamp,uint128 reqValidityStartTimestamp,uint128 reqValidityEndTimestamp,bytes32 uid)"
);
Expand Down Expand Up @@ -115,11 +109,9 @@ contract SimpleAccountVulnPOCTest is BaseTest {
typedDataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}

function _signSignerPermissionRequest(IAccountPermissions.SignerPermissionRequest memory _req)
internal
view
returns (bytes memory signature)
{
function _signSignerPermissionRequest(
IAccountPermissions.SignerPermissionRequest memory _req
) internal view returns (bytes memory signature) {
bytes32 typedDataHash = _prepareSignature(_req);
(uint8 v, bytes32 r, bytes32 s) = vm.sign(accountAdminPKey, typedDataHash);
signature = abi.encodePacked(r, s, v);
Expand Down Expand Up @@ -211,8 +203,10 @@ contract SimpleAccountVulnPOCTest is BaseTest {

// Setup contracts
entrypoint = new EntryPoint();
address router = address(0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59);
address link = address(0x779877A7B0D9E8603169DdbD7836e478b4624789);
// deploy account factory
accountFactory = new AccountFactory(IEntryPoint(payable(address(entrypoint))));
accountFactory = new AccountFactory(IEntryPoint(payable(address(entrypoint))), router, link);
// deploy dummy contract
numberContract = new Number();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract DeploySmartAccountUtilContractsTest is Test {

function setUp() external {
DeploySmartAccountUtilContracts deployer = new DeploySmartAccountUtilContracts();
(accountFactory, account, guardianContract, accountLock, accountGuardian) = deployer.run();
(accountFactory, account, guardianContract, accountLock, accountGuardian, , , ) = deployer.run();
}

function testIfSmartAccountUtilContractsDeployed() external {
Expand Down
31 changes: 13 additions & 18 deletions src/test/smart-wallet/DynamicAccount.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ contract Number {
}

contract NFTRejector {
function onERC721Received(
address,
address,
uint256,
bytes memory
) public virtual returns (bytes4) {
function onERC721Received(address, address, uint256, bytes memory) public virtual returns (bytes4) {
revert("NFTs not accepted");
}
}
Expand All @@ -48,6 +43,8 @@ contract DynamicAccountTest is BaseTest {
// Target contracts
EntryPoint private entrypoint;
DynamicAccountFactory private accountFactory;
address router = address(0x0BF3dE8c5D3e8A2B34D2BEeB17ABfCeBaf363A59);
address link = address(0x779877A7B0D9E8603169DdbD7836e478b4624789);

// Mocks
Number internal numberContract;
Expand All @@ -72,11 +69,9 @@ contract DynamicAccountTest is BaseTest {

event AccountCreated(address indexed account, address indexed accountAdmin);

function _prepareSignature(IAccountPermissions.SignerPermissionRequest memory _req)
internal
view
returns (bytes32 typedDataHash)
{
function _prepareSignature(
IAccountPermissions.SignerPermissionRequest memory _req
) internal view returns (bytes32 typedDataHash) {
bytes32 typehashSignerPermissionRequest = keccak256(
"SignerPermissionRequest(address signer,uint8 isAdmin,address[] approvedTargets,uint256 nativeTokenLimitPerTransaction,uint128 permissionStartTimestamp,uint128 permissionEndTimestamp,uint128 reqValidityStartTimestamp,uint128 reqValidityEndTimestamp,bytes32 uid)"
);
Expand Down Expand Up @@ -107,11 +102,9 @@ contract DynamicAccountTest is BaseTest {
typedDataHash = keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}

function _signSignerPermissionRequest(IAccountPermissions.SignerPermissionRequest memory _req)
internal
view
returns (bytes memory signature)
{
function _signSignerPermissionRequest(
IAccountPermissions.SignerPermissionRequest memory _req
) internal view returns (bytes memory signature) {
bytes32 typedDataHash = _prepareSignature(_req);
(uint8 v, bytes32 r, bytes32 s) = vm.sign(accountAdminPKey, typedDataHash);
signature = abi.encodePacked(r, s, v);
Expand Down Expand Up @@ -248,7 +241,7 @@ contract DynamicAccountTest is BaseTest {
extensions[0] = defaultExtension;

// deploy account factory
accountFactory = new DynamicAccountFactory(IEntryPoint(payable(address(entrypoint))), extensions);
accountFactory = new DynamicAccountFactory(IEntryPoint(payable(address(entrypoint))), extensions, router, link);
// deploy dummy contract
numberContract = new Number();
}
Expand Down Expand Up @@ -305,7 +298,9 @@ contract DynamicAccountTest is BaseTest {
// deploy account factory
DynamicAccountFactory factory = new DynamicAccountFactory(
IEntryPoint(payable(address(entrypoint))),
extensions
extensions,
router,
link
);
}

Expand Down
Loading