Skip to content

Commit

Permalink
chore: rename to reflect SSO interface (#185)
Browse files Browse the repository at this point in the history
* chore: rename to reflect SSO interface

This has diverged from Clave and did not make the cut for 7579
compatiability, so we're renaming whatever is in between to SSO.

We may add back the 7579 interfaces if we get 4337 relayer support in
the future, but otherwise we were just inspiried by it instead of
compliant.

* fix: update contract addresses

This only updates the in memory node as I don't want to deploy to
sepolia until those tests pass

* fix: update addresses

---------

Co-authored-by: Lyova Potyomkin <[email protected]>
  • Loading branch information
cpb8010 and ly0va authored Nov 19, 2024
1 parent 632ff94 commit 58126c7
Show file tree
Hide file tree
Showing 21 changed files with 64 additions and 660 deletions.
4 changes: 2 additions & 2 deletions packages/auth-server/stores/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ export const contractsByChain: Record<SupportedChainId, ChainContracts> = {
},
[zksyncInMemoryNode.id]: {
session: "0x8543528a4561E3a5EC7d51Bfd3776457b0E7b7dc",
passkey: "0x07734BA326b6AD13BfC0115b0903EB14268F1617",
passkey: "0x975df0c7f5CB728ae9F96480491Ec5d1E17296f4",
accountFactory: "0xaAF5f437fB0524492886fbA64D703df15BF619AE",
accountPaymaster: "0x2879853afd8d066ca66e224A8E85621aC43d6F59",
accountPaymaster: "0x351cB880A2B9E1Cf3060ea58Ec5280CBCe87579A",
},
};

Expand Down
16 changes: 12 additions & 4 deletions packages/contracts/src/AAFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.24;
import "@matterlabs/zksync-contracts/l2/system-contracts/Constants.sol";
import "@matterlabs/zksync-contracts/l2/system-contracts/libraries/SystemContractsCaller.sol";

import { IClaveAccount } from "./interfaces/IClaveAccount.sol";
import { ISsoAccount } from "./interfaces/ISsoAccount.sol";
import { UpgradeableBeacon } from "./UpgradeableBeacon.sol";

import "./helpers/Logger.sol";
Expand All @@ -19,14 +19,22 @@ contract AAFactory is UpgradeableBeacon {
beaconProxyBytecodeHash = _beaconProxyBytecodeHash;
}

function addNewUniqueId(bytes32 uniqueAccountId) external {}

function deployProxy7579Account(
bytes32 salt,
string calldata uniqueAccountId,
bytes[] calldata initialValidators,
bytes[] calldata initialModules,
address[] calldata initialK1Owners
) external returns (address) {
return this.deployProxySsoAccount(salt, uniqueAccountId, initialValidators, initialModules, initialK1Owners);
}

function deployProxySsoAccount(
bytes32 salt,
string calldata uniqueAccountId,
bytes[] calldata initialValidators,
bytes[] calldata initialModules,
address[] calldata initialK1Owners
) external returns (address accountAddress) {
(bool success, bytes memory returnData) = SystemContractsCaller.systemCallWithReturndata(
uint32(gasleft()),
Expand All @@ -50,7 +58,7 @@ contract AAFactory is UpgradeableBeacon {
Logger.logAddress(accountAddress);

// add session-key/spend-limit module (similar code)
IClaveAccount(accountAddress).initialize(initialValidators, initialModules, initialK1Owners);
ISsoAccount(accountAddress).initialize(initialValidators, initialModules, initialK1Owners);

if (accountMappings[uniqueAccountId] != address(0)) {
revert("Account already exists");
Expand Down
289 changes: 0 additions & 289 deletions packages/contracts/src/ERC7579Account.sol

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { ModeCode } from "./libraries/ERC7579Mode.sol";
import { ERC1271Handler } from "./handlers/ERC1271Handler.sol";
import { BatchCaller } from "./batch/BatchCaller.sol";

import { IClaveAccount } from "./interfaces/IClaveAccount.sol";
import { ISsoAccount } from "./interfaces/ISsoAccount.sol";

import "./helpers/Logger.sol";

Expand All @@ -32,15 +32,15 @@ import "./helpers/Logger.sol";
* @author https://getclave.io
*/

contract ClaveAccount is
contract SsoAccount is
Initializable,
UpgradeManager,
HookManager,
ModuleManager,
ERC1271Handler,
TokenCallbackHandler,
BatchCaller,
IClaveAccount
ISsoAccount
{
// Helper library for the Transaction struct
using TransactionHelper for Transaction;
Expand Down Expand Up @@ -201,9 +201,9 @@ contract ClaveAccount is
transaction.processPaymasterInput();
}

/// @dev type(IClave).interfaceId indicates Clave accounts
/// @dev type(ISsoAccount).interfaceId indicates SSO accounts
function supportsInterface(bytes4 interfaceId) public view override(IERC165, TokenCallbackHandler) returns (bool) {
return interfaceId == type(IClaveAccount).interfaceId || super.supportsInterface(interfaceId);
return interfaceId == type(ISsoAccount).interfaceId || super.supportsInterface(interfaceId);
}

function _validateTransaction(
Expand Down
Loading

0 comments on commit 58126c7

Please sign in to comment.