Skip to content

Commit

Permalink
ERC6551 working non-upgradeable
Browse files Browse the repository at this point in the history
  • Loading branch information
eloi010 committed Nov 29, 2023
1 parent 709a684 commit cadb025
Show file tree
Hide file tree
Showing 4 changed files with 281 additions and 320 deletions.
14 changes: 7 additions & 7 deletions contracts/core/erc6551/ERC6551OpenfortAccount.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,25 +21,24 @@ import {BaseOpenfortAccount, IEntryPoint, ECDSAUpgradeable} from "../base/BaseOp
contract ERC6551OpenfortAccount is BaseOpenfortAccount, IERC6551Account, IERC6551Executable {
using ECDSAUpgradeable for bytes32;

address internal entrypointContract;

// bytes4(keccak256("execute(address,uint256,bytes,uint8)")
bytes4 internal constant EXECUTE_ERC6551_SELECTOR = 0x51945447;
address constant DEFAULT_ENTRYPOINT = 0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789;

address internal entrypointContract;
uint256 public state;

error OperationNotAllowed();

receive() external payable override(BaseOpenfortAccount, IERC6551Account) {}

constructor() {}

/*
* @notice Initialize the smart contract wallet.
*/
function initialize(address _entrypoint) public initializer {
_requireFromOwner();
if (_entrypoint == address(0)) revert ZeroAddressNotAllowed();
emit EntryPointUpdated(entrypointContract, _entrypoint);
entrypointContract = _entrypoint;
function initialize() public initializer {
entrypointContract = DEFAULT_ENTRYPOINT;
__EIP712_init("Openfort", "0.5");
state = 1;
}
Expand Down Expand Up @@ -82,6 +81,7 @@ contract ERC6551OpenfortAccount is BaseOpenfortAccount, IERC6551Account, IERC655
returns (bytes memory _result)
{
if (_operation != 0) revert OperationNotAllowed();
_requireFromEntryPointOrOwner();
++state;
bool success;
(success, _result) = _target.call{value: _value}(_data);
Expand Down
18 changes: 0 additions & 18 deletions contracts/core/erc6551/ERC6551OpenfortProxy.sol

This file was deleted.

295 changes: 0 additions & 295 deletions test/foundry/core/erc6551/EIP6551OpenfortAccountTest.t.sol

This file was deleted.

Loading

0 comments on commit cadb025

Please sign in to comment.