Skip to content

Commit ff19bef

Browse files
committed
dotfiles etc
1 parent 1c101d6 commit ff19bef

File tree

8 files changed

+56
-12
lines changed

8 files changed

+56
-12
lines changed

.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Private key of the EOA to be upgraded to a smart contract wallet
2+
EOA_PRIVATE_KEY=
3+
4+
# Private key of the account that will deploy contracts and perform the upgrade
5+
DEPLOYER_PRIVATE_KEY=
6+
7+
# Private key of the new owner to be added to the smart wallet
8+
NEW_OWNER_PRIVATE_KEY=
9+
10+
# Address of the deployed proxy template on Odyssey (output from UpgradeEOA.s.sol)
11+
PROXY_TEMPLATE_ADDRESS_ODYSSEY=

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Compiler files
2+
cache/
3+
out/
4+
5+
# Ignores development broadcast logs
6+
/broadcast/
7+
/broadcast/*/31337/
8+
/broadcast/**/dry-run/
9+
10+
# Docs
11+
docs/
12+
13+
# Dotenv file
14+
.env

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/openzeppelin-contracts"]
5+
path = lib/openzeppelin-contracts
6+
url = https://github.com/OpenZeppelin/openzeppelin-contracts
7+
[submodule "lib/smart-wallet"]
8+
path = lib/smart-wallet
9+
url = https://github.com/coinbase/smart-wallet

cache/solidity-files-cache.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

out/EIP7702Proxy.sol/EIP7702Proxy.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

out/EIP7702ProxyBase.sol/EIP7702ProxyBase.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

out/initialize.t.sol/InitializeTest.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/EIP7702Proxy.sol

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// SPDX-License-Identifier: UNLICENSED
22
pragma solidity ^0.8.0;
33

4-
import {Proxy} from "openzeppelin-contracts/contracts/proxy/Proxy.sol";
5-
import {ERC1967Utils} from "openzeppelin-contracts/contracts/proxy/ERC1967/ERC1967Utils.sol";
6-
import {ECDSA} from "openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol";
7-
import {Address} from "openzeppelin-contracts/contracts/utils/Address.sol";
4+
import {Proxy} from "@openzeppelin/contracts/proxy/Proxy.sol";
5+
import {ERC1967Utils} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol";
6+
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
7+
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
88

99
/// @notice Proxy contract designed for EIP-7702 smart accounts.
1010
///
@@ -25,22 +25,32 @@ contract EIP7702Proxy is Proxy {
2525
guardedInitializer = initializer;
2626
}
2727

28-
function initialize(bytes calldata args, bytes calldata signature) external {
28+
function initialize(
29+
bytes calldata args,
30+
bytes calldata signature
31+
) external {
2932
// construct hash incompatible with wallet RPCs to avoid phishing
3033
bytes32 hash = keccak256(abi.encode(proxy, args));
3134
address recovered = ECDSA.recover(hash, signature);
3235
if (recovered != address(this)) revert InvalidSignature();
3336

3437
// enforce initialization only on initial implementation
3538
address implementation = _implementation();
36-
if (implementation != initialImplementation) revert InvalidImplementation();
39+
if (implementation != initialImplementation)
40+
revert InvalidImplementation();
3741

38-
Address.functionDelegateCall(initialImplementation, abi.encodePacked(guardedInitializer, args));
42+
Address.functionDelegateCall(
43+
initialImplementation,
44+
abi.encodePacked(guardedInitializer, args)
45+
);
3946
}
4047

4148
function _implementation() internal view override returns (address) {
4249
address implementation = ERC1967Utils.getImplementation();
43-
return implementation != address(0) ? implementation : initialImplementation;
50+
return
51+
implementation != address(0)
52+
? implementation
53+
: initialImplementation;
4454
}
4555

4656
function _fallback() internal override {

0 commit comments

Comments
 (0)