@0x/contracts-staking

Staking contracts used by 0x protocol

Usage no npm install needed!

<script type="module">
  import 0xContractsStaking from 'https://cdn.skypack.dev/@0x/contracts-staking';
</script>

README

Staking Contracts

This package implements the stake-based liquidity incentives defined by ZEIP-31.

See the specification here.

Contracts Directory Structure

The contracts can be found in contracts/src.

* Staking.sol        | This is a stateless contract that encapsulates all the staking logic.
* StakingProxy.sol   | This is a stateful contract that proxies into the Staking contract.
* ReadOnlyProxy.sol  | This is a stateless contract the makes read-only calls from the Staking Proxy to the Staking Contract.
* fees/              | This contains mixins that implement the logic for 0x Protocol fees.
* immutable/         | This contains mixins that are generally immutable. Changing these files can result in catastrophic failures. Exercise extreme caution.
* interfaces/        | This contains interfaces used throughout the entire staking system.
* libs/              | This contains libraries used by the staking contract; for example, math and signature validation.
* stake/             | This contains mixins that implement the core staking logic.
* staking_pools/     | This contains mixins that implement logic for creating and managing staking pools.
* sys/               | This contains mixins that implement system-level functionality, like scheduling and finalization.
* vaults/            | This contains the vaults (like the Zrx Token Vault).

Installation

Install

npm install @0x/contracts-staking --save

Contributing

We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.

For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the 0x Improvement Proposals (ZEIPs) repository and follow the contribution guidelines provided therein.

Please read our contribution guidelines before getting started.

Install Dependencies

If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:

yarn config set workspaces-experimental true

Then install dependencies

yarn install

Build

To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:

PKG=@0x/contracts-staking yarn build

Or continuously rebuild on change:

PKG=@0x/contracts-staking yarn watch

Clean

yarn clean

Lint

yarn lint

Run Tests

yarn test