Skip to content

Commit ec2ed93

Browse files
committed
Remove formatting changes
1 parent 47c73b0 commit ec2ed93

File tree

1 file changed

+10
-30
lines changed

1 file changed

+10
-30
lines changed

README.md

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ using Library for bytes
4343
bytes._function()
4444
```
4545

46-
We could remedy this by insisting on the use public functions. However, developers may prefer internal functions because they are more gas efficient to call, due to how libraries are compiled in Solidity:
46+
Insisting on the use public functions could avoid this issue. However, we should not rely on this as a remedy as developers may prefer internal functions because they are more gas efficient to call, due to how libraries are compiled in Solidity:
4747

4848
> ... the code of internal library functions that are called from a contract and all functions called from therein will at compile time be included in the calling contract, and a regular JUMP call will be used instead of a DELEGATECALL. ([source](https://docs.soliditylang.org/en/latest/contracts.html#libraries))
4949
@@ -67,12 +67,6 @@ Events should track things that _happened_ and so should be past tense. Using pa
6767

6868
We are aware this does not follow precedent from early ERCs, like [ERC-20](https://eips.ethereum.org/EIPS/eip-20). However it does align with some more recent high profile Solidity, e.g. [1](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/976a3d53624849ecaef1231019d2052a16a39ce4/contracts/access/Ownable.sol#L33), [2](https://github.com/aave/aave-v3-core/blob/724a9ef43adf139437ba87dcbab63462394d4601/contracts/interfaces/IAaveOracle.sol#L25-L31), [3](https://github.com/ProjectOpenSea/seaport/blob/1d12e33b71b6988cbbe955373ddbc40a87bd5b16/contracts/zones/interfaces/PausableZoneEventsAndErrors.sol#L25-L41).
6969

70-
YES:
71-
72-
```solidity
73-
event OwnerUpdated(address newOwner);
74-
```
75-
7670
NO:
7771

7872
```solidity
@@ -87,6 +81,8 @@ YES:
8781
event OwnerUpdated(address newOwner);
8882
```
8983

84+
##### B. Prefer `SubjectVerb` naming format.
85+
9086
NO:
9187

9288
```solidity
@@ -115,19 +111,6 @@ function validate(UserOperation calldata userOp) external returns (bytes memory
115111

116112
However, it is important to be explicit when returning early.
117113

118-
YES:
119-
120-
```solidity
121-
function validate(UserOperation calldata userOp) external returns (bytes memory context, uint256 validationData) {
122-
context = "";
123-
validationData = 1;
124-
125-
if (condition) {
126-
return (context, validationData);
127-
}
128-
}
129-
```
130-
131114
NO:
132115

133116
```solidity
@@ -200,22 +183,16 @@ pragma solidity ^0.8.0;
200183

201184
#### 5. Struct and Error Definitions
202185

203-
This helps with clarity.
186+
##### A. Prefer declaring structs and errors within the interface, contract, or library where they are used.
204187

205-
However, if a struct or error is used across many files, with no interface, contract, or library reasonably being the "owner," then define them in their own file. Multiple structs and errors can be defined together in one file.
188+
##### B. If a struct or error is used across many files, with no interface, contract, or library reasonably being the "owner," then define them in their own file. Multiple structs and errors can be defined together in one file.
206189

207190
#### 6. Imports
208191

209192
##### A. Use named imports.
210193

211194
Named imports help readers understand what exactly is being used and where it is originally declared.
212195

213-
YES:
214-
215-
```solidity
216-
import {Contract} from "./contract.sol"
217-
```
218-
219196
NO:
220197

221198
```solidity
@@ -229,10 +206,13 @@ For convenience, named imports do not have to be used in test files.
229206
YES:
230207

231208
```solidity
232-
import {A} from './A.sol'
233-
import {B} from './B.sol'
209+
import {Contract} from "./contract.sol"
234210
```
235211

212+
For convenience, named imports do not have to be used in test files.
213+
214+
##### B. Order imports alphabetically (A to Z) by file name.
215+
236216
NO:
237217

238218
```solidity

0 commit comments

Comments
 (0)