Skip to content

Commit dd6dc1b

Browse files
authored
docs update + remove tw from account contracts name (#372)
docs update + remove tw from name
1 parent 3d88826 commit dd6dc1b

31 files changed

+3573
-208
lines changed

contracts/smart-wallet/dynamic/TWDynamicAccount.sol renamed to contracts/smart-wallet/dynamic/DynamicAccount.sol

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pragma solidity ^0.8.11;
55
/* solhint-disable no-inline-assembly */
66
/* solhint-disable reason-string */
77

8-
import "../non-upgradeable/TWAccount.sol";
8+
import "../non-upgradeable/Account.sol";
99
import "../utils/BaseRouter.sol";
1010

1111
// $$\ $$\ $$\ $$\ $$\
@@ -17,7 +17,7 @@ import "../utils/BaseRouter.sol";
1717
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
1818
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
1919

20-
contract TWDynamicAccount is TWAccount, BaseRouter {
20+
contract DynamicAccount is Account, BaseRouter {
2121
/*///////////////////////////////////////////////////////////////
2222
Constants
2323
//////////////////////////////////////////////////////////////*/
@@ -28,9 +28,9 @@ contract TWDynamicAccount is TWAccount, BaseRouter {
2828
Constructor and Initializer
2929
//////////////////////////////////////////////////////////////*/
3030

31-
receive() external payable override(Router, TWAccount) {}
31+
receive() external payable override(Router, Account) {}
3232

33-
constructor(IEntryPoint _entrypoint) TWAccount(_entrypoint) {}
33+
constructor(IEntryPoint _entrypoint) Account(_entrypoint) {}
3434

3535
function initialize(address _defaultAdmin) public override initializer {
3636
_setupRole(DEFAULT_ADMIN_ROLE, _defaultAdmin);
@@ -42,7 +42,7 @@ contract TWDynamicAccount is TWAccount, BaseRouter {
4242
//////////////////////////////////////////////////////////////*/
4343

4444
/// @dev See {IERC165-supportsInterface}.
45-
function supportsInterface(bytes4 interfaceId) public view virtual override(TWAccount, BaseRouter) returns (bool) {
45+
function supportsInterface(bytes4 interfaceId) public view virtual override(Account, BaseRouter) returns (bool) {
4646
return
4747
interfaceId == type(IBaseRouter).interfaceId ||
4848
interfaceId == type(IRouter).interfaceId ||

contracts/smart-wallet/dynamic/TWDynamicAccountFactory.sol renamed to contracts/smart-wallet/dynamic/DynamicAccountFactory.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import "@openzeppelin/contracts/proxy/Clones.sol";
77
import "../../lib/TWStringSet.sol";
88

99
// Interface
10-
import "./../interfaces/ITWAccountFactory.sol";
10+
import "./../interfaces/IAccountFactory.sol";
1111

1212
// Smart wallet implementation
13-
import "./TWDynamicAccount.sol";
13+
import "./DynamicAccount.sol";
1414

1515
// $$\ $$\ $$\ $$\ $$\
1616
// $$ | $$ | \__| $$ | $$ |
@@ -21,21 +21,21 @@ import "./TWDynamicAccount.sol";
2121
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
2222
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
2323

24-
contract TWDynamicAccountFactory is ITWAccountFactory, Multicall {
24+
contract DynamicAccountFactory is IAccountFactory, Multicall {
2525
using TWStringSet for TWStringSet.Set;
2626

2727
/*///////////////////////////////////////////////////////////////
2828
State
2929
//////////////////////////////////////////////////////////////*/
3030

31-
TWDynamicAccount private immutable _accountImplementation;
31+
DynamicAccount private immutable _accountImplementation;
3232

3333
/*///////////////////////////////////////////////////////////////
3434
Constructor
3535
//////////////////////////////////////////////////////////////*/
3636

3737
constructor(IEntryPoint _entrypoint) {
38-
_accountImplementation = new TWDynamicAccount(_entrypoint);
38+
_accountImplementation = new DynamicAccount(_entrypoint);
3939
}
4040

4141
/*///////////////////////////////////////////////////////////////
@@ -54,7 +54,7 @@ contract TWDynamicAccountFactory is ITWAccountFactory, Multicall {
5454

5555
account = Clones.cloneDeterministic(impl, salt);
5656

57-
TWAccount(payable(account)).initialize(_admin);
57+
Account(payable(account)).initialize(_admin);
5858

5959
emit AccountCreated(account, _admin, _accountId);
6060

contracts/smart-wallet/interfaces/ITWAccountFactory.sol renamed to contracts/smart-wallet/interfaces/IAccountFactory.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-3.0
22
pragma solidity ^0.8.12;
33

4-
interface ITWAccountFactory {
4+
interface IAccountFactory {
55
/*///////////////////////////////////////////////////////////////
66
Events
77
//////////////////////////////////////////////////////////////*/

contracts/smart-wallet/managed/TWAccountCore.sol renamed to contracts/smart-wallet/managed/AccountCore.sol

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,22 @@ import "../../dynamic-contracts/extension/PermissionsEnumerable.sol";
2929
Storage layout
3030
//////////////////////////////////////////////////////////////*/
3131

32-
library TWAccountStorage {
33-
bytes32 internal constant TWACCOUNT_STORAGE_POSITION = keccak256("twaccount.storage");
32+
library AccountStorage {
33+
bytes32 internal constant ACCOUNT_STORAGE_POSITION = keccak256("account.storage");
3434

3535
struct Data {
3636
uint256 nonce;
3737
}
3838

39-
function accountStorage() internal pure returns (Data storage twaccountData) {
40-
bytes32 position = TWACCOUNT_STORAGE_POSITION;
39+
function accountStorage() internal pure returns (Data storage accountData) {
40+
bytes32 position = ACCOUNT_STORAGE_POSITION;
4141
assembly {
42-
twaccountData.slot := position
42+
accountData.slot := position
4343
}
4444
}
4545
}
4646

47-
contract TWAccountCore is Initializable, Multicall, BaseAccount {
47+
contract AccountCore is Initializable, Multicall, BaseAccount {
4848
using ECDSA for bytes32;
4949

5050
/*///////////////////////////////////////////////////////////////
@@ -79,8 +79,8 @@ contract TWAccountCore is Initializable, Multicall, BaseAccount {
7979

8080
/// @notice Returns the nonce of the account.
8181
function nonce() public view virtual override returns (uint256) {
82-
TWAccountStorage.Data storage twaccountData = TWAccountStorage.accountStorage();
83-
return twaccountData.nonce;
82+
AccountStorage.Data storage accountData = AccountStorage.accountStorage();
83+
return accountData.nonce;
8484
}
8585

8686
/// @notice Returns the EIP 4337 entrypoint contract.
@@ -109,7 +109,7 @@ contract TWAccountCore is Initializable, Multicall, BaseAccount {
109109

110110
/// @notice Withdraw funds for this account from Entrypoint.
111111
function withdrawDepositTo(address payable withdrawAddress, uint256 amount) public {
112-
require(_hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "TWAccount: not admin");
112+
require(_hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Account: not admin");
113113
entryPoint().withdrawTo(withdrawAddress, amount);
114114
}
115115

@@ -119,8 +119,8 @@ contract TWAccountCore is Initializable, Multicall, BaseAccount {
119119

120120
/// @dev Validates the nonce of a user operation and updates account nonce.
121121
function _validateAndUpdateNonce(UserOperation calldata userOp) internal override {
122-
TWAccountStorage.Data storage data = TWAccountStorage.accountStorage();
123-
require(data.nonce == userOp.nonce, "TWAccount: invalid nonce");
122+
AccountStorage.Data storage data = AccountStorage.accountStorage();
123+
require(data.nonce == userOp.nonce, "Account: invalid nonce");
124124

125125
data.nonce += 1;
126126
}

contracts/smart-wallet/managed/TWAccountExtension.sol renamed to contracts/smart-wallet/managed/AccountExtension.sol

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import "../../openzeppelin-presets/utils/cryptography/ECDSA.sol";
2323
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
2424
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
2525

26-
contract TWAccountExtension is ContractMetadata, PermissionsEnumerable, ERC721Holder, ERC1155Holder {
26+
contract AccountExtension is ContractMetadata, PermissionsEnumerable, ERC721Holder, ERC1155Holder {
2727
using ECDSA for bytes32;
2828

2929
/*///////////////////////////////////////////////////////////////
@@ -50,7 +50,7 @@ contract TWAccountExtension is ContractMetadata, PermissionsEnumerable, ERC721Ho
5050
modifier onlyAdminOrEntrypoint() {
5151
require(
5252
msg.sender == entrypointContract || hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
53-
"TWAccount: not admin or EntryPoint."
53+
"Account: not admin or EntryPoint."
5454
);
5555
_;
5656
}
@@ -86,10 +86,7 @@ contract TWAccountExtension is ContractMetadata, PermissionsEnumerable, ERC721Ho
8686
uint256[] calldata _value,
8787
bytes[] calldata _calldata
8888
) external virtual onlyAdminOrEntrypoint {
89-
require(
90-
_target.length == _calldata.length && _target.length == _value.length,
91-
"TWAccount: wrong array lengths."
92-
);
89+
require(_target.length == _calldata.length && _target.length == _value.length, "Account: wrong array lengths.");
9390
for (uint256 i = 0; i < _target.length; i++) {
9491
_call(_target[i], _value[i], _calldata[i]);
9592
}

contracts/smart-wallet/managed/TWManagedAccount.sol renamed to contracts/smart-wallet/managed/ManagedAccount.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ pragma solidity ^0.8.11;
1414
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
1515
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
1616

17-
import "./TWAccountCore.sol";
17+
import "./AccountCore.sol";
1818
import "lib/dynamic-contracts/src/core/Router.sol";
1919

20-
contract TWManagedAccount is TWAccountCore, Router {
20+
contract ManagedAccount is AccountCore, Router {
2121
address public factory;
2222

23-
constructor(IEntryPoint _entrypoint) TWAccountCore(_entrypoint) {}
23+
constructor(IEntryPoint _entrypoint) AccountCore(_entrypoint) {}
2424

2525
/// @notice Initializes the smart contract wallet.
2626
function initialize(address _defaultAdmin) public virtual override initializer {
@@ -29,7 +29,7 @@ contract TWManagedAccount is TWAccountCore, Router {
2929
}
3030

3131
// solhint-disable-next-line no-empty-blocks
32-
receive() external payable virtual override(Router, TWAccountCore) {}
32+
receive() external payable virtual override(Router, AccountCore) {}
3333

3434
/// @notice Returns the implementation contract address for a given function signature.
3535
function getImplementationForFunction(bytes4) public view virtual override returns (address) {

contracts/smart-wallet/managed/TWManagedAccountFactory.sol renamed to contracts/smart-wallet/managed/ManagedAccountFactory.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import "@openzeppelin/contracts/proxy/Clones.sol";
99
import "../../dynamic-contracts/extension/PermissionsEnumerable.sol";
1010

1111
// Interface
12-
import "../interfaces/ITWAccountFactory.sol";
12+
import "../interfaces/IAccountFactory.sol";
1313

1414
// Smart wallet implementation
15-
import "./TWManagedAccount.sol";
15+
import "./ManagedAccount.sol";
1616

1717
// $$\ $$\ $$\ $$\ $$\
1818
// $$ | $$ | \__| $$ | $$ |
@@ -23,20 +23,20 @@ import "./TWManagedAccount.sol";
2323
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
2424
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
2525

26-
contract TWManagedAccountFactory is ITWAccountFactory, Multicall, PermissionsEnumerable, BaseRouter {
26+
contract TWManagedAccountFactory is IAccountFactory, Multicall, PermissionsEnumerable, BaseRouter {
2727
/*///////////////////////////////////////////////////////////////
2828
State
2929
//////////////////////////////////////////////////////////////*/
3030

31-
TWManagedAccount private immutable _accountImplementation;
31+
ManagedAccount private immutable _accountImplementation;
3232

3333
/*///////////////////////////////////////////////////////////////
3434
Constructor
3535
//////////////////////////////////////////////////////////////*/
3636

3737
constructor(IEntryPoint _entrypoint) {
3838
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
39-
_accountImplementation = new TWManagedAccount(_entrypoint);
39+
_accountImplementation = new ManagedAccount(_entrypoint);
4040
}
4141

4242
/*///////////////////////////////////////////////////////////////
@@ -55,7 +55,7 @@ contract TWManagedAccountFactory is ITWAccountFactory, Multicall, PermissionsEnu
5555

5656
account = Clones.cloneDeterministic(impl, salt);
5757

58-
TWManagedAccount(payable(account)).initialize(_admin);
58+
ManagedAccount(payable(account)).initialize(_admin);
5959

6060
emit AccountCreated(account, _admin, _accountId);
6161

contracts/smart-wallet/non-upgradeable/TWAccount.sol renamed to contracts/smart-wallet/non-upgradeable/Account.sol

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ import "../../openzeppelin-presets/utils/cryptography/ECDSA.sol";
3232
Storage layout
3333
//////////////////////////////////////////////////////////////*/
3434

35-
library TWAccountStorage {
36-
bytes32 internal constant TWACCOUNT_STORAGE_POSITION = keccak256("twaccount.storage");
35+
library AccountStorage {
36+
bytes32 internal constant ACCOUNT_STORAGE_POSITION = keccak256("account.storage");
3737

3838
struct Data {
3939
uint256 nonce;
4040
}
4141

42-
function accountStorage() internal pure returns (Data storage twaccountData) {
43-
bytes32 position = TWACCOUNT_STORAGE_POSITION;
42+
function accountStorage() internal pure returns (Data storage accountData) {
43+
bytes32 position = ACCOUNT_STORAGE_POSITION;
4444
assembly {
45-
twaccountData.slot := position
45+
accountData.slot := position
4646
}
4747
}
4848
}
4949

50-
contract TWAccount is
50+
contract Account is
5151
Initializable,
5252
Multicall,
5353
BaseAccount,
@@ -87,7 +87,7 @@ contract TWAccount is
8787
modifier onlyAdminOrEntrypoint() {
8888
require(
8989
msg.sender == address(entryPoint()) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender),
90-
"TWAccount: not admin or EntryPoint."
90+
"Account: not admin or EntryPoint."
9191
);
9292
_;
9393
}
@@ -106,8 +106,8 @@ contract TWAccount is
106106

107107
/// @notice Returns the nonce of the account.
108108
function nonce() public view virtual override returns (uint256) {
109-
TWAccountStorage.Data storage twaccountData = TWAccountStorage.accountStorage();
110-
return twaccountData.nonce;
109+
AccountStorage.Data storage accountData = AccountStorage.accountStorage();
110+
return accountData.nonce;
111111
}
112112

113113
/// @notice Returns the EIP 4337 entrypoint contract.
@@ -144,10 +144,7 @@ contract TWAccount is
144144
uint256[] calldata _value,
145145
bytes[] calldata _calldata
146146
) external virtual onlyAdminOrEntrypoint {
147-
require(
148-
_target.length == _calldata.length && _target.length == _value.length,
149-
"TWAccount: wrong array lengths."
150-
);
147+
require(_target.length == _calldata.length && _target.length == _value.length, "Account: wrong array lengths.");
151148
for (uint256 i = 0; i < _target.length; i++) {
152149
_call(_target[i], _value[i], _calldata[i]);
153150
}
@@ -183,8 +180,8 @@ contract TWAccount is
183180

184181
/// @dev Validates the nonce of a user operation and updates account nonce.
185182
function _validateAndUpdateNonce(UserOperation calldata userOp) internal override {
186-
TWAccountStorage.Data storage data = TWAccountStorage.accountStorage();
187-
require(data.nonce == userOp.nonce, "TWAccount: invalid nonce");
183+
AccountStorage.Data storage data = AccountStorage.accountStorage();
184+
require(data.nonce == userOp.nonce, "Account: invalid nonce");
188185

189186
data.nonce += 1;
190187
}

contracts/smart-wallet/non-upgradeable/TWAccountFactory.sol renamed to contracts/smart-wallet/non-upgradeable/AccountFactory.sol

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import "@openzeppelin/contracts/proxy/Clones.sol";
77
import "../../lib/TWStringSet.sol";
88

99
// Interface
10-
import "./../interfaces/ITWAccountFactory.sol";
10+
import "./../interfaces/IAccountFactory.sol";
1111

1212
// Smart wallet implementation
13-
import "./TWAccount.sol";
13+
import "./Account.sol";
1414

1515
// $$\ $$\ $$\ $$\ $$\
1616
// $$ | $$ | \__| $$ | $$ |
@@ -21,21 +21,21 @@ import "./TWAccount.sol";
2121
// \$$$$ |$$ | $$ |$$ |$$ | \$$$$$$$ |\$$$$$\$$$$ |\$$$$$$$\ $$$$$$$ |
2222
// \____/ \__| \__|\__|\__| \_______| \_____\____/ \_______|\_______/
2323

24-
contract TWAccountFactory is ITWAccountFactory, Multicall {
24+
contract AccountFactory is IAccountFactory, Multicall {
2525
using TWStringSet for TWStringSet.Set;
2626

2727
/*///////////////////////////////////////////////////////////////
2828
State
2929
//////////////////////////////////////////////////////////////*/
3030

31-
TWAccount private immutable _accountImplementation;
31+
Account private immutable _accountImplementation;
3232

3333
/*///////////////////////////////////////////////////////////////
3434
Constructor
3535
//////////////////////////////////////////////////////////////*/
3636

3737
constructor(IEntryPoint _entrypoint) {
38-
_accountImplementation = new TWAccount(_entrypoint);
38+
_accountImplementation = new Account(_entrypoint);
3939
}
4040

4141
/*///////////////////////////////////////////////////////////////
@@ -54,7 +54,7 @@ contract TWAccountFactory is ITWAccountFactory, Multicall {
5454

5555
account = Clones.cloneDeterministic(impl, salt);
5656

57-
TWAccount(payable(account)).initialize(_admin);
57+
Account(payable(account)).initialize(_admin);
5858

5959
emit AccountCreated(account, _admin, _accountId);
6060

0 commit comments

Comments
 (0)