solidstate-network / solidstate-solidity

πŸ’  Upgradeable-first Solidity smart contract development library πŸ’ 

Home Page:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SolidState Solidity

SolidState is an upgradeable-first Solidity smart contract development library.

It consists of the following packages:

package description πŸ“•
@solidstate/abi contract ABIs πŸ“–
@solidstate/contracts core contracts πŸ“–
@solidstate/library functions for interacting with and validating contracts πŸ“–
@solidstate/spec portable tests which may be run against third-party implementations of core contracts πŸ“–

Note: A version of this library has been audited by Hacken. More details are available in the report.


All contracts are designed to either be deployed through the standard constructor method, or referenced by a proxy. To this end, the diamond storage pattern is employed exclusively.


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 to the base contract behavior.

For example, consider a custom ERC20Base implementation:

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:

describe('CustomToken', function () {
  let instance;

  beforeEach(async function () {
    const factory = await ethers.getContractFactory('CustomToken');
    instance = await factory.deploy();
    await instance.deployed();

      deploy: () => instance,

  // custom tests...

If parts of the base implementation are changed intentionally, tests can be selectively skipped:

    deploy: () => instance,

describe('#balanceOf', function () {
  // custom tests


Install dependencies via Yarn:

yarn install

Setup Husky to format code on commit:

yarn prepare

Link local packages and install remaining dependencies via Lerna:

yarn run lerna bootstrap

Compile contracts via Hardhat:

yarn run hardhat compile

Automatically upgrade dependencies with yarn-up:

yarn upgrade-dependencies


Test contracts with Hardhat and generate gas report using hardhat-gas-reporter:

yarn run hardhat test

Generate a code coverage report using solidity-coverage:

yarn run hardhat coverage


Publish packages via Lerna:

yarn lerna-publish



πŸ’  Upgradeable-first Solidity smart contract development library πŸ’

License:MIT License


Language:TypeScript 54.6%Language:Solidity 45.4%Language:Shell 0.0%