Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/solidstate-network/solidstate-solidity
💠Upgradeable-first Solidity smart contract development library ðŸ’
https://github.com/solidstate-network/solidstate-solidity
buidler crypto cryptocurrency eth ether ethereum hardhat library smart-contracts solidity wow
Last synced: 6 days ago
JSON representation
💠Upgradeable-first Solidity smart contract development library ðŸ’
- Host: GitHub
- URL: https://github.com/solidstate-network/solidstate-solidity
- Owner: solidstate-network
- License: mit
- Created: 2020-10-08T03:01:01.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-05-22T16:11:22.000Z (7 months ago)
- Last Synced: 2024-05-22T16:56:15.999Z (7 months ago)
- Topics: buidler, crypto, cryptocurrency, eth, ether, ethereum, hardhat, library, smart-contracts, solidity, wow
- Language: TypeScript
- Homepage: https://discord.gg/BnvwfM6bRe
- Size: 4.25 MB
- Stars: 410
- Watchers: 12
- Forks: 85
- Open Issues: 51
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-solidity - solidstate-network/solidstate-solidity - Upgradeable-first smart contract development library. (Libraries)
- awesome-solidity - solidstate-network/solidstate-solidity - Upgradeable-first smart contract development library. (Libraries)
- awesome-solidity - solidstate-network/solidstate-solidity - Upgradeable-first smart contract development library. (Libraries)
README
# SolidState Solidity
SolidState is an upgradeable-first Solidity smart contract development library.
It consists of the following packages:
| package | description | 📕 |
| ----------------------- | ------------------------------------------------------------------------------------- | --------------------------- |
| `@solidstate/abi` | contract ABIs | [📖](./abi/README.md) |
| `@solidstate/contracts` | core contracts | [📖](./contracts/README.md) |
| `@solidstate/library` | functions for interacting with and validating contracts | [📖](./lib/README.md) |
| `@solidstate/spec` | portable tests which may be run against third-party implementations of core contracts | [📖](./spec/README.md) |### Contracts
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.
### Spec
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.
For example, consider a custom `ERC20Base` implementation:
```solidity
import '@solidstate/contracts/token/ERC20/base/ERC20Base.sol';contract CustomToken is ERC20Base {
// custom code...
}
```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:
```javascript
describe('CustomToken', () => {
let instance;beforeEach(async () => {
const factory = await ethers.getContractFactory('CustomToken');
instance = await factory.deploy();
await instance.deployed();
});describeBehaviorOfERC20Base(
async () => instance,
{
args: ...,
}
);// custom tests...
});
```If parts of the base implementation are changed intentionally, tests can be selectively skipped:
```javascript
describeBehaviorOfERC20Base(
async () => instance,
{
args: ...
},
['#balanceOf'],
);describe('#balanceOf', () => {
// custom tests
});
```## Development
Install dependencies via Yarn:
```bash
yarn install
```Setup Husky to format code on commit:
```bash
yarn prepare
```Compile contracts via Hardhat:
```bash
yarn run hardhat compile
```Automatically upgrade dependencies with yarn-up:
```bash
yarn upgrade-dependencies
```### Testing
Test contracts with Hardhat and generate gas report using `hardhat-gas-reporter`:
```bash
yarn run hardhat test
```Generate a code coverage report using `solidity-coverage`:
```bash
yarn run hardhat coverage
```### Publication
Publish packages via Lerna:
```bash
yarn lerna-publish
```