Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Jan 31, 2024
1 parent 93bb92f commit 7ba2ba3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ REQUIRED_STAKE_AMOUNT=1
UNSTAKE_DELAY_SEC=86400

ENTRYPOINT=
# MSCA_IMPL=
# MA_IMPL=
# OWNER_FACTORY=
# OWNER_TOKEN_RECEIVER_FACTORY=

Expand Down
2 changes: 1 addition & 1 deletion .gasestimates.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Running 8 tests for test/account/AccountLoupe.t.sol:AccountLoupeTest
[PASS] test_trace_comprehensivePlugin() (gas: 40594)
Test result: ok. 8 passed; 0 failed; 0 skipped; finished in 4.27ms

Running 2 tests for test/upgrade/LightAccountToMA.t.sol:LightAccountToMSCATest
Running 2 tests for test/upgrade/LightAccountToMA.t.sol:LightAccountToMATest
[PASS] test_upgrade() (gas: 761649)
[PASS] test_verifySetup() (gas: 30117)
Test result: ok. 2 passed; 0 failed; 0 skipped; finished in 6.70ms
Expand Down
30 changes: 15 additions & 15 deletions test/upgrade/LightAccountToMA.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ import {Test} from "forge-std/Test.sol";
import {LightAccount} from "@alchemy/light-account/src/LightAccount.sol";
import {LightAccountFactory} from "@alchemy/light-account/src/LightAccountFactory.sol";
import {EntryPoint} from "@eth-infinitism/account-abstraction/core/EntryPoint.sol";
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";
import {IEntryPoint as I4337EntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";

import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAccount.sol";
import {IEntryPoint as IMSCAEntryPoint} from "../../src/interfaces/erc4337/IEntryPoint.sol";
import {IEntryPoint} from "../../src/interfaces/erc4337/IEntryPoint.sol";
import {MultiOwnerPlugin} from "../../src/plugins/owner/MultiOwnerPlugin.sol";
import {MockERC20} from "../mocks/tokens/MockERC20.sol";

contract LightAccountToMSCATest is Test {
IEntryPoint public entryPoint;
IMSCAEntryPoint public mscaEntryPoint;
contract LightAccountToMATest is Test {
I4337EntryPoint public entryPoint;
IEntryPoint public maEntryPoint;

MockERC20 public token1;

Expand All @@ -40,13 +40,13 @@ contract LightAccountToMSCATest is Test {
LightAccount public lightAccount;

MultiOwnerPlugin public multiOwnerPlugin;
address public mscaImpl;
address public maImpl;

event ModularAccountInitialized(IMSCAEntryPoint indexed entryPoint);
event ModularAccountInitialized(IEntryPoint indexed entryPoint);

function setUp() public {
entryPoint = IEntryPoint(address(new EntryPoint()));
mscaEntryPoint = IMSCAEntryPoint(address(entryPoint));
entryPoint = I4337EntryPoint(address(new EntryPoint()));
maEntryPoint = IEntryPoint(address(entryPoint));
(owner,) = makeAddrAndKey("owner");

// set up light account
Expand All @@ -58,9 +58,9 @@ contract LightAccountToMSCATest is Test {
token1 = new MockERC20("T1");
token1.mint(address(lightAccount), 1 ether);

// setup MSCA
// setup modular account
multiOwnerPlugin = new MultiOwnerPlugin();
mscaImpl = address(new UpgradeableModularAccount(mscaEntryPoint));
maImpl = address(new UpgradeableModularAccount(maEntryPoint));
}

function test_verifySetup() public {
Expand All @@ -74,7 +74,7 @@ contract LightAccountToMSCATest is Test {
}

function test_upgrade() public {
// setup data for msca upgrade
// setup data for modular account upgrade
owners = new address[](1);
owners[0] = owner;
address[] memory plugins = new address[](1);
Expand All @@ -84,12 +84,12 @@ contract LightAccountToMSCATest is Test {
bytes[] memory pluginInitBytes = new bytes[](1);
pluginInitBytes[0] = abi.encode(owners);

// upgrade to msca
// upgrade to modular account
vm.startPrank(owner);
vm.expectEmit(true, true, true, true);
emit ModularAccountInitialized(mscaEntryPoint);
emit ModularAccountInitialized(maEntryPoint);
lightAccount.upgradeToAndCall(
mscaImpl,
maImpl,
abi.encodeCall(
UpgradeableModularAccount.initialize, (plugins, abi.encode(manifestHashes, pluginInitBytes))
)
Expand Down

0 comments on commit 7ba2ba3

Please sign in to comment.