Skip to content

Commit ca0c294

Browse files
committed
initialize repository with buidler environment, readme, and license
0 parents  commit ca0c294

6 files changed

+7758
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
artifacts/
2+
cache/
3+
node_modules/

LICENSE.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (c) 2020 Nick Barry
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is
8+
furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included in
11+
all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19+
THE SOFTWARE.

README.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# SolidState Contracts
2+
3+
Upgradable-first Solidity smart contract development library.
4+
5+
## Usage
6+
7+
Install the package as a development dependency:
8+
9+
```bash
10+
npm install --save-dev @solidstate/contracts
11+
# or
12+
yarn add --dev @solidistate/contracts
13+
```
14+
15+
### Contracts
16+
17+
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.
18+
19+
### Portable Tests
20+
21+
Where possible, automated tests are designed to be imported by repositories which make use of SolidState and run against any derived contracts. This is to help prevent unintended changes to to the base contract behavior.
22+
23+
For example, consider a custom `ERC20Base` implementation:
24+
25+
```solidity
26+
import '@solidstate/contracts/token/ERC20/ERC20Base.sol';
27+
28+
contract CustomToken is ERC20Base {
29+
// custom code...
30+
}
31+
```
32+
33+
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:
34+
35+
```javascript
36+
describe('CustomToken', function () {
37+
let deploy = async function () {
38+
let factory = await ethers.getContractFactory('CustomToken');
39+
let instance = await factory.deploy();
40+
await instance.deployed();
41+
return instance;
42+
}
43+
44+
assertBehaviorOfERC20Base(deploy);
45+
46+
// custom tests...
47+
});
48+
```
49+
50+
## Development
51+
52+
Install dependencies via Yarn:
53+
54+
```bash
55+
yarn install
56+
```
57+
58+
Compile contracts via Buidler:
59+
60+
```bash
61+
yarn run buidler compile
62+
```
63+
64+
### Networks
65+
66+
By default, Buidler uses the BuidlerEVM in-process. To connect to an out-of process network such as a local instance of Ganache, specify the `localhost` or `generic` network:
67+
68+
```bash
69+
yarn run buidler test --network localhost
70+
# or
71+
URL=[NODE_URL] yarn run buidler test --network generic
72+
```
73+
74+
### Testing
75+
76+
Test contracts via Buidler:
77+
78+
```bash
79+
yarn run buidler test
80+
```

buidler.config.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
usePlugin("@nomiclabs/buidler-waffle");
2+
3+
module.exports = {
4+
solc: {
5+
version: '0.7.2',
6+
optimizer: {
7+
enabled: true,
8+
runs: 200,
9+
},
10+
},
11+
12+
networks: {
13+
generic: {
14+
// set URL for external network, such as Infura
15+
url: `${ process.env.URL }`,
16+
accounts: {
17+
mnemonic: `${ process.env.MNEMONIC }`,
18+
},
19+
},
20+
},
21+
};

package.json

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "@solidstate/contracts",
3+
"version": "0.0.0",
4+
"author": "Nick Barry",
5+
"license": "MIT",
6+
"description": "Solidity library for flexible smart contract development",
7+
"keywords": [
8+
"solidity",
9+
"smart-contracts",
10+
"ethereum",
11+
"ether",
12+
"eth",
13+
"cryptocurrency",
14+
"crypto",
15+
"wow",
16+
"library"
17+
],
18+
"repository": {
19+
"type": "git",
20+
"url": "git+https://github.com/solidstate-network/solidstate-contracts.git"
21+
},
22+
"dependencies": {},
23+
"devDependencies": {
24+
"@nomiclabs/buidler": "^1.4.7",
25+
"@nomiclabs/buidler-ethers": "^2.0.2",
26+
"@nomiclabs/buidler-waffle": "^2.1.0",
27+
"@openzeppelin/contracts": "3.2.0-solc-0.7",
28+
"chai": "^4.2.0",
29+
"ethereum-waffle": "^3.1.1"
30+
},
31+
"files": [
32+
"/contracts/**/*.sol",
33+
"!/contracts/**/*Mock.sol"
34+
]
35+
}

0 commit comments

Comments
 (0)