Skip to content

Commit 65e4353

Browse files
committed
Merge branch 'master' into no-git-abi
2 parents 10baafd + 18aa9da commit 65e4353

File tree

171 files changed

+925
-2792
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+925
-2792
lines changed

contracts/README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,19 @@ This is done to give the developer granular control over which functions are ava
3131

3232
An overview of the uses of each layer is as follows:
3333

34-
| layer | contents | description | example |
35-
| ------------------ | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
36-
| External Contract | `external` functions | set of externally callable functions | `FungibleTokenBase.sol` |
37-
| Internal Contract | `internal` functions | set of internal functions that define a module's core logic; may be called by inheriting contracts | `_FungibleTokenBase.sol` |
38-
| External Interface | `external` function declarations and NatSpec documentation | set of function declarations that constitute a module's external interface | `IFungibleTokenBase.sol` |
39-
| Internal Interface | `event`, `error`, `enum`, `struct` | set of non-function elements of a module's interface | `_IFungibleTokenBase.sol` |
40-
| Storage Library | storage layout `struct` (`Layout`), getter function (`layout()`), and standard storage location (`DEFAULT_STORAGE_SLOT`) | library for accessing and modifying storage; useful when sharing access to storage between implementation contracts that will be deployed separately (such as in the "diamond" proxy architecture) | `ERC20BaseStorage.sol` |
34+
| layer | contents | description | example |
35+
| ------------------ | ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
36+
| External Contract | `external` functions | set of externally callable functions | `FungibleToken.sol` |
37+
| Internal Contract | `internal` functions | set of internal functions that define a module's core logic; may be called by inheriting contracts | `_FungibleToken.sol` |
38+
| External Interface | `external` function declarations and NatSpec documentation | set of function declarations that constitute a module's external interface | `IFungibleToken.sol` |
39+
| Internal Interface | `event`, `error`, `enum`, `struct` | set of non-function elements of a module's interface | `_IFungibleToken.sol` |
40+
| Storage Library | storage layout `struct` (`Layout`), getter function (`layout()`), and standard storage location (`DEFAULT_STORAGE_SLOT`) | library for accessing and modifying storage; useful when sharing access to storage between implementation contracts that will be deployed separately (such as in the "diamond" proxy architecture) | `ERC20Storage.sol` |
4141

4242
### Solidstate Pre-Configured Contracts
4343

4444
Solidstate maintains "recommended" implementations of various standards, which are suitable for most users. Internally, these implementations may be composed of several modules, which themselves may be composed of several "visibility layers". Visibility layers are subject to a consistent naming convention so that their purposes may be easily identified.
4545

46-
For example, the `SolidstateFungibleToken` contract contains `FungibleTokenBase`, `FungibleTokenExtended` and `FungibleTokenMetadata` modules (among others), which are recommended for most projects.
46+
For example, the `SolidstateFungibleToken` contract contains `FungibleToken`, `FungibleTokenExtended` and `FungibleTokenMetadata` modules (among others), which are recommended for most projects.
4747

4848
### Standard Interfaces
4949

contracts/access/access_control/_AccessControl.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
pragma solidity ^0.8.20;
44

55
import { EnumerableSet } from '../../data/EnumerableSet.sol';
6+
import { AccessControlStorage } from '../../storage/AccessControlStorage.sol';
67
import { AddressUtils } from '../../utils/AddressUtils.sol';
78
import { UintUtils } from '../../utils/UintUtils.sol';
89
import { _IAccessControl } from './_IAccessControl.sol';
9-
import { AccessControlStorage } from './AccessControlStorage.sol';
1010

1111
/**
1212
* @title Role-based access control system

contracts/access/ownable/_Ownable.sol

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
pragma solidity ^0.8.20;
44

55
import { IERC173 } from '../../interfaces/IERC173.sol';
6+
import { ERC173Storage } from '../../storage/ERC173Storage.sol';
67
import { AddressUtils } from '../../utils/AddressUtils.sol';
78
import { _IOwnable } from './_IOwnable.sol';
8-
import { OwnableStorage } from './OwnableStorage.sol';
99

1010
abstract contract _Ownable is _IOwnable {
1111
using AddressUtils for address;
@@ -22,7 +22,7 @@ abstract contract _Ownable is _IOwnable {
2222
}
2323

2424
function _owner() internal view virtual returns (address) {
25-
return OwnableStorage.layout(OwnableStorage.DEFAULT_STORAGE_SLOT).owner;
25+
return ERC173Storage.layout(ERC173Storage.DEFAULT_STORAGE_SLOT).owner;
2626
}
2727

2828
function _transitiveOwner() internal view virtual returns (address owner) {
@@ -42,8 +42,8 @@ abstract contract _Ownable is _IOwnable {
4242
}
4343

4444
function _setOwner(address account) internal virtual {
45-
OwnableStorage.Layout storage $ = OwnableStorage.layout(
46-
OwnableStorage.DEFAULT_STORAGE_SLOT
45+
ERC173Storage.Layout storage $ = ERC173Storage.layout(
46+
ERC173Storage.DEFAULT_STORAGE_SLOT
4747
);
4848
emit OwnershipTransferred($.owner, account);
4949
$.owner = account;

contracts/access/ownable/_SafeOwnable.sol

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
pragma solidity ^0.8.20;
44

5+
import { ERC173Storage } from '../../storage/ERC173Storage.sol';
56
import { _ISafeOwnable } from './_ISafeOwnable.sol';
67
import { _Ownable } from './_Ownable.sol';
7-
import { SafeOwnableStorage } from './SafeOwnableStorage.sol';
88

99
abstract contract _SafeOwnable is _ISafeOwnable, _Ownable {
1010
modifier onlyNomineeOwner() {
@@ -18,8 +18,8 @@ abstract contract _SafeOwnable is _ISafeOwnable, _Ownable {
1818
*/
1919
function _nomineeOwner() internal view virtual returns (address) {
2020
return
21-
SafeOwnableStorage
22-
.layout(SafeOwnableStorage.DEFAULT_STORAGE_SLOT)
21+
ERC173Storage
22+
.layout(ERC173Storage.DEFAULT_STORAGE_SLOT)
2323
.nomineeOwner;
2424
}
2525

@@ -28,8 +28,8 @@ abstract contract _SafeOwnable is _ISafeOwnable, _Ownable {
2828
*/
2929
function _acceptOwnership() internal virtual onlyNomineeOwner {
3030
_setOwner(msg.sender);
31-
delete SafeOwnableStorage
32-
.layout(SafeOwnableStorage.DEFAULT_STORAGE_SLOT)
31+
delete ERC173Storage
32+
.layout(ERC173Storage.DEFAULT_STORAGE_SLOT)
3333
.nomineeOwner;
3434
}
3535

@@ -46,8 +46,8 @@ abstract contract _SafeOwnable is _ISafeOwnable, _Ownable {
4646
* @notice set nominee owner
4747
*/
4848
function _setNomineeOwner(address account) internal virtual {
49-
SafeOwnableStorage
50-
.layout(SafeOwnableStorage.DEFAULT_STORAGE_SLOT)
49+
ERC173Storage
50+
.layout(ERC173Storage.DEFAULT_STORAGE_SLOT)
5151
.nomineeOwner = account;
5252
}
5353
}

contracts/factory/MinimalProxyFactory.sol

+25-23
Original file line numberDiff line numberDiff line change
@@ -6,69 +6,71 @@ import { Factory } from './Factory.sol';
66

77
/**
88
* @title Factory for the deployment of EIP1167 minimal proxies
9+
* @dev see https://eips.ethereum.org/EIPS/eip-1167
910
* @dev derived from https://github.com/optionality/clone-factory (MIT license)
1011
*/
1112
library MinimalProxyFactory {
12-
bytes private constant MINIMAL_PROXY_INIT_CODE_PREFIX =
13+
bytes20 private constant MINIMAL_PROXY_INIT_CODE_PREFIX =
1314
hex'3d602d80600a3d3981f3_363d3d373d3d3d363d73';
14-
bytes private constant MINIMAL_PROXY_INIT_CODE_SUFFIX =
15+
bytes15 private constant MINIMAL_PROXY_INIT_CODE_SUFFIX =
1516
hex'5af43d82803e903d91602b57fd5bf3';
1617

1718
/**
1819
* @notice deploy an EIP1167 minimal proxy using "CREATE" opcode
1920
* @param target implementation contract to proxy
20-
* @return minimalProxy address of deployed proxy
21+
* @return deploymentAdress address of deployed proxy
2122
*/
2223
function deployMinimalProxy(
2324
address target
24-
) internal returns (address minimalProxy) {
25-
return Factory.deploy(generateMinimalProxyInitCode(target));
25+
) internal returns (address deploymentAdress) {
26+
deploymentAdress = Factory.deploy(generateMinimalProxyInitCode(target));
2627
}
2728

2829
/**
2930
* @notice deploy an EIP1167 minimal proxy using "CREATE2" opcode
3031
* @dev reverts if deployment is not successful (likely because salt has already been used)
3132
* @param target implementation contract to proxy
3233
* @param salt input for deterministic address calculation
33-
* @return minimalProxy address of deployed proxy
34+
* @return deploymentAdress address of deployed proxy
3435
*/
3536
function deployMinimalProxy(
3637
address target,
3738
bytes32 salt
38-
) internal returns (address minimalProxy) {
39-
return Factory.deploy(generateMinimalProxyInitCode(target), salt);
39+
) internal returns (address deploymentAdress) {
40+
deploymentAdress = Factory.deploy(
41+
generateMinimalProxyInitCode(target),
42+
salt
43+
);
4044
}
4145

4246
/**
4347
* @notice calculate the deployment address for a given target and salt
4448
* @param target implementation contract to proxy
4549
* @param salt input for deterministic address calculation
46-
* @return deployment address
50+
* @return deploymentAddress deployment address
4751
*/
4852
function calculateMinimalProxyDeploymentAddress(
4953
address target,
5054
bytes32 salt
51-
) internal view returns (address) {
52-
return
53-
Factory.calculateDeploymentAddress(
54-
keccak256(generateMinimalProxyInitCode(target)),
55-
salt
56-
);
55+
) internal view returns (address deploymentAddress) {
56+
deploymentAddress = Factory.calculateDeploymentAddress(
57+
keccak256(generateMinimalProxyInitCode(target)),
58+
salt
59+
);
5760
}
5861

5962
/**
6063
* @notice concatenate elements to form EIP1167 minimal proxy initialization code
6164
* @param target implementation contract to proxy
62-
* @return bytes memory initialization code
65+
* @return initCode bytes memory initialization code
6366
*/
6467
function generateMinimalProxyInitCode(
6568
address target
66-
) internal pure returns (bytes memory) {
67-
return
68-
abi.encodePacked(
69-
MINIMAL_PROXY_INIT_CODE_PREFIX,
70-
target,
71-
MINIMAL_PROXY_INIT_CODE_SUFFIX
72-
);
69+
) internal pure returns (bytes memory initCode) {
70+
initCode = abi.encodePacked(
71+
MINIMAL_PROXY_INIT_CODE_PREFIX,
72+
target,
73+
MINIMAL_PROXY_INIT_CODE_SUFFIX
74+
);
7375
}
7476
}

contracts/introspection/Introspectable.sol

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ pragma solidity ^0.8.20;
55
import { IERC165 } from '../interfaces/IERC165.sol';
66
import { IIntrospectable } from './IIntrospectable.sol';
77
import { _Introspectable } from './_Introspectable.sol';
8-
import { ERC165BaseStorage } from './ERC165BaseStorage.sol';
98

109
/**
1110
* @title ERC165 implementation

contracts/introspection/_Introspectable.sol

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
pragma solidity ^0.8.20;
44

5+
import { ERC165Storage } from '../storage/ERC165Storage.sol';
56
import { _IIntrospectable } from './_IIntrospectable.sol';
6-
import { ERC165BaseStorage } from './ERC165BaseStorage.sol';
77

88
/**
99
* @title ERC165 implementation
@@ -18,8 +18,8 @@ abstract contract _Introspectable is _IIntrospectable {
1818
bytes4 interfaceId
1919
) internal view virtual returns (bool) {
2020
return
21-
ERC165BaseStorage
22-
.layout(ERC165BaseStorage.DEFAULT_STORAGE_SLOT)
21+
ERC165Storage
22+
.layout(ERC165Storage.DEFAULT_STORAGE_SLOT)
2323
.supportedInterfaces[interfaceId];
2424
}
2525

@@ -34,8 +34,8 @@ abstract contract _Introspectable is _IIntrospectable {
3434
) internal virtual {
3535
if (interfaceId == 0xffffffff)
3636
revert Introspectable__InvalidInterfaceId();
37-
ERC165BaseStorage
38-
.layout(ERC165BaseStorage.DEFAULT_STORAGE_SLOT)
37+
ERC165Storage
38+
.layout(ERC165Storage.DEFAULT_STORAGE_SLOT)
3939
.supportedInterfaces[interfaceId] = status;
4040
}
4141
}

contracts/multisig/ECDSAMultisigWallet.sol

-27
This file was deleted.

contracts/multisig/ECDSAMultisigWalletStorage.sol

-39
This file was deleted.

contracts/multisig/IECDSAMultisigWallet.sol

-18
This file was deleted.

0 commit comments

Comments
 (0)