1- // SPDX-License-Identifier: UNLICENSED
1+ // SPDX-License-Identifier: Apache 2.0
22pragma solidity ^ 0.8.0 ;
33
44/* solhint-disable avoid-low-level-calls */
@@ -26,6 +26,15 @@ import "./erc6551-utils/IERC6551Account.sol";
2626import "../../../eip/interface/IERC721.sol " ;
2727import "../non-upgradeable/Account.sol " ;
2828
29+ // $$\ $$\ $$\ $$\ $$\
30+ // $$ | $$ | \__| $$ | $$ |
31+ // $$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$$$$$$ |$$\ $$\ $$\ $$$$$$\ $$$$$$$\
32+ // \_$$ _| $$ __$$\ $$ |$$ __$$\ $$ __$$ |$$ | $$ | $$ |$$ __$$\ $$ __$$\
33+ // $$ | $$ | $$ |$$ |$$ | \__|$$ / $$ |$$ | $$ | $$ |$$$$$$$$ |$$ | $$ |
34+ // $$ |$$\ $$ | $$ |$$ |$$ | $$ | $$ |$$ | $$ | $$ |$$ ____|$$ | $$ |
35+ // \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
36+ // \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
37+
2938contract TokenBoundAccount is
3039 Initializable ,
3140 ERC1271 ,
@@ -55,6 +64,8 @@ contract TokenBoundAccount is
5564 /// @notice EIP 4337 Entrypoint contract.
5665 IEntryPoint private immutable entrypointContract;
5766
67+ uint256 public state;
68+
5869 /*///////////////////////////////////////////////////////////////
5970 Constructor, Initializer, Modifiers
6071 //////////////////////////////////////////////////////////////*/
@@ -85,6 +96,17 @@ contract TokenBoundAccount is
8596 return (owner () == _signer);
8697 }
8798
99+ function isValidSigner (address signer , bytes calldata ) external view returns (bytes4 ) {
100+ if (_isValidSigner (signer)) {
101+ return IERC6551Account .isValidSigner.selector ;
102+ }
103+ return bytes4 (0 );
104+ }
105+
106+ function _isValidSigner (address signer ) internal view returns (bool ) {
107+ return signer == owner ();
108+ }
109+
88110 /// @notice See EIP-1271
89111 function isValidSignature (bytes32 _hash , bytes memory _signature )
90112 public
@@ -108,14 +130,6 @@ contract TokenBoundAccount is
108130 return IERC721 (tokenContract).ownerOf (tokenId);
109131 }
110132
111- function executeCall (
112- address to ,
113- uint256 value ,
114- bytes calldata data
115- ) external payable onlyAdminOrEntrypoint returns (bytes memory result ) {
116- return _call (to, value, data);
117- }
118-
119133 /// @notice Withdraw funds for this account from Entrypoint.
120134 function withdrawDepositTo (address payable withdrawAddress , uint256 amount ) public virtual {
121135 require (owner () == msg .sender , "Account: not NFT owner " );
@@ -134,10 +148,6 @@ contract TokenBoundAccount is
134148 return ERC6551AccountLib .token ();
135149 }
136150
137- function nonce () external view returns (uint256 ) {
138- return getNonce ();
139- }
140-
141151 /// @notice See {IERC165-supportsInterface}.
142152 function supportsInterface (bytes4 interfaceId ) public view virtual override (ERC1155Receiver ) returns (bool ) {
143153 return
@@ -191,6 +201,7 @@ contract TokenBoundAccount is
191201 uint256 value ,
192202 bytes memory _calldata
193203 ) internal virtual returns (bytes memory result ) {
204+ ++ state;
194205 bool success;
195206 (success, result) = _target.call { value: value }(_calldata);
196207 if (! success) {
0 commit comments