• Stars
    star
    130
  • Rank 268,745 (Top 6 %)
  • Language
    Solidity
  • License
    MIT License
  • Created over 3 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Off-the-shelf Solidity smart contracts

PRBContracts GitHub Actions Foundry License: MIT

Off-the-shelf Solidity smart contracts.

  • Designed for Solidity >=0.8.4
  • Uses custom errors instead of revert reason strings
  • Complementary to OpenZeppelin's library
  • Well-documented via NatSpec comments
  • Thoroughly tested with Foundry

I initially created this library to streamline my personal workflow, as I was tired of having to maintain identical contracts across multiple repositories. However, if you find this library beneficial to your own projects, that's a win-win situation for both of us.

Install

Foundry

First, run the install step:

forge install --no-commit PaulRBerg/prb-contracts@v5

Your .gitmodules file should now contain the following entry:

[submodule "lib/prb-contracts"]
  branch = "v5"
  path = "lib/prb-contracts"
  url = "https://github.com/PaulRBerg/prb-contracts"

Finally, add this to your remappings.txt file:

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

Hardhat

pnpm add @prb/contracts

Usage

Once installed, you can use the contracts like this:

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

import { ERC20 } from "@prb/contracts/token/erc20/ERC20.sol";
import { ERC20Permit } from "@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 [email protected]:PaulRBerg/prb-contracts.git

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

$ pnpm install

Now you can start making changes.

Syntax Highlighting

You will need the following VSCode extensions:

Security

While I have strict standards for code quality and test coverage, it's important to note that this project may not be entirely risk-free. Although I have taken measures to ensure the security of the contracts, they have not yet been audited by a third-party security researcher.

Caveat Emptor

Please be aware that this software is experimental and is provided on an "as is" and "as available" basis. I do not offer any warranties, and I cannot be held responsible for any direct or indirect loss resulting from the continued use of this codebase.

Contact

If you discover any bugs or security issues, please report them via Telegram.

Related Efforts

License

This project is licensed under MIT.

More Repositories

1

hardhat-template

Hardhat-based template for developing Solidity smart contracts
TypeScript
1,921
star
2

prb-math

Solidity library for advanced fixed-point math
Solidity
805
star
3

foundry-template

Foundry-based template for developing Solidity smart contracts
Solidity
485
star
4

prb-proxy

Proxy contract to compose Ethereum transactions
Solidity
270
star
5

prb-test

Modern collection of testing assertions and logging utilities for Solidity
Solidity
178
star
6

multisol

CLI application for verifying Solidity contracts on Etherscan
Rust
113
star
7

rust-template

A template for developing Rust projects, with sensible defaults
Rust
76
star
8

awesome-zkp-starter-pack

A curated collection of links for zero-knowledge proof cryptography used in blockchains
69
star
9

btt-examples

Examples for Branching Tree Technique, a simple specification framework for writing structured Solidity tests
Solidity
52
star
10

evm-bn

Convert fixed-point numbers to ethers big numbers and vice-versa.
TypeScript
49
star
11

check-same-sign

Gas golfing the most gas efficient way to check if two integers have the same sign in Solidity
Solidity
46
star
12

foundry-multibuild

GitHub Action for building a Foundry project with a range of Solidity versions
Shell
38
star
13

hardhat-packager

Hardhat plugin for preparing the contract artifacts and the TypeChain bindings for registry deployment
TypeScript
35
star
14

ethsum

Simple Ethereum address checksum tool
JavaScript
33
star
15

solplate

Simple utility for generating boilerplate Solidity contracts
Rust
32
star
16

typescript-template

A template for developing TypeScript project, with sensible defaults
TypeScript
32
star
17

awesome-many-worlds

Curated collection of educational materials on the many-worlds interpretation of quantum mechanics
23
star
18

CoinMarketCap-Desktop

A simple desktop wrapper for CoinMarketCap
JavaScript
21
star
19

github-labels

GitHub labels to use across repositories
Shell
20
star
20

erc2212

Reference implementation for ERC-2212
JavaScript
12
star
21

unchecked-counter

Solidity counter type that bypasses checked arithmetic
Solidity
12
star
22

contractz

Sketchbook for my Ethereum contracts
Solidity
11
star
23

modlizer

Struggling with iOS design patterns? Embrace Modlizer
Swift
11
star
24

create2-repro

Repo to reproduce the inconsistent CREATE2 behavior in Foundry
Solidity
10
star
25

defi-types

TypeChain bindings for DeFi protocols
Solidity
10
star
26

dyi-crypto-taxes

Spreadsheet templates and practical tips and tricks for doing your taxes alone
10
star
27

abdk-gas-estimations

Gas estimations for ADBKMath64x64
Solidity
9
star
28

rust-book-annotations

My absorption of the Rust Book
Rust
8
star
29

javascript-template

A template for developing JavaScript projects, with sensible defaults
JavaScript
7
star
30

typescript-monorepo-template

Dummy monorepo set up with Typescript and Yarn Workspaces
TypeScript
4
star
31

tft

Browser extension that prevents typos by asking you to double-check the content before posting a long tweet",
JavaScript
3
star
32

cryptfolio-scripts

Google Apps Script functions to help with tracking a crypto portfolio in Google Sheets
JavaScript
3
star
33

foundry-expect-emit-bug

Repo to reproduce the bug I ran into while writing tests with Foundry
Solidity
3
star
34

cea-contracts

Base smart contracts used in the default template of Create Eth App
JavaScript
3
star
35

my-eth-app

Default boilerplate code generated by create-eth-app
HTML
3
star
36

hardhat-prb

Hardhat plugins to complement the PRB smart contract libraries
TypeScript
3
star
37

flipper-ui

The frontend app for the users of Flipper.
JavaScript
2
star
38

react-hooks

React Hooks to be shared across my personal projects and packages
JavaScript
2
star
39

web3-react-blobs

Blobs of web3-react code used in the Sablier Interface
JavaScript
2
star
40

forge-coverage-bug

Repo to reproduce the bug in the forge coverage command
Solidity
2
star
41

PaulRBerg.github.io

My personal preferences
JavaScript
2
star
42

xstate-useActor-bug

xstate useActor bug
TypeScript
2
star
43

prb-proxy-frontend

Landing page for PRBProxy
TypeScript
2
star
44

eslint-config

Eslint config to be shared across my personal projects and packages
JavaScript
2
star
45

airdropx

Firebase backend for the AirdropX Telegram bot
JavaScript
1
star
46

learn-plasma-rss

RSS feed for Plasma resources
JavaScript
1
star
47

paulrberg-labelsync

Dummy repo for label-sync.com
1
star
48

sketchpad

Personal repo for learning, logs and constants
JavaScript
1
star
49

dfe

Browser extension that hides the price of Ether
JavaScript
1
star
50

cea-template

The official base template for Create Eth App.
HTML
1
star
51

hardhat-ignition-basic

Dummy project for going through the [email protected] basic tutorial
TypeScript
1
star
52

vscode-dictionary

Personal dictionary for vscode-spell-checker
1
star
53

buidler-invalid-opcode

Reproduces the ganache-cli invalid opcode bug
TypeScript
1
star
54

yarn-rc34-error

Dummy project to reproduce the errors I encountered with [email protected]
JavaScript
1
star
55

ethiasi

Landing page for the first Ethereum event in Iasi, Romania
CSS
1
star
56

codebase-go

Personal repo for learning, logs and constants related to golang.
Go
1
star
57

ethereum-signatures-progress

A collection of links and resources I collected in order to implement EIP-191 and EIP-712 into geth.
1
star