-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from tokenbound/jw/account-v3
Tokenbound v3
- Loading branch information
Showing
51 changed files
with
2,483 additions
and
1,211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
[submodule "lib/forge-std"] | ||
path = lib/forge-std | ||
url = https://github.com/foundry-rs/forge-std | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/openzeppelin/openzeppelin-contracts | ||
[submodule "lib/account-abstraction"] | ||
path = lib/account-abstraction | ||
url = https://github.com/eth-infinitism/account-abstraction | ||
[submodule "lib/erc6551"] | ||
path = lib/erc6551 | ||
url = https://github.com/erc6551/reference | ||
[submodule "lib/openzeppelin-contracts"] | ||
path = lib/openzeppelin-contracts | ||
url = https://github.com/OpenZeppelin/openzeppelin-contracts | ||
[submodule "lib/multicall-authenticated"] | ||
path = lib/multicall-authenticated | ||
url = https://github.com/jaydenwindle/multicall-authenticated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule erc6551
updated
25 files
+18 −0 | .gas-snapshot | |
+0 −2 | .prettierignore | |
+0 −14 | .prettierrc.json | |
+11 −1 | README.md | |
+3 −0 | foundry.toml | |
+2 −5 | package.json | |
+465 −0 | pnpm-lock.yaml | |
+6 −6 | script/ComputeRegistryAddress.s.sol | |
+1 −2 | script/DeployRegistry.s.sol | |
+134 −44 | src/ERC6551Registry.sol | |
+39 −26 | src/examples/simple/ERC6551Account.sol | |
+39 −56 | src/examples/upgradeable/ERC6551AccountUpgradeable.sol | |
+11 −15 | src/interfaces/IERC6551Account.sol | |
+12 −15 | src/interfaces/IERC6551Executable.sol | |
+21 −20 | src/interfaces/IERC6551Registry.sol | |
+69 −24 | src/lib/ERC6551AccountLib.sol | |
+45 −14 | src/lib/ERC6551BytecodeLib.sol | |
+1 −1 | src/package.json | |
+68 −0 | test/ERC6551AccountLib.t.sol | |
+38 −0 | test/ERC6551BytecodeLib.t.sol | |
+38 −42 | test/ERC6551Registry.t.sol | |
+10 −28 | test/examples/simple/ERC6551Account.t.sol | |
+50 −179 | test/examples/upgradeable/ERC6551AccountUpgradeable.t.sol | |
+1 −5 | test/mocks/MockERC1155.sol | |
+7 −16 | test/mocks/MockERC6551Account.sol |
Submodule multicall-authenticated
added at
653b2b
Submodule openzeppelin-contracts
updated
539 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
|
||
import "@openzeppelin/contracts/utils/Create2.sol"; | ||
import "@openzeppelin/contracts/utils/Strings.sol"; | ||
|
||
import "../src/AccountGuardian.sol"; | ||
import "../src/AccountV3Upgradable.sol"; | ||
import "../src/AccountProxy.sol"; | ||
|
||
contract DeployAccountV3 is Script { | ||
function run() external { | ||
bytes32 salt = 0x6551655165516551655165516551655165516551655165516551655165516551; | ||
address factory = 0x4e59b44847b379578588920cA78FbF26c0B4956C; | ||
|
||
address tokenboundSafe = 0x781b6A527482828bB04F33563797d4b696ddF328; | ||
address erc4337EntryPoint = 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789; | ||
address multicallForwarder = 0xcA1167915584462449EE5b4Ea51c37fE81eCDCCD; | ||
address erc6551Registry = 0x8deDFee9BEEe2D64817Dd8dB8cff138C468Bd3Ef; | ||
|
||
address guardian = Create2.computeAddress( | ||
salt, | ||
keccak256( | ||
abi.encodePacked(type(AccountGuardian).creationCode, abi.encode(tokenboundSafe)) | ||
), | ||
factory | ||
); | ||
address implementation = Create2.computeAddress( | ||
salt, | ||
keccak256( | ||
abi.encodePacked( | ||
type(AccountV3Upgradable).creationCode, | ||
abi.encode(erc4337EntryPoint, multicallForwarder, erc6551Registry, guardian) | ||
) | ||
), | ||
factory | ||
); | ||
address proxy = Create2.computeAddress( | ||
salt, | ||
keccak256( | ||
abi.encodePacked( | ||
type(AccountProxy).creationCode, abi.encode(guardian, implementation) | ||
) | ||
), | ||
factory | ||
); | ||
|
||
// Deploy AccountGuardian | ||
if (guardian.code.length == 0) { | ||
vm.startBroadcast(); | ||
new AccountGuardian{salt: salt}(tokenboundSafe); | ||
vm.stopBroadcast(); | ||
|
||
console.log("AccountGuardian:", guardian, "(deployed)"); | ||
} else { | ||
console.log("AccountGuardian:", guardian, "(exists)"); | ||
} | ||
|
||
// Deploy Account implementation | ||
if (implementation.code.length == 0) { | ||
vm.startBroadcast(); | ||
new AccountV3Upgradable{salt: salt}( | ||
erc4337EntryPoint, | ||
multicallForwarder, | ||
erc6551Registry, | ||
guardian | ||
); | ||
vm.stopBroadcast(); | ||
|
||
console.log("AccountV3Upgradable:", implementation, "(deployed)"); | ||
} else { | ||
console.log("AccountV3Upgradable:", implementation, "(exists)"); | ||
} | ||
|
||
// Deploy AccountProxy | ||
if (proxy.code.length == 0) { | ||
vm.startBroadcast(); | ||
new AccountProxy{salt: salt}(guardian, implementation); | ||
vm.stopBroadcast(); | ||
|
||
console.log("AccountProxy:", proxy, "(deployed)"); | ||
} else { | ||
console.log("AccountProxy:", proxy, "(exists)"); | ||
} | ||
|
||
console.log("\nVerification Commands:\n"); | ||
console.log( | ||
"AccountGuardian: forge verify-contract --num-of-optimizations 200 --chain-id", | ||
block.chainid, | ||
guardian, | ||
string.concat( | ||
"src/AccountGuardian.sol:AccountGuardian --constructor-args $(cast abi-encode \"constructor(address)\" ", | ||
Strings.toHexString(tokenboundSafe), | ||
")\n" | ||
) | ||
); | ||
console.log( | ||
"AccountV3Upgradable: forge verify-contract --num-of-optimizations 200 --chain-id", | ||
block.chainid, | ||
implementation, | ||
string.concat( | ||
"src/AccountV3Upgradable.sol:AccountV3Upgradable --constructor-args $(cast abi-encode \"constructor(address,address,address,address)\" ", | ||
Strings.toHexString(erc4337EntryPoint), | ||
" ", | ||
Strings.toHexString(multicallForwarder), | ||
" ", | ||
Strings.toHexString(erc6551Registry), | ||
" ", | ||
Strings.toHexString(guardian), | ||
")\n" | ||
) | ||
); | ||
console.log( | ||
"AccountProxy: forge verify-contract --num-of-optimizations 200 --chain-id", | ||
block.chainid, | ||
proxy, | ||
string.concat( | ||
"src/AccountProxy.sol:AccountProxy --constructor-args $(cast abi-encode \"constructor(address,address)\" ", | ||
Strings.toHexString(guardian), | ||
" ", | ||
Strings.toHexString(implementation), | ||
")\n" | ||
) | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.