Skip to content

Commit fef1f7b

Browse files
committed
move package-specific readme text to package-specific readmes
1 parent a554791 commit fef1f7b

File tree

3 files changed

+55
-57
lines changed

3 files changed

+55
-57
lines changed

README.md

-57
Original file line numberDiff line numberDiff line change
@@ -25,63 +25,6 @@ It consists of the following packages:
2525
| `@solidstate/library` | functions for interacting with and validating contracts | [📖](./lib/README.md) |
2626
| `@solidstate/spec` | portable tests which may be run against third-party implementations of core contracts | [📖](./spec/README.md) |
2727

28-
### Contracts
29-
30-
All contracts are designed to either be deployed through the standard `constructor` method, or referenced by a proxy. To this end, the [diamond storage](https://medium.com/1milliondevs/new-storage-layout-for-proxy-contracts-and-diamonds-98d01d0eadb) pattern is employed exclusively.
31-
32-
### Spec
33-
34-
Where possible, automated tests are designed to be imported by repositories which make use of the Solidstate contracts and run against any derived contracts. This is to help prevent unintended changes to the base contract behavior.
35-
36-
For example, consider a custom `ERC20Base` implementation:
37-
38-
```solidity
39-
import '@solidstate/contracts/token/ERC20/base/ERC20Base.sol';
40-
41-
contract CustomToken is ERC20Base {
42-
// custom code...
43-
}
44-
```
45-
46-
Rather than rewrite the `ERC20Base` tests or assume that all core behavior remains untouched, one can import the included tests and run them against the custom implementation:
47-
48-
```javascript
49-
describe('CustomToken', () => {
50-
let instance;
51-
52-
beforeEach(async () => {
53-
const factory = await ethers.getContractFactory('CustomToken');
54-
instance = await factory.deploy();
55-
await instance.deployed();
56-
});
57-
58-
describeBehaviorOfERC20Base(
59-
async () => instance,
60-
{
61-
args: ...,
62-
}
63-
);
64-
65-
// custom tests...
66-
});
67-
```
68-
69-
If parts of the base implementation are changed intentionally, tests can be selectively skipped:
70-
71-
```javascript
72-
describeBehaviorOfERC20Base(
73-
async () => instance,
74-
{
75-
args: ...
76-
},
77-
['#balanceOf'],
78-
);
79-
80-
describe('#balanceOf', () => {
81-
// custom tests
82-
});
83-
```
84-
8528
## Development
8629

8730
Install dependencies via Yarn:

contracts/README.md

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ yarn add --dev @solidstate/contracts
1616

1717
## Code Structure
1818

19+
All contracts are designed to either be deployed through the standard `constructor` method, or referenced by a proxy. To this end, the [diamond storage](https://medium.com/1milliondevs/new-storage-layout-for-proxy-contracts-and-diamonds-98d01d0eadb) pattern is employed exclusively.
20+
1921
### Layers Pattern
2022

2123
Each of the Solidstate contracts is split into multiple "layers" across multiple files: external contracts, internal contracts, external interfaces, internal interfaces, and storage libraries.

spec/README.md

+53
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,56 @@ npm install --save-dev @solidstate/spec
1111
# or
1212
yarn add --dev @solidstate/spec
1313
```
14+
15+
## Usage
16+
17+
Where possible, automated tests are designed to be imported by repositories which make use of the Solidstate contracts and run against any derived contracts. This is to help prevent unintended changes to the base contract behavior.
18+
19+
For example, consider a custom `ERC20Base` implementation:
20+
21+
```solidity
22+
import '@solidstate/contracts/token/ERC20/base/ERC20Base.sol';
23+
24+
contract CustomToken is ERC20Base {
25+
// custom code...
26+
}
27+
```
28+
29+
Rather than rewrite the `ERC20Base` tests or assume that all core behavior remains untouched, one can import the included tests and run them against the custom implementation:
30+
31+
```javascript
32+
describe('CustomToken', () => {
33+
let instance;
34+
35+
beforeEach(async () => {
36+
const factory = await ethers.getContractFactory('CustomToken');
37+
instance = await factory.deploy();
38+
await instance.deployed();
39+
});
40+
41+
describeBehaviorOfERC20Base(
42+
async () => instance,
43+
{
44+
args: ...,
45+
}
46+
);
47+
48+
// custom tests...
49+
});
50+
```
51+
52+
If parts of the base implementation are changed intentionally, tests can be selectively skipped:
53+
54+
```javascript
55+
describeBehaviorOfERC20Base(
56+
async () => instance,
57+
{
58+
args: ...
59+
},
60+
['#balanceOf'],
61+
);
62+
63+
describe('#balanceOf', () => {
64+
// custom tests
65+
});
66+
```

0 commit comments

Comments
 (0)