Skip to content

andreivladbrg/prb-contracts

 
 

Repository files navigation

PRBContracts GitHub Actions Coverage Status Styled with Prettier License: Unlicense

Off-the-shelf Solidity smart contracts.

  • Designed for Solidity >=0.8.4
  • Uses custom errors instead of revert reason strings
  • Complementary to OpenZeppelin Contracts
  • Promotes PRBMath as a fixed-point math library for Solidity
  • Well-documented via NatSpec comments
  • Thoroughly tested with Foundry

I created this library for my own use, to avoid having to maintain the same contracts in different repositories. If you find it useful too, that's a win-win.

Install

Foundry

First, run the install step:

forge install --no-commit paulrberg/prb-contracts

Then, add the following line to your remappings.txt file:

@prb/contracts/=lib/prb-contracts/src/

Hardhat

yarn add @prb/contracts

Usage

Once installed, you can use the contracts like this:

// SPDX-License-Identifier: Unlicense
pragma solidity >=0.8.4;

import "@prb/contracts/token/erc20/ERC20.sol";
import "@prb/contracts/token/erc20/ERC20Permit.sol";

contract MyToken is ERC20, ERC20Permit {
  constructor(
    string memory name_,
    string memory symbol_,
    uint8 decimals_
  ) ERC20Permit(name_, symbol_, decimals_) {}
}

Contributing

Feel free to dive in! Open an issue, start a discussion or submit a PR.

Pre Requisites

You will need the following software on your machine:

In addition, familiarity with Solidity is requisite.

Set Up

Clone this repository including submodules:

$ git clone --recurse-submodules -j8 git@github.com:paulrberg/prb-contracts.git

Then, inside the project's directory, run this to install the Node.js dependencies:

$ yarn install

Now you can start making changes.

Syntax Highlighting

You will need the following VSCode extensions:

Security

While I set a high bar for code quality and test coverage, you shouldn't assume that this project is completely safe to use. The contracts have not been audited by a security researcher.

Caveat Emptor

This is experimental software and is provided on an "as is" and "as available" basis. I do not give any warranties and will not be liable for any loss, direct or indirect through continued use of this codebase.

Contact

If you discover any security issues, please contact me via Keybase.

Related Efforts

License

Unlicense

About

Off-the-shelf Solidity smart contracts

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Solidity 99.8%
  • Shell 0.2%