• Stars
    star
    2,349
  • Rank 19,589 (Top 0.4 %)
  • Language
    Solidity
  • License
    MIT License
  • Created over 2 years ago
  • Updated 4 months ago

Reviews

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

Repository Details

Optimized Solidity snippets.

solady

NPM CI MIT License

Gas optimized Solidity snippets.

I'm sooooooOooooooooOoooOoooooooooooooooo...

Installation

To install with Foundry:

forge install vectorized/solady

To install with Hardhat or Truffle:

npm install solady

Contracts

The Solidity smart contracts are located in the src directory.

auth
β”œβ”€ Ownable β€” "Simple single owner authorization mixin"
β”œβ”€ OwnableRoles β€” "Simple single owner and multiroles authorization mixin"
tokens
β”œβ”€ WETH β€” "Simple Wrapped Ether implementation"
β”œβ”€ ERC20 β€” "Simple ERC20 + EIP-2612 implementation"
β”œβ”€ ERC4626 β€” "Simple ERC4626 tokenized Vault implementation"
β”œβ”€ ERC721 β€” "Simple ERC721 implementation with storage hitchhiking"
β”œβ”€ ERC2981 β€” "Simple ERC2981 NFT Royalty Standard implementation"
β”œβ”€ ERC1155 β€” "Simple ERC1155 implementation"
utils
β”œβ”€ MerkleProofLib β€” "Library for verification of Merkle proofs"
β”œβ”€ SignatureCheckerLib β€” "Library for verification of ECDSA and ERC1271 signatures"
β”œβ”€ ECDSA β€” "Library for verification of ECDSA signatures"
β”œβ”€ EIP712 β€” "Contract for EIP-712 typed structured data hashing and signing"
β”œβ”€ ERC1967Factory β€” "Factory for deploying and managing ERC1967 proxy contracts"
β”œβ”€ ERC1967FactoryConstants β€” "The address and bytecode of the canonical ERC1967Factory"
β”œβ”€ LibSort β€” "Library for efficient sorting of memory arrays"
β”œβ”€ LibPRNG β€” "Library for generating psuedorandom numbers"
β”œβ”€ Base64 β€” "Library for Base64 encoding and decoding"
β”œβ”€ SSTORE2 β€” "Library for cheaper reads and writes to persistent storage"
β”œβ”€ CREATE3 β€” "Deploy to deterministic addresses without an initcode factor"
β”œβ”€ LibRLP β€” "Library for computing contract addresses from their deployer and nonce"
β”œβ”€ LibBit β€” "Library for bit twiddling and boolean operations"
β”œβ”€ LibZip β€” "Library for compressing and decompressing bytes"
β”œβ”€ Clone β€” "Class with helper read functions for clone with immutable args"
β”œβ”€ LibClone β€” "Minimal proxy library"
β”œβ”€ LibString β€” "Library for converting numbers into strings and other string operations"
β”œβ”€ LibBitmap β€” "Library for storage of packed booleans"
β”œβ”€ LibMap β€” "Library for storage of packed unsigned integers"
β”œβ”€ MinHeapLib β€” "Library for managing a min-heap in storage"
β”œβ”€ RedBlackTreeLib β€” "Library for managing a red-black-tree in storage"
β”œβ”€ Multicallable β€” "Contract that enables a single call to call multiple methods on itself"
β”œβ”€ SafeTransferLib β€” "Safe ERC20/ETH transfer lib that handles missing return values"
β”œβ”€ DynamicBufferLib β€” "Library for buffers with automatic capacity resizing"
β”œβ”€ FixedPointMathLib β€” "Arithmetic library with operations for fixed-point numbers"
β”œβ”€ SafeCastLib β€” "Library for integer casting that reverts on overflow"
└─ DateTimeLib β€” "Library for date time operations"

Directories

src β€” "Solidity smart contracts"
test β€” "Foundry Forge tests"
js β€” "Accompanying JavaScript helper library"
ext β€” "Extra tests"
audits β€” "Audit reports"

Contributing

This repository serves as a laboratory for cutting edge snippets that may be merged into Solmate.

Feel free to make a pull request.

Do refer to the contribution guidelines for more details.

Safety

This is experimental software and is provided on an "as is" and "as available" basis.

We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.

While Solady has been heavily tested, there may be parts that may exhibit unexpected emergent behavior when used with other code, or may break in future Solidity versions.

Please always include your own thorough tests when using Solady to make sure it works correctly with your code.

Upgradability

All contracts in Solady are compatible with both upgradeable and non-upgradeable (i.e. regular) contracts.

Please call any required internal initialization methods accordingly.

Acknowledgements

This repository is inspired by or directly modified from many sources, primarily:

More Repositories

1

dn404

Implementation of a co-joined ERC20 and ERC721 pair.
Solidity
463
star
2

multicaller

Efficient multicaller contracts
Solidity
260
star
3

Python-KD-Tree

A simple and fast KD-tree for points in Python for kNN or nearest points. (damm short at just ~60 lines) No libraries needed.
Python
168
star
4

closedsea

Optimized and flexible version of OpenSea's operator filterer
Solidity
130
star
5

soledge

Solidity snippets too edgy to be in Solady
Solidity
107
star
6

Aris

Aris - A fast and powerful tool to write HTML in JS easily. Includes syntax highlighting, templates, SVG, CSS autofixing, debugger support and more...
JavaScript
88
star
7

function-selector-miner

Solidity Function Selector Miner (AVX2 + Multithreaded)
Rust
62
star
8

Static-Sort

A simple C++ header-only library for fastest sorting of small arrays. Generates sorting networks on compile time via templates.
C++
51
star
9

preapprove

On-chain pre-approval registry for NFTs. Library included.
Solidity
42
star
10

Fluidsim

A C++ fluid simulator (SPH, OpenCL, GLSL, SSE, Fast Marching Cubes)
C++
19
star
11

Othello-AI

A strong Othello AI bot for 50.021 Artificial Intelligence course.
Python
12
star
12

VoxNet-Tensorflow

A Tensorflow Implementation of VoxNet.
Python
11
star
13

QDES

Quadratic Decay Exponential Surge
Solidity
11
star
14

Softee

Solidity
7
star
15

vectorized

5
star
16

foundry-starter

Script to initialize a foundry project in the current working directory
Shell
4
star
17

Sort-Me

A Realtime Multiplayer Sorting Game for Android
Java
3
star
18

Solidity-Code-Reviews

2
star
19

ERC721A-Upgradeable-Old

Upgradeable version of ERC721A
Solidity
2
star
20

Python-Attribute-List

Add/set attributes to Python's built-in list.
Python
1
star
21

NFTStaker

Solidity
1
star
22

ERC721A-Docs

ERC721A Documentation
1
star
23

ERC721A-Transpiler

Transpiler for creating upgradable ERC721A
TypeScript
1
star
24

SUTD-Staff-Room-Maps-old-Dover-edition

An Android App for navigating the staff room in SUTD's old Dover Campus.
Java
1
star
25

CECSATSolver

CEC-SAT verification software for ISTD 2D Design Challenge
Java
1
star
26

solady-copy

Solidity
1
star