Skip to content

Commit

Permalink
update: add ownable, access control
Browse files Browse the repository at this point in the history
  • Loading branch information
howydev committed Jul 18, 2024
1 parent 8b888e1 commit 12b8bbe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/account/AccountFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ pragma solidity ^0.8.19;
import {IEntryPoint} from "@eth-infinitism/account-abstraction/interfaces/IEntryPoint.sol";
import {ERC1967Proxy} from "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol";
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

import {UpgradeableModularAccount} from "../../src/account/UpgradeableModularAccount.sol";
import {ValidationConfigLib} from "../../src/helpers/ValidationConfigLib.sol";
import {SingleSignerValidation} from "../../src/plugins/validation/SingleSignerValidation.sol";

contract AccountFactory {
contract AccountFactory is Ownable {
UpgradeableModularAccount public accountImplementation;
bytes32 private immutable _PROXY_BYTECODE_HASH;
uint32 public constant UNSTAKE_DELAY = 1 weeks;
Expand Down Expand Up @@ -66,10 +67,18 @@ contract AccountFactory {
return Create2.computeAddress(getSalt(owner, salt), _PROXY_BYTECODE_HASH);
}

function addStake() external payable {
function addStake() external payable onlyOwner {
entryPoint.addStake{value: msg.value}(UNSTAKE_DELAY);
}

function unlockStake() external onlyOwner {
entryPoint.unlockStake();
}

function withdrawStake(address payable withdrawAddress) external onlyOwner {
entryPoint.withdrawStake(withdrawAddress);
}

function getSalt(address owner, uint256 salt) public pure returns (bytes32) {
return keccak256(abi.encodePacked(owner, salt));
}
Expand Down

0 comments on commit 12b8bbe

Please sign in to comment.