1
- // SPDX-License-Identifier: UNLICENSED
1
+ // SPDX-License-Identifier: Apache 2.0
2
2
pragma solidity ^ 0.8.0 ;
3
3
4
4
/* solhint-disable avoid-low-level-calls */
@@ -26,6 +26,15 @@ import "./erc6551-utils/IERC6551Account.sol";
26
26
import "../../../eip/interface/IERC721.sol " ;
27
27
import "../non-upgradeable/Account.sol " ;
28
28
29
+ // $$\ $$\ $$\ $$\ $$\
30
+ // $$ | $$ | \__| $$ | $$ |
31
+ // $$$$$$\ $$$$$$$\ $$\ $$$$$$\ $$$$$$$ |$$\ $$\ $$\ $$$$$$\ $$$$$$$\
32
+ // \_$$ _| $$ __$$\ $$ |$$ __$$\ $$ __$$ |$$ | $$ | $$ |$$ __$$\ $$ __$$\
33
+ // $$ | $$ | $$ |$$ |$$ | \__|$$ / $$ |$$ | $$ | $$ |$$$$$$$$ |$$ | $$ |
34
+ // $$ |$$\ $$ | $$ |$$ |$$ | $$ | $$ |$$ | $$ | $$ |$$ ____|$$ | $$ |
35
+ // \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
36
+ // \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
37
+
29
38
contract TokenBoundAccount is
30
39
Initializable ,
31
40
ERC1271 ,
@@ -55,6 +64,8 @@ contract TokenBoundAccount is
55
64
/// @notice EIP 4337 Entrypoint contract.
56
65
IEntryPoint private immutable entrypointContract;
57
66
67
+ uint256 public state;
68
+
58
69
/*///////////////////////////////////////////////////////////////
59
70
Constructor, Initializer, Modifiers
60
71
//////////////////////////////////////////////////////////////*/
@@ -85,6 +96,17 @@ contract TokenBoundAccount is
85
96
return (owner () == _signer);
86
97
}
87
98
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
+
88
110
/// @notice See EIP-1271
89
111
function isValidSignature (bytes32 _hash , bytes memory _signature )
90
112
public
@@ -108,14 +130,6 @@ contract TokenBoundAccount is
108
130
return IERC721 (tokenContract).ownerOf (tokenId);
109
131
}
110
132
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
-
119
133
/// @notice Withdraw funds for this account from Entrypoint.
120
134
function withdrawDepositTo (address payable withdrawAddress , uint256 amount ) public virtual {
121
135
require (owner () == msg .sender , "Account: not NFT owner " );
@@ -134,10 +148,6 @@ contract TokenBoundAccount is
134
148
return ERC6551AccountLib .token ();
135
149
}
136
150
137
- function nonce () external view returns (uint256 ) {
138
- return getNonce ();
139
- }
140
-
141
151
/// @notice See {IERC165-supportsInterface}.
142
152
function supportsInterface (bytes4 interfaceId ) public view virtual override (ERC1155Receiver ) returns (bool ) {
143
153
return
@@ -191,6 +201,7 @@ contract TokenBoundAccount is
191
201
uint256 value ,
192
202
bytes memory _calldata
193
203
) internal virtual returns (bytes memory result ) {
204
+ ++ state;
194
205
bool success;
195
206
(success, result) = _target.call { value: value }(_calldata);
196
207
if (! success) {
0 commit comments